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

Modified Files:
        ak4524.c 
Log Message:
Fix for DAC/ADC volumes - AK4524&28 were inverted by mistake

Index: ak4524.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ak4524.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ak4524.c    3 Dec 2002 16:58:50 -0000       1.9
+++ ak4524.c    6 Dec 2002 08:30:43 -0000       1.10
@@ -217,9 +217,11 @@
 
 #define AK_GET_CHIP(val)               (((val) >> 8) & 0xff)
 #define AK_GET_ADDR(val)               ((val) & 0xff)
-#define AK_GET_SHIFT(val)              (((val) >> 16) & 0xff)
+#define AK_GET_SHIFT(val)              (((val) >> 16) & 0x7f)
+#define AK_GET_INVERT(val)             (((val) >> 23) & 1)
 #define AK_GET_MASK(val)               (((val) >> 24) & 0xff)
 #define AK_COMPOSE(chip,addr,shift,mask) (((chip) << 8) | (addr) | ((shift) << 16) | 
((mask) << 24))
+#define AK_INVERT                      (1<<23)
 
 static int snd_ice1712_ak4524_volume_info(snd_kcontrol_t *kcontrol, 
snd_ctl_elem_info_t * uinfo)
 {
@@ -237,8 +239,11 @@
        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
        int chip = AK_GET_CHIP(kcontrol->private_value);
        int addr = AK_GET_ADDR(kcontrol->private_value);
+       int invert = AK_GET_INVERT(kcontrol->private_value);
        unsigned int mask = AK_GET_MASK(kcontrol->private_value);
-       ucontrol->value.integer.value[0] = mask - ice->ak4524.images[chip][addr];
+       unsigned char val = ice->ak4524.images[chip][addr];
+       
+       ucontrol->value.integer.value[0] = invert ? mask - val : val;
        return 0;
 }
 
@@ -247,9 +252,14 @@
        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
        int chip = AK_GET_CHIP(kcontrol->private_value);
        int addr = AK_GET_ADDR(kcontrol->private_value);
+       int invert = AK_GET_INVERT(kcontrol->private_value);
        unsigned int mask = AK_GET_MASK(kcontrol->private_value);
-       unsigned char nval = mask - (ucontrol->value.integer.value[0] % (mask+1));
-       int change = ice->ak4524.images[chip][addr] != nval;
+       unsigned char nval = ucontrol->value.integer.value[0] % (mask+1);
+       int change;
+
+       if (invert)
+               nval = mask - nval;
+       change = ice->ak4524.images[chip][addr] != nval;
        if (change)
                snd_ice1712_ak4524_write(ice, chip, addr, nval);
        return change;
@@ -353,7 +363,7 @@
                        break;
                case SND_AK4529: {
                        int val = idx < 6 ? idx + 2 : (idx - 6) + 0xb; /* registers 
2-7 and b,c */
-                       ctl.private_value = AK_COMPOSE(0, val, 0, 255);
+                       ctl.private_value = AK_COMPOSE(0, val, 0, 255) | AK_INVERT;
                        break;
                }
                }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to