Update of /cvsroot/alsa/alsa-kernel/pci
In directory sc8-pr-cvs1:/tmp/cvs-serv4982/pci

Modified Files:
        intel8x0.c 
Log Message:
- fixed the wrong sized allocation of snd_ac97_pcm.
- fixed the probing of multiple codecs on intel8x0.
- fixed the computation of rates bits.



Index: intel8x0.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/intel8x0.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- intel8x0.c  18 Nov 2003 11:38:40 -0000      1.97
+++ intel8x0.c  20 Nov 2003 15:59:32 -0000      1.98
@@ -892,8 +892,10 @@
        err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
        if (err < 0)
                return err;
-       if (ichdev->pcm_open_flag)
+       if (ichdev->pcm_open_flag) {
                snd_ac97_pcm_close(ichdev->pcm);
+               ichdev->pcm_open_flag = 0;
+       }
        err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params),
                                params_channels(hw_params),
                                ichdev->pcm->r[0].slots);
@@ -906,8 +908,10 @@
 {
        ichdev_t *ichdev = get_ichdev(substream);
 
-       if (ichdev->pcm_open_flag)
+       if (ichdev->pcm_open_flag) {
                snd_ac97_pcm_close(ichdev->pcm);
+               ichdev->pcm_open_flag = 0;
+       }
        return snd_pcm_lib_free_pages(substream);
 }
 
@@ -1765,14 +1769,16 @@
                goto __err;
        chip->ac97_bus = pbus;
        ac97.pci = chip->pci;
-       if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
-             __err:
-               /* clear the cold-reset bit for the next chance */
-               if (chip->device_type != DEVICE_ALI)
-                       iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, 
ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
-               return err;
+       for (i = 0; i < codecs; i++) {
+               ac97.num = i;
+               if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
+                       snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i);
+                       if (i == 0)
+                               goto __err;
+                       continue;
+               }
+               chip->ac97[i] = x97;
        }
-       chip->ac97[0] = x97;
        /* tune up the primary codec */
        snd_ac97_tune_hardware(chip->ac97[0], ac97_quirks);
        /* enable separate SDINs for ICH4 */
@@ -1784,7 +1790,7 @@
                i -= 2;         /* do not allocate PCM2IN and MIC2 */
        if (spdif_idx < 0)
                i--;            /* do not allocate S/PDIF */
-       err = snd_ac97_pcm_assign(pbus, ARRAY_SIZE(ac97_pcm_defs), ac97_pcm_defs);
+       err = snd_ac97_pcm_assign(pbus, i, ac97_pcm_defs);
        if (err < 0)
                goto __err;
        chip->ichd[ICHD_PCMOUT].pcm = &pbus->pcms[0];
@@ -1826,6 +1832,12 @@
        }
        chip->in_ac97_init = 0;
        return 0;
+
+ __err:
+       /* clear the cold-reset bit for the next chance */
+       if (chip->device_type != DEVICE_ALI)
+               iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & 
~ICH_AC97COLD);
+       return err;
 }
 
 



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to