diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-09-20 06:04:56 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-09-20 12:22:33 -0400 |
commit | 42cf0d0155539ef1933e63453e5169a4f631d7e7 (patch) | |
tree | c3b4777ee9ea3d24012273962b59a6920f2ed00a /sound/pci/hda/alc262_quirks.c | |
parent | 290b421f699463478d215c17cd6be52d78e16976 (diff) |
ALSA: HDA: Refactor Realtek's automute
Increase readability and understandability in the automute code.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/alc262_quirks.c')
-rw-r--r-- | sound/pci/hda/alc262_quirks.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index c37e0c2939b6..7894b2b5aacf 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c | |||
@@ -61,10 +61,6 @@ static const struct snd_kcontrol_new alc262_base_mixer[] = { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* bind hp and internal speaker mute (with plug check) as master switch */ | 63 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
64 | static void alc262_hippo_master_update(struct hda_codec *codec) | ||
65 | { | ||
66 | update_speakers(codec); | ||
67 | } | ||
68 | 64 | ||
69 | static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol, | 65 | static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol, |
70 | struct snd_ctl_elem_value *ucontrol) | 66 | struct snd_ctl_elem_value *ucontrol) |
@@ -85,7 +81,7 @@ static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |||
85 | if (val == spec->master_mute) | 81 | if (val == spec->master_mute) |
86 | return 0; | 82 | return 0; |
87 | spec->master_mute = val; | 83 | spec->master_mute = val; |
88 | alc262_hippo_master_update(codec); | 84 | update_outputs(codec); |
89 | return 1; | 85 | return 1; |
90 | } | 86 | } |
91 | 87 | ||
@@ -147,8 +143,7 @@ static void alc262_hippo_setup(struct hda_codec *codec) | |||
147 | 143 | ||
148 | spec->autocfg.hp_pins[0] = 0x15; | 144 | spec->autocfg.hp_pins[0] = 0x15; |
149 | spec->autocfg.speaker_pins[0] = 0x14; | 145 | spec->autocfg.speaker_pins[0] = 0x14; |
150 | spec->automute = 1; | 146 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
151 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
152 | } | 147 | } |
153 | 148 | ||
154 | static void alc262_hippo1_setup(struct hda_codec *codec) | 149 | static void alc262_hippo1_setup(struct hda_codec *codec) |
@@ -157,8 +152,7 @@ static void alc262_hippo1_setup(struct hda_codec *codec) | |||
157 | 152 | ||
158 | spec->autocfg.hp_pins[0] = 0x1b; | 153 | spec->autocfg.hp_pins[0] = 0x1b; |
159 | spec->autocfg.speaker_pins[0] = 0x14; | 154 | spec->autocfg.speaker_pins[0] = 0x14; |
160 | spec->automute = 1; | 155 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
161 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
162 | } | 156 | } |
163 | 157 | ||
164 | 158 | ||
@@ -221,8 +215,7 @@ static void alc262_tyan_setup(struct hda_codec *codec) | |||
221 | 215 | ||
222 | spec->autocfg.hp_pins[0] = 0x1b; | 216 | spec->autocfg.hp_pins[0] = 0x1b; |
223 | spec->autocfg.speaker_pins[0] = 0x15; | 217 | spec->autocfg.speaker_pins[0] = 0x15; |
224 | spec->automute = 1; | 218 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
225 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
226 | } | 219 | } |
227 | 220 | ||
228 | 221 | ||
@@ -364,8 +357,7 @@ static void alc262_toshiba_s06_setup(struct hda_codec *codec) | |||
364 | spec->ext_mic_pin = 0x18; | 357 | spec->ext_mic_pin = 0x18; |
365 | spec->int_mic_pin = 0x12; | 358 | spec->int_mic_pin = 0x12; |
366 | spec->auto_mic = 1; | 359 | spec->auto_mic = 1; |
367 | spec->automute = 1; | 360 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_PIN); |
368 | spec->automute_mode = ALC_AUTOMUTE_PIN; | ||
369 | } | 361 | } |
370 | 362 | ||
371 | /* | 363 | /* |
@@ -446,8 +438,7 @@ static void alc262_fujitsu_setup(struct hda_codec *codec) | |||
446 | spec->autocfg.hp_pins[0] = 0x14; | 438 | spec->autocfg.hp_pins[0] = 0x14; |
447 | spec->autocfg.hp_pins[1] = 0x1b; | 439 | spec->autocfg.hp_pins[1] = 0x1b; |
448 | spec->autocfg.speaker_pins[0] = 0x15; | 440 | spec->autocfg.speaker_pins[0] = 0x15; |
449 | spec->automute = 1; | 441 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
450 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
451 | } | 442 | } |
452 | 443 | ||
453 | /* bind volumes of both NID 0x0c and 0x0d */ | 444 | /* bind volumes of both NID 0x0c and 0x0d */ |
@@ -493,8 +484,7 @@ static void alc262_lenovo_3000_setup(struct hda_codec *codec) | |||
493 | spec->autocfg.hp_pins[0] = 0x1b; | 484 | spec->autocfg.hp_pins[0] = 0x1b; |
494 | spec->autocfg.speaker_pins[0] = 0x14; | 485 | spec->autocfg.speaker_pins[0] = 0x14; |
495 | spec->autocfg.speaker_pins[1] = 0x16; | 486 | spec->autocfg.speaker_pins[1] = 0x16; |
496 | spec->automute = 1; | 487 | alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); |
497 | spec->automute_mode = ALC_AUTOMUTE_AMP; | ||
498 | } | 488 | } |
499 | 489 | ||
500 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | 490 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
@@ -599,8 +589,8 @@ static void alc262_ultra_automute(struct hda_codec *codec) | |||
599 | mute = 0; | 589 | mute = 0; |
600 | /* auto-mute only when HP is used as HP */ | 590 | /* auto-mute only when HP is used as HP */ |
601 | if (!spec->cur_mux[0]) { | 591 | if (!spec->cur_mux[0]) { |
602 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | 592 | spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15); |
603 | if (spec->jack_present) | 593 | if (spec->hp_jack_present) |
604 | mute = HDA_AMP_MUTE; | 594 | mute = HDA_AMP_MUTE; |
605 | } | 595 | } |
606 | /* mute/unmute internal speaker */ | 596 | /* mute/unmute internal speaker */ |