Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9066f2443122c1501da64b6faa0038c13f0209f9
Commit:     9066f2443122c1501da64b6faa0038c13f0209f9
Parent:     c1017a4cdb68ae5368fbc9ee42c77f1f5dca8916
Author:     Takashi Iwai <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 14:25:16 2007 +0200
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 16:51:20 2007 +0200

    [ALSA] hda-codec - Fix STAC922x volume knob control
    
    Reported by zhejiang <[EMAIL PROTECTED]>
    'I found that STAC_VOLKNOB hardwired the KNOB nid to 0x24.
    It is okay for stac9205 and stac927x.
    But the VolumeKnob nid of stac9220-9221 is 0x16.'
    
    Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/pci/hda/patch_sigmatel.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 8b35760..626a5ed 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -352,7 +352,7 @@ static int stac92xx_volknob_info(struct snd_kcontrol 
*kcontrol,
 static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       ucontrol->value.integer.value[0] = kcontrol->private_value;
+       ucontrol->value.integer.value[0] = kcontrol->private_value & 0xff;
        return 0;
 }
 
@@ -360,15 +360,17 @@ static int stac92xx_volknob_put(struct snd_kcontrol 
*kcontrol,
                struct snd_ctl_elem_value *ucontrol)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+       unsigned int val = kcontrol->private_value & 0xff;
 
-       if (kcontrol->private_value == ucontrol->value.integer.value[0])
+       if (val == ucontrol->value.integer.value[0])
                return 0;
 
-       kcontrol->private_value = ucontrol->value.integer.value[0];
+       val = ucontrol->value.integer.value[0];
+       kcontrol->private_value &= ~0xff;
+       kcontrol->private_value |= val;
 
-       snd_hda_codec_write_cache(codec, 0x24, 0,
-               AC_VERB_SET_VOLUME_KNOB_CONTROL,
-                       kcontrol->private_value | 0x80);
+       snd_hda_codec_write_cache(codec, kcontrol->private_value >> 16, 0,
+               AC_VERB_SET_VOLUME_KNOB_CONTROL, val | 0x80);
        return 1;
 }
 
@@ -441,7 +443,7 @@ static struct hda_verb stac9205_core_init[] = {
                .private_value = verb_read | (verb_write << 16), \
        }
 
-#define STAC_VOLKNOB \
+#define STAC_VOLKNOB(knob_nid) \
        { \
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
                .name  = "Master Playback Volume", \
@@ -449,7 +451,7 @@ static struct hda_verb stac9205_core_init[] = {
                .info  = stac92xx_volknob_info, \
                .get   = stac92xx_volknob_get, \
                .put   = stac92xx_volknob_put, \
-               .private_value = 127, \
+                       .private_value = 127 | (knob_nid << 16), \
        }
 
 
@@ -482,7 +484,7 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
        },
        STAC_INPUT_SOURCE(2),
        STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
-       STAC_VOLKNOB,
+       STAC_VOLKNOB(0x24),
 
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -498,7 +500,7 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
 /* This needs to be generated dynamically based on sequence */
 static struct snd_kcontrol_new stac922x_mixer[] = {
        STAC_INPUT_SOURCE(2),
-       STAC_VOLKNOB,
+       STAC_VOLKNOB(0x16),
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
        HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
@@ -512,7 +514,7 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
 
 static struct snd_kcontrol_new stac927x_mixer[] = {
        STAC_INPUT_SOURCE(3),
-       STAC_VOLKNOB,
+       STAC_VOLKNOB(0x24),
        STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
 
        HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to