diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-02-26 07:03:58 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-26 07:03:58 -0500 |
commit | 23f0c048ba59ad5c2f3fd85ed98360b631dbf6f8 (patch) | |
tree | 12a8c8ba33112e1e6ab998bc5cc657904a373a30 /sound/pci/hda/patch_realtek.c | |
parent | 5d9b6c07831456b7a7d90eac31c853d60eaf8ab6 (diff) |
ALSA: hda - Clean up the input pin setup in automatic mode
Clean up the input-pin setup in automatic mode in patch_realtek.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d670d33cfa17..b3406302d069 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -761,6 +761,24 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |||
761 | #endif /* CONFIG_SND_DEBUG */ | 761 | #endif /* CONFIG_SND_DEBUG */ |
762 | 762 | ||
763 | /* | 763 | /* |
764 | * set up the input pin config (depending on the given auto-pin type) | ||
765 | */ | ||
766 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | ||
767 | int auto_pin_type) | ||
768 | { | ||
769 | unsigned int val = PIN_IN; | ||
770 | |||
771 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { | ||
772 | unsigned int pincap; | ||
773 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
774 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | ||
775 | if (pincap & AC_PINCAP_VREF_80) | ||
776 | val = PIN_VREF80; | ||
777 | } | ||
778 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | ||
779 | } | ||
780 | |||
781 | /* | ||
764 | */ | 782 | */ |
765 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | 783 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
766 | { | 784 | { |
@@ -4188,10 +4206,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4188 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4206 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4189 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 4207 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
4190 | if (alc880_is_input_pin(nid)) { | 4208 | if (alc880_is_input_pin(nid)) { |
4191 | snd_hda_codec_write(codec, nid, 0, | 4209 | alc_set_input_pin(codec, nid, i); |
4192 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4193 | i <= AUTO_PIN_FRONT_MIC ? | ||
4194 | PIN_VREF80 : PIN_IN); | ||
4195 | if (nid != ALC880_PIN_CD_NID) | 4210 | if (nid != ALC880_PIN_CD_NID) |
4196 | snd_hda_codec_write(codec, nid, 0, | 4211 | snd_hda_codec_write(codec, nid, 0, |
4197 | AC_VERB_SET_AMP_GAIN_MUTE, | 4212 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -5657,10 +5672,7 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) | |||
5657 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 5672 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
5658 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 5673 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
5659 | if (nid >= 0x12) { | 5674 | if (nid >= 0x12) { |
5660 | snd_hda_codec_write(codec, nid, 0, | 5675 | alc_set_input_pin(codec, nid, i); |
5661 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
5662 | i <= AUTO_PIN_FRONT_MIC ? | ||
5663 | PIN_VREF80 : PIN_IN); | ||
5664 | if (nid != ALC260_PIN_CD_NID) | 5676 | if (nid != ALC260_PIN_CD_NID) |
5665 | snd_hda_codec_write(codec, nid, 0, | 5677 | snd_hda_codec_write(codec, nid, 0, |
5666 | AC_VERB_SET_AMP_GAIN_MUTE, | 5678 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -7006,16 +7018,7 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
7006 | unsigned int vref; | 7018 | unsigned int vref; |
7007 | if (!nid) | 7019 | if (!nid) |
7008 | continue; | 7020 | continue; |
7009 | vref = PIN_IN; | 7021 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
7010 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { | ||
7011 | unsigned int pincap; | ||
7012 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
7013 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & | ||
7014 | AC_PINCAP_VREF_80) | ||
7015 | vref = PIN_VREF80; | ||
7016 | } | ||
7017 | snd_hda_codec_write(codec, nid, 0, | ||
7018 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | ||
7019 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | 7022 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
7020 | snd_hda_codec_write(codec, nid, 0, | 7023 | snd_hda_codec_write(codec, nid, 0, |
7021 | AC_VERB_SET_AMP_GAIN_MUTE, | 7024 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -9100,10 +9103,7 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec) | |||
9100 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 9103 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
9101 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 9104 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
9102 | if (alc883_is_input_pin(nid)) { | 9105 | if (alc883_is_input_pin(nid)) { |
9103 | snd_hda_codec_write(codec, nid, 0, | 9106 | alc_set_input_pin(codec, nid, i); |
9104 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
9105 | (i <= AUTO_PIN_FRONT_MIC ? | ||
9106 | PIN_VREF80 : PIN_IN)); | ||
9107 | if (nid != ALC883_PIN_CD_NID) | 9107 | if (nid != ALC883_PIN_CD_NID) |
9108 | snd_hda_codec_write(codec, nid, 0, | 9108 | snd_hda_codec_write(codec, nid, 0, |
9109 | AC_VERB_SET_AMP_GAIN_MUTE, | 9109 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -13831,12 +13831,8 @@ static void alc861_auto_init_analog_input(struct hda_codec *codec) | |||
13831 | 13831 | ||
13832 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 13832 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
13833 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 13833 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
13834 | if (nid >= 0x0c && nid <= 0x11) { | 13834 | if (nid >= 0x0c && nid <= 0x11) |
13835 | snd_hda_codec_write(codec, nid, 0, | 13835 | alc_set_input_pin(codec, nid, i); |
13836 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
13837 | i <= AUTO_PIN_FRONT_MIC ? | ||
13838 | PIN_VREF80 : PIN_IN); | ||
13839 | } | ||
13840 | } | 13836 | } |
13841 | } | 13837 | } |
13842 | 13838 | ||
@@ -14803,10 +14799,7 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |||
14803 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 14799 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
14804 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 14800 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
14805 | if (alc861vd_is_input_pin(nid)) { | 14801 | if (alc861vd_is_input_pin(nid)) { |
14806 | snd_hda_codec_write(codec, nid, 0, | 14802 | alc_set_input_pin(codec, nid, i); |
14807 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
14808 | i <= AUTO_PIN_FRONT_MIC ? | ||
14809 | PIN_VREF80 : PIN_IN); | ||
14810 | if (nid != ALC861VD_PIN_CD_NID) | 14803 | if (nid != ALC861VD_PIN_CD_NID) |
14811 | snd_hda_codec_write(codec, nid, 0, | 14804 | snd_hda_codec_write(codec, nid, 0, |
14812 | AC_VERB_SET_AMP_GAIN_MUTE, | 14805 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -16732,10 +16725,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) | |||
16732 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 16725 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
16733 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 16726 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
16734 | if (alc662_is_input_pin(nid)) { | 16727 | if (alc662_is_input_pin(nid)) { |
16735 | snd_hda_codec_write(codec, nid, 0, | 16728 | alc_set_input_pin(codec, nid, i); |
16736 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
16737 | (i <= AUTO_PIN_FRONT_MIC ? | ||
16738 | PIN_VREF80 : PIN_IN)); | ||
16739 | if (nid != ALC662_PIN_CD_NID) | 16729 | if (nid != ALC662_PIN_CD_NID) |
16740 | snd_hda_codec_write(codec, nid, 0, | 16730 | snd_hda_codec_write(codec, nid, 0, |
16741 | AC_VERB_SET_AMP_GAIN_MUTE, | 16731 | AC_VERB_SET_AMP_GAIN_MUTE, |