aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-03-23 11:06:28 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-31 10:58:56 -0500
commitc960a03beef8e1bdd26b1658d0ce87902f4a08f2 (patch)
tree135245b8b880e61fd38c8467a37cab38a55d059c /sound/pci/hda/patch_sigmatel.c
parentd681518a56d25d21d73a421174d189242adc68c7 (diff)
[ALSA] hda-codec - Fix VREF level of Mic inputs on STAC92xx codecs
Fixed VREF level of Mic inputs on STAC92xx codecs (ALSA bug#1953). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index b56ca4019392..e5fdb64eb02c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -534,6 +534,22 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
534 return 0; 534 return 0;
535} 535}
536 536
537static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
538{
539 unsigned int pincap = snd_hda_param_read(codec, nid,
540 AC_PAR_PIN_CAP);
541 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
542 if (pincap & AC_PINCAP_VREF_100)
543 return AC_PINCTL_VREF_100;
544 if (pincap & AC_PINCAP_VREF_80)
545 return AC_PINCTL_VREF_80;
546 if (pincap & AC_PINCAP_VREF_50)
547 return AC_PINCTL_VREF_50;
548 if (pincap & AC_PINCAP_VREF_GRD)
549 return AC_PINCTL_VREF_GRD;
550 return 0;
551}
552
537static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) 553static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
538 554
539{ 555{
@@ -571,9 +587,12 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
571 587
572 if (val) 588 if (val)
573 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 589 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
574 else 590 else {
575 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_IN_EN); 591 unsigned int pinctl = AC_PINCTL_IN_EN;
576 592 if (io_idx) /* set VREF for mic */
593 pinctl |= stac92xx_get_vref(codec, nid);
594 stac92xx_auto_set_pinctl(codec, nid, pinctl);
595 }
577 return 1; 596 return 1;
578} 597}
579 598
@@ -951,9 +970,13 @@ static int stac92xx_init(struct hda_codec *codec)
951 stac92xx_auto_init_hp_out(codec); 970 stac92xx_auto_init_hp_out(codec);
952 } 971 }
953 for (i = 0; i < AUTO_PIN_LAST; i++) { 972 for (i = 0; i < AUTO_PIN_LAST; i++) {
954 if (cfg->input_pins[i]) 973 hda_nid_t nid = cfg->input_pins[i];
955 stac92xx_auto_set_pinctl(codec, cfg->input_pins[i], 974 if (nid) {
956 AC_PINCTL_IN_EN); 975 unsigned int pinctl = AC_PINCTL_IN_EN;
976 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
977 pinctl |= stac92xx_get_vref(codec, nid);
978 stac92xx_auto_set_pinctl(codec, nid, pinctl);
979 }
957 } 980 }
958 if (cfg->dig_out_pin) 981 if (cfg->dig_out_pin)
959 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, 982 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,