aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-05-31 09:20:31 -0400
committerTakashi Iwai <tiwai@suse.de>2013-06-03 05:34:00 -0400
commit963afde9509c4bef1b06be7117d018a8da26480a (patch)
treef7969d9fd97e932e76899a483f9d7e58a848ee0d /sound
parent5a6f294e87974e6ec68d7113553ffd975d83bf15 (diff)
ALSA: hda/via - Clean up duplicated codes
The previous commit was written in the way to make the backport to 3.9.y easier, and left the duplicated open codes intentionally. Now let's clean up the duplicated codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_generic.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index cfdb917d74fb..4b1524a861f3 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1940,17 +1940,7 @@ static int create_speaker_out_ctls(struct hda_codec *codec)
1940 * independent HP controls 1940 * independent HP controls
1941 */ 1941 */
1942 1942
1943/* update HP auto-mute state too */ 1943static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack);
1944static void update_hp_automute_hook(struct hda_codec *codec)
1945{
1946 struct hda_gen_spec *spec = codec->spec;
1947
1948 if (spec->hp_automute_hook)
1949 spec->hp_automute_hook(codec, NULL);
1950 else
1951 snd_hda_gen_hp_automute(codec, NULL);
1952}
1953
1954static int indep_hp_info(struct snd_kcontrol *kcontrol, 1944static int indep_hp_info(struct snd_kcontrol *kcontrol,
1955 struct snd_ctl_elem_info *uinfo) 1945 struct snd_ctl_elem_info *uinfo)
1956{ 1946{
@@ -2011,7 +2001,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol,
2011 else 2001 else
2012 *dacp = spec->alt_dac_nid; 2002 *dacp = spec->alt_dac_nid;
2013 2003
2014 update_hp_automute_hook(codec); 2004 call_hp_automute(codec, NULL);
2015 ret = 1; 2005 ret = 1;
2016 } 2006 }
2017 unlock: 2007 unlock:
@@ -2307,7 +2297,7 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force)
2307 else 2297 else
2308 val = PIN_HP; 2298 val = PIN_HP;
2309 set_pin_target(codec, pin, val, true); 2299 set_pin_target(codec, pin, val, true);
2310 update_hp_automute_hook(codec); 2300 call_hp_automute(codec, NULL);
2311 } 2301 }
2312} 2302}
2313 2303
@@ -2716,7 +2706,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol,
2716 val = snd_hda_get_default_vref(codec, nid); 2706 val = snd_hda_get_default_vref(codec, nid);
2717 } 2707 }
2718 snd_hda_set_pin_ctl_cache(codec, nid, val); 2708 snd_hda_set_pin_ctl_cache(codec, nid, val);
2719 update_hp_automute_hook(codec); 2709 call_hp_automute(codec, NULL);
2720 2710
2721 return 1; 2711 return 1;
2722} 2712}
@@ -3861,22 +3851,6 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja
3861} 3851}
3862EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch); 3852EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch);
3863 3853
3864/* update jack retasking */
3865static void update_automute_all(struct hda_codec *codec)
3866{
3867 struct hda_gen_spec *spec = codec->spec;
3868
3869 update_hp_automute_hook(codec);
3870 if (spec->line_automute_hook)
3871 spec->line_automute_hook(codec, NULL);
3872 else
3873 snd_hda_gen_line_automute(codec, NULL);
3874 if (spec->mic_autoswitch_hook)
3875 spec->mic_autoswitch_hook(codec, NULL);
3876 else
3877 snd_hda_gen_mic_autoswitch(codec, NULL);
3878}
3879
3880/* call appropriate hooks */ 3854/* call appropriate hooks */
3881static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) 3855static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack)
3882{ 3856{
@@ -3907,6 +3881,14 @@ static void call_mic_autoswitch(struct hda_codec *codec,
3907 snd_hda_gen_mic_autoswitch(codec, jack); 3881 snd_hda_gen_mic_autoswitch(codec, jack);
3908} 3882}
3909 3883
3884/* update jack retasking */
3885static void update_automute_all(struct hda_codec *codec)
3886{
3887 call_hp_automute(codec, NULL);
3888 call_line_automute(codec, NULL);
3889 call_mic_autoswitch(codec, NULL);
3890}
3891
3910/* 3892/*
3911 * Auto-Mute mode mixer enum support 3893 * Auto-Mute mode mixer enum support
3912 */ 3894 */