aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-10-16 08:25:16 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:51:20 -0400
commit9066f2443122c1501da64b6faa0038c13f0209f9 (patch)
tree01c137ab8dd367180d4f62d1dca10add8ce515f3
parentc1017a4cdb68ae5368fbc9ee42c77f1f5dca8916 (diff)
[ALSA] hda-codec - Fix STAC922x volume knob control
Reported by zhejiang <zhe.jiang@intel.com> '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 <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--sound/pci/hda/patch_sigmatel.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 8b3576007d4a..626a5edde06c 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,
352static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol, 352static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol,
353 struct snd_ctl_elem_value *ucontrol) 353 struct snd_ctl_elem_value *ucontrol)
354{ 354{
355 ucontrol->value.integer.value[0] = kcontrol->private_value; 355 ucontrol->value.integer.value[0] = kcontrol->private_value & 0xff;
356 return 0; 356 return 0;
357} 357}
358 358
@@ -360,15 +360,17 @@ static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol,
360 struct snd_ctl_elem_value *ucontrol) 360 struct snd_ctl_elem_value *ucontrol)
361{ 361{
362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
363 unsigned int val = kcontrol->private_value & 0xff;
363 364
364 if (kcontrol->private_value == ucontrol->value.integer.value[0]) 365 if (val == ucontrol->value.integer.value[0])
365 return 0; 366 return 0;
366 367
367 kcontrol->private_value = ucontrol->value.integer.value[0]; 368 val = ucontrol->value.integer.value[0];
369 kcontrol->private_value &= ~0xff;
370 kcontrol->private_value |= val;
368 371
369 snd_hda_codec_write_cache(codec, 0x24, 0, 372 snd_hda_codec_write_cache(codec, kcontrol->private_value >> 16, 0,
370 AC_VERB_SET_VOLUME_KNOB_CONTROL, 373 AC_VERB_SET_VOLUME_KNOB_CONTROL, val | 0x80);
371 kcontrol->private_value | 0x80);
372 return 1; 374 return 1;
373} 375}
374 376
@@ -441,7 +443,7 @@ static struct hda_verb stac9205_core_init[] = {
441 .private_value = verb_read | (verb_write << 16), \ 443 .private_value = verb_read | (verb_write << 16), \
442 } 444 }
443 445
444#define STAC_VOLKNOB \ 446#define STAC_VOLKNOB(knob_nid) \
445 { \ 447 { \
446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
447 .name = "Master Playback Volume", \ 449 .name = "Master Playback Volume", \
@@ -449,7 +451,7 @@ static struct hda_verb stac9205_core_init[] = {
449 .info = stac92xx_volknob_info, \ 451 .info = stac92xx_volknob_info, \
450 .get = stac92xx_volknob_get, \ 452 .get = stac92xx_volknob_get, \
451 .put = stac92xx_volknob_put, \ 453 .put = stac92xx_volknob_put, \
452 .private_value = 127, \ 454 .private_value = 127 | (knob_nid << 16), \
453 } 455 }
454 456
455 457
@@ -482,7 +484,7 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
482 }, 484 },
483 STAC_INPUT_SOURCE(2), 485 STAC_INPUT_SOURCE(2),
484 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), 486 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
485 STAC_VOLKNOB, 487 STAC_VOLKNOB(0x24),
486 488
487 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), 489 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
488 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), 490 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -498,7 +500,7 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
498/* This needs to be generated dynamically based on sequence */ 500/* This needs to be generated dynamically based on sequence */
499static struct snd_kcontrol_new stac922x_mixer[] = { 501static struct snd_kcontrol_new stac922x_mixer[] = {
500 STAC_INPUT_SOURCE(2), 502 STAC_INPUT_SOURCE(2),
501 STAC_VOLKNOB, 503 STAC_VOLKNOB(0x16),
502 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), 504 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
503 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), 505 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
504 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), 506 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
@@ -512,7 +514,7 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
512 514
513static struct snd_kcontrol_new stac927x_mixer[] = { 515static struct snd_kcontrol_new stac927x_mixer[] = {
514 STAC_INPUT_SOURCE(3), 516 STAC_INPUT_SOURCE(3),
515 STAC_VOLKNOB, 517 STAC_VOLKNOB(0x24),
516 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 518 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
517 519
518 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), 520 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),