PATCH: fix the sb_ess driver init bug

Alan Cox (alan@lxorguk.ukuu.org.uk)
Fri, 3 Dec 1999 16:36:56 +0000


diff -u --new-file --recursive --exclude-from ../exclude linux.30p5/drivers/sound/sb_ess.c linux.ac/drivers/sound/sb_ess.c
--- linux.30p5/drivers/sound/sb_ess.c Fri Dec 3 11:52:43 1999
+++ linux.ac/drivers/sound/sb_ess.c Wed Dec 1 23:51:21 1999
@@ -10,29 +10,29 @@
*
* History:
*
- * Rolf Fokkens (Dec 20 1998): ES188x recording level support on a per
+ * Rolf Fokkens (Dec 20 1998): ES188x recording level support on a per
* fokkensr@vertis.nl input basis.
- * (Dec 24 1998): Recognition of ES1788, ES1887, ES1888,
+ * (Dec 24 1998): Recognition of ES1788, ES1887, ES1888,
* ES1868, ES1869 and ES1878. Could be used for
* specific handling in the future. All except
* ES1887 and ES1888 and ES688 are handled like
* ES1688.
- * (Dec 27 1998): RECLEV for all (?) ES1688+ chips. ES188x now
+ * (Dec 27 1998): RECLEV for all (?) ES1688+ chips. ES188x now
* have the "Dec 20" support + RECLEV
- * (Jan 2 1999): Preparation for Full Duplex. This means
+ * (Jan 2 1999): Preparation for Full Duplex. This means
* Audio 2 is now used for playback when dma16
* is specified. The next step would be to use
* Audio 1 and Audio 2 at the same time.
- * (Jan 9 1999): Put all ESS stuff into sb_ess.[ch], this
+ * (Jan 9 1999): Put all ESS stuff into sb_ess.[ch], this
* includes both the ESS stuff that has been in
* sb_*[ch] before I touched it and the ESS support
* I added later
- * (Jan 23 1999): Full Duplex seems to work. I wrote a small
+ * (Jan 23 1999): Full Duplex seems to work. I wrote a small
* test proggy which works OK. Haven't found
* any applications to test it though. So why did
* I bother to create it anyway?? :) Just for
* fun.
- * (May 2 1999): I tried to be too smart by "introducing"
+ * (May 2 1999): I tried to be too smart by "introducing"
* ess_calc_best_speed (). The idea was that two
* dividers could be used to setup a samplerate,
* ess_calc_best_speed () would choose the best.
@@ -40,10 +40,12 @@
* recording problems for high samplerates. I
* fixed this by removing ess_calc_best_speed ()
* and just doing what the documentation says.
- * Andy Sloane (June 4 1999): Stole some code from ALSA to fix the playback
+ * Andy Sloane (Jun 4 1999): Stole some code from ALSA to fix the playback
* andy@guildsoftware.com speed on ES1869, ES1879, ES1887, and ES1888.
* 1879's were previously ignored by this driver;
* added (untested) support for those.
+ * Cvetan Ivanov (Oct 27 1999): Fixed ess_dsp_init to call ess_set_dma_hw for
+ * zezo@inet.bg _ALL_ ESS models, not only ES1887
*
* This files contains ESS chip specifics. It's based on the existing ESS
* handling as it resided in sb_common.c, sb_mixer.c and sb_audio.c. This
@@ -52,7 +54,7 @@
* - RECLEV support for ES1688 and later
* - 6 bits playback level support chips later than ES1688
* - Recording level support on a per-device basis for ES1887
- * - Full-Duplex for ES1887 (under development)
+ * - Full-Duplex for ES1887
*
* Full duplex is enabled by specifying dma16. While the normal dma must
* be one of 0, 1 or 3, dma16 can be one of 0, 1, 3 or 5. DMA 5 is a 16 bit
@@ -100,7 +102,7 @@
* of writing 0x00 to 0x7f (which should be done by reset): The ES1887 moves
* into ES1888 mode. This means that it claims IRQ 11, which happens to be my
* ISDN adapter. Needless to say it no longer worked. I now understand why
- * after rebooting 0x7f already was 0x05, the value of my choise: the BIOS
+ * after rebooting 0x7f already was 0x05, the value of my choice: the BIOS
* did it.
*
* Oh, and this is another trap: in ES1887 docs mixer register 0x70 is decribed
@@ -1200,10 +1202,10 @@

/* AAS: info stolen from ALSA: these boards have different clocks */
switch(devc->submodel) {
-/* APPARENTLY NOT 1869
+/* APPARENTLY NOT 1869 AND 1887
case SUBMDL_ES1869:
-*/
case SUBMDL_ES1887:
+*/
case SUBMDL_ES1888:
devc->caps |= SB_CAP_ES18XX_RATE;
break;
@@ -1305,6 +1307,13 @@
int ess_dsp_init (sb_devc *devc, struct address_info *hw_config)
{
/*
+ * Caller also checks this, but anyway
+ */
+ if (devc->model != MDL_ESS) {
+ printk (KERN_INFO "ess_dsp_init for non ESS chip\n");
+ return 1;
+ }
+ /*
* This for ES1887 to run Full Duplex. Actually ES1888
* is allowed to do so too. I have no idea yet if this
* will work for ES1888 however.
@@ -1324,15 +1333,12 @@
if (devc->dma8 != devc->dma16 && devc->dma16 != -1) {
devc->duplex = 1;
}
-
- if (!ess_set_dma_hw (devc)) {
- free_irq(devc->irq, devc);
- return 0;
- }
- return 1;
- } else {
- return -1;
}
+ if (!ess_set_dma_hw (devc)) {
+ free_irq(devc->irq, devc);
+ return 0;
+ }
+ return 1;
}

/****************************************************************************

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/