diff options
author | Herton Ronaldo Krzesinski <herton@mandriva.com> | 2008-03-22 05:26:05 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:30 -0400 |
commit | 0c4cc4430f40089bb85557e309038faa458247f1 (patch) | |
tree | 38ff8909de3a647c09b61de715dd0225357ba0be /sound | |
parent | 213f0bfe9061e077590f2775cb90c1e6c0c9faa6 (diff) |
[ALSA] hda-codec - Support mic automute for Clevo M720R/SR
Add support for mic automute in clevo-m720r ALC883 model, and rename it
to more generic clevo-m720. Also change model entry in ALSA-Configuration.txt
accordingly.
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e137882d9459..e5d97c12381d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -201,7 +201,7 @@ enum { | |||
201 | ALC888_3ST_HP, | 201 | ALC888_3ST_HP, |
202 | ALC888_6ST_DELL, | 202 | ALC888_6ST_DELL, |
203 | ALC883_MITAC, | 203 | ALC883_MITAC, |
204 | ALC883_CLEVO_M720R, | 204 | ALC883_CLEVO_M720, |
205 | ALC883_FUJITSU_PI2515, | 205 | ALC883_FUJITSU_PI2515, |
206 | ALC883_AUTO, | 206 | ALC883_AUTO, |
207 | ALC883_MODEL_LAST, | 207 | ALC883_MODEL_LAST, |
@@ -6661,7 +6661,7 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = { | |||
6661 | { } /* end */ | 6661 | { } /* end */ |
6662 | }; | 6662 | }; |
6663 | 6663 | ||
6664 | static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = { | 6664 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
6665 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 6665 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
6666 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | 6666 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
6667 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 6667 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
@@ -7130,7 +7130,7 @@ static struct hda_verb alc883_mitac_verbs[] = { | |||
7130 | { } /* end */ | 7130 | { } /* end */ |
7131 | }; | 7131 | }; |
7132 | 7132 | ||
7133 | static struct hda_verb alc883_clevo_m720r_verbs[] = { | 7133 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
7134 | /* HP */ | 7134 | /* HP */ |
7135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 7136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
@@ -7140,6 +7140,7 @@ static struct hda_verb alc883_clevo_m720r_verbs[] = { | |||
7140 | 7140 | ||
7141 | /* enable unsolicited event */ | 7141 | /* enable unsolicited event */ |
7142 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 7142 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
7143 | 7144 | ||
7144 | { } /* end */ | 7145 | { } /* end */ |
7145 | }; | 7146 | }; |
@@ -7330,7 +7331,7 @@ static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |||
7330 | } | 7331 | } |
7331 | 7332 | ||
7332 | /* toggle speaker-output according to the hp-jack state */ | 7333 | /* toggle speaker-output according to the hp-jack state */ |
7333 | static void alc883_clevo_m720r_automute(struct hda_codec *codec) | 7334 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
7334 | { | 7335 | { |
7335 | unsigned int present; | 7336 | unsigned int present; |
7336 | unsigned char bits; | 7337 | unsigned char bits; |
@@ -7342,11 +7343,33 @@ static void alc883_clevo_m720r_automute(struct hda_codec *codec) | |||
7342 | HDA_AMP_MUTE, bits); | 7343 | HDA_AMP_MUTE, bits); |
7343 | } | 7344 | } |
7344 | 7345 | ||
7345 | static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec, | 7346 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
7347 | { | ||
7348 | unsigned int present; | ||
7349 | |||
7350 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
7351 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7352 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | ||
7353 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7354 | } | ||
7355 | |||
7356 | static void alc883_clevo_m720_automute(struct hda_codec *codec) | ||
7357 | { | ||
7358 | alc883_clevo_m720_hp_automute(codec); | ||
7359 | alc883_clevo_m720_mic_automute(codec); | ||
7360 | } | ||
7361 | |||
7362 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | ||
7346 | unsigned int res) | 7363 | unsigned int res) |
7347 | { | 7364 | { |
7348 | if ((res >> 26) == ALC880_HP_EVENT) | 7365 | switch (res >> 26) { |
7349 | alc883_clevo_m720r_automute(codec); | 7366 | case ALC880_HP_EVENT: |
7367 | alc883_clevo_m720_hp_automute(codec); | ||
7368 | break; | ||
7369 | case ALC880_MIC_EVENT: | ||
7370 | alc883_clevo_m720_mic_automute(codec); | ||
7371 | break; | ||
7372 | } | ||
7350 | } | 7373 | } |
7351 | 7374 | ||
7352 | /* toggle speaker-output according to the hp-jack state */ | 7375 | /* toggle speaker-output according to the hp-jack state */ |
@@ -7605,7 +7628,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
7605 | [ALC888_3ST_HP] = "3stack-hp", | 7628 | [ALC888_3ST_HP] = "3stack-hp", |
7606 | [ALC888_6ST_DELL] = "6stack-dell", | 7629 | [ALC888_6ST_DELL] = "6stack-dell", |
7607 | [ALC883_MITAC] = "mitac", | 7630 | [ALC883_MITAC] = "mitac", |
7608 | [ALC883_CLEVO_M720R] = "clevo-m720r", | 7631 | [ALC883_CLEVO_M720] = "clevo-m720", |
7609 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | 7632 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
7610 | [ALC883_AUTO] = "auto", | 7633 | [ALC883_AUTO] = "auto", |
7611 | }; | 7634 | }; |
@@ -7649,8 +7672,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7649 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | 7672 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
7650 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 7673 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
7651 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 7674 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
7652 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R), | 7675 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
7653 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720R), | 7676 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
7654 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | 7677 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
7655 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 7678 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
7656 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 7679 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
@@ -7794,17 +7817,17 @@ static struct alc_config_preset alc883_presets[] = { | |||
7794 | .channel_mode = alc883_3ST_2ch_modes, | 7817 | .channel_mode = alc883_3ST_2ch_modes, |
7795 | .input_mux = &alc883_capture_source, | 7818 | .input_mux = &alc883_capture_source, |
7796 | }, | 7819 | }, |
7797 | [ALC883_CLEVO_M720R] = { | 7820 | [ALC883_CLEVO_M720] = { |
7798 | .mixers = { alc883_clevo_m720r_mixer }, | 7821 | .mixers = { alc883_clevo_m720_mixer }, |
7799 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs }, | 7822 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
7800 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7823 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7801 | .dac_nids = alc883_dac_nids, | 7824 | .dac_nids = alc883_dac_nids, |
7802 | .dig_out_nid = ALC883_DIGOUT_NID, | 7825 | .dig_out_nid = ALC883_DIGOUT_NID, |
7803 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7826 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7804 | .channel_mode = alc883_3ST_2ch_modes, | 7827 | .channel_mode = alc883_3ST_2ch_modes, |
7805 | .input_mux = &alc883_capture_source, | 7828 | .input_mux = &alc883_capture_source, |
7806 | .unsol_event = alc883_clevo_m720r_unsol_event, | 7829 | .unsol_event = alc883_clevo_m720_unsol_event, |
7807 | .init_hook = alc883_clevo_m720r_automute, | 7830 | .init_hook = alc883_clevo_m720_automute, |
7808 | }, | 7831 | }, |
7809 | [ALC883_LENOVO_101E_2ch] = { | 7832 | [ALC883_LENOVO_101E_2ch] = { |
7810 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | 7833 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |