aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorAnisse Astier <anisse@astier.eu>2010-12-16 06:19:47 -0500
committerTakashi Iwai <tiwai@suse.de>2010-12-16 11:19:42 -0500
commiteeb433876cf59438a1e1600a957ff6cc99c860eb (patch)
tree21ad7be5cc2b8d8d19b0cf6fa4c567c115f152c6 /sound/pci
parentfbb5bb563925db138a8bbfa6a0ea0e089fbd2405 (diff)
ALSA: hda - factorize an automute_mic realtek quirk function
Multiple quirk functions were using the exact same code to verify if the Mic jack was plugged and mute the Mic accordingly Signed-off-by: Anisse Astier <anisse@astier.eu> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index cd2d3a5efa50..fc435b59a52f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3352,7 +3352,7 @@ static struct hda_verb alc880_beep_init_verbs[] = {
3352}; 3352};
3353 3353
3354/* auto-toggle front mic */ 3354/* auto-toggle front mic */
3355static void alc880_uniwill_mic_automute(struct hda_codec *codec) 3355static void alc88x_simple_mic_automute(struct hda_codec *codec)
3356{ 3356{
3357 unsigned int present; 3357 unsigned int present;
3358 unsigned char bits; 3358 unsigned char bits;
@@ -3374,7 +3374,7 @@ static void alc880_uniwill_setup(struct hda_codec *codec)
3374static void alc880_uniwill_init_hook(struct hda_codec *codec) 3374static void alc880_uniwill_init_hook(struct hda_codec *codec)
3375{ 3375{
3376 alc_automute_amp(codec); 3376 alc_automute_amp(codec);
3377 alc880_uniwill_mic_automute(codec); 3377 alc88x_simple_mic_automute(codec);
3378} 3378}
3379 3379
3380static void alc880_uniwill_unsol_event(struct hda_codec *codec, 3380static void alc880_uniwill_unsol_event(struct hda_codec *codec,
@@ -3385,7 +3385,7 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3385 */ 3385 */
3386 switch (res >> 28) { 3386 switch (res >> 28) {
3387 case ALC880_MIC_EVENT: 3387 case ALC880_MIC_EVENT:
3388 alc880_uniwill_mic_automute(codec); 3388 alc88x_simple_mic_automute(codec);
3389 break; 3389 break;
3390 default: 3390 default:
3391 alc_automute_amp_unsol_event(codec, res); 3391 alc_automute_amp_unsol_event(codec, res);
@@ -9480,15 +9480,6 @@ static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9480#define alc883_targa_init_hook alc882_targa_init_hook 9480#define alc883_targa_init_hook alc882_targa_init_hook
9481#define alc883_targa_unsol_event alc882_targa_unsol_event 9481#define alc883_targa_unsol_event alc882_targa_unsol_event
9482 9482
9483static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9484{
9485 unsigned int present;
9486
9487 present = snd_hda_jack_detect(codec, 0x18);
9488 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9489 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9490}
9491
9492static void alc883_clevo_m720_setup(struct hda_codec *codec) 9483static void alc883_clevo_m720_setup(struct hda_codec *codec)
9493{ 9484{
9494 struct alc_spec *spec = codec->spec; 9485 struct alc_spec *spec = codec->spec;
@@ -9500,7 +9491,7 @@ static void alc883_clevo_m720_setup(struct hda_codec *codec)
9500static void alc883_clevo_m720_init_hook(struct hda_codec *codec) 9491static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9501{ 9492{
9502 alc_automute_amp(codec); 9493 alc_automute_amp(codec);
9503 alc883_clevo_m720_mic_automute(codec); 9494 alc88x_simple_mic_automute(codec);
9504} 9495}
9505 9496
9506static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, 9497static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
@@ -9508,7 +9499,7 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9508{ 9499{
9509 switch (res >> 26) { 9500 switch (res >> 26) {
9510 case ALC880_MIC_EVENT: 9501 case ALC880_MIC_EVENT:
9511 alc883_clevo_m720_mic_automute(codec); 9502 alc88x_simple_mic_automute(codec);
9512 break; 9503 break;
9513 default: 9504 default:
9514 alc_automute_amp_unsol_event(codec, res); 9505 alc_automute_amp_unsol_event(codec, res);
@@ -16697,18 +16688,6 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16697 {} 16688 {}
16698}; 16689};
16699 16690
16700static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16701{
16702 unsigned int present;
16703 unsigned char bits;
16704
16705 present = snd_hda_jack_detect(codec, 0x18);
16706 bits = present ? HDA_AMP_MUTE : 0;
16707
16708 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16709 HDA_AMP_MUTE, bits);
16710}
16711
16712static void alc861vd_lenovo_setup(struct hda_codec *codec) 16691static void alc861vd_lenovo_setup(struct hda_codec *codec)
16713{ 16692{
16714 struct alc_spec *spec = codec->spec; 16693 struct alc_spec *spec = codec->spec;
@@ -16719,7 +16698,7 @@ static void alc861vd_lenovo_setup(struct hda_codec *codec)
16719static void alc861vd_lenovo_init_hook(struct hda_codec *codec) 16698static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16720{ 16699{
16721 alc_automute_amp(codec); 16700 alc_automute_amp(codec);
16722 alc861vd_lenovo_mic_automute(codec); 16701 alc88x_simple_mic_automute(codec);
16723} 16702}
16724 16703
16725static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, 16704static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
@@ -16727,7 +16706,7 @@ static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16727{ 16706{
16728 switch (res >> 26) { 16707 switch (res >> 26) {
16729 case ALC880_MIC_EVENT: 16708 case ALC880_MIC_EVENT:
16730 alc861vd_lenovo_mic_automute(codec); 16709 alc88x_simple_mic_automute(codec);
16731 break; 16710 break;
16732 default: 16711 default:
16733 alc_automute_amp_unsol_event(codec, res); 16712 alc_automute_amp_unsol_event(codec, res);