Update of /cvsroot/alsa/alsa-kernel/pci/ac97
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28237/pci/ac97

Modified Files:
        ac97_pcm.c 
Log Message:
- fixed the handling of S/PDIF rates.
  the IEC958 status bits are updated according to the current rate.


Index: ac97_pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ac97_pcm.c  4 Dec 2003 17:04:24 -0000       1.10
+++ ac97_pcm.c  24 Feb 2004 12:05:43 -0000      1.11
@@ -31,6 +31,7 @@
 #include <sound/pcm.h>
 #include <sound/control.h>
 #include <sound/ac97_codec.h>
+#include <sound/asoundef.h>
 #include "ac97_patch.h"
 #include "ac97_id.h"
 #include "ac97_local.h"
@@ -176,6 +177,7 @@
 static int set_spdif_rate(ac97_t *ac97, unsigned short rate)
 {
        unsigned short old, bits, reg, mask;
+       unsigned int sbits;
 
        if (! (ac97->ext_id & AC97_EI_SPDIF))
                return -ENODEV;
@@ -213,6 +215,26 @@
        if (old != bits) {
                snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0);
                snd_ac97_update_bits(ac97, reg, mask, bits);
+               /* update the internal spdif bits */
+               spin_lock(&ac97->reg_lock);
+               sbits = ac97->spdif_status;
+               if (sbits & IEC958_AES0_PROFESSIONAL) {
+                       sbits &= ~IEC958_AES0_PRO_FS;
+                       switch (rate) {
+                       case 44100: sbits |= IEC958_AES0_PRO_FS_44100; break;
+                       case 48000: sbits |= IEC958_AES0_PRO_FS_48000; break;
+                       case 32000: sbits |= IEC958_AES0_PRO_FS_32000; break;
+                       }
+               } else {
+                       sbits &= ~(IEC958_AES3_CON_FS << 24);
+                       switch (rate) {
+                       case 44100: sbits |= IEC958_AES3_CON_FS_44100<<24; break;
+                       case 48000: sbits |= IEC958_AES3_CON_FS_48000<<24; break;
+                       case 32000: sbits |= IEC958_AES3_CON_FS_32000<<24; break;
+                       }
+               }
+               ac97->spdif_status = sbits;
+               spin_unlock(&ac97->reg_lock);
        }
        snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF);
        return 0;



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to