提交 963afde9 编写于 作者: T Takashi Iwai

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: NTakashi Iwai <tiwai@suse.de>
上级 5a6f294e
...@@ -1940,17 +1940,7 @@ static int create_speaker_out_ctls(struct hda_codec *codec) ...@@ -1940,17 +1940,7 @@ static int create_speaker_out_ctls(struct hda_codec *codec)
* independent HP controls * independent HP controls
*/ */
/* update HP auto-mute state too */ static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack);
static void update_hp_automute_hook(struct hda_codec *codec)
{
struct hda_gen_spec *spec = codec->spec;
if (spec->hp_automute_hook)
spec->hp_automute_hook(codec, NULL);
else
snd_hda_gen_hp_automute(codec, NULL);
}
static int indep_hp_info(struct snd_kcontrol *kcontrol, static int indep_hp_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
...@@ -2011,7 +2001,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol, ...@@ -2011,7 +2001,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol,
else else
*dacp = spec->alt_dac_nid; *dacp = spec->alt_dac_nid;
update_hp_automute_hook(codec); call_hp_automute(codec, NULL);
ret = 1; ret = 1;
} }
unlock: unlock:
...@@ -2307,7 +2297,7 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force) ...@@ -2307,7 +2297,7 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force)
else else
val = PIN_HP; val = PIN_HP;
set_pin_target(codec, pin, val, true); set_pin_target(codec, pin, val, true);
update_hp_automute_hook(codec); call_hp_automute(codec, NULL);
} }
} }
...@@ -2716,7 +2706,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol, ...@@ -2716,7 +2706,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol,
val = snd_hda_get_default_vref(codec, nid); val = snd_hda_get_default_vref(codec, nid);
} }
snd_hda_set_pin_ctl_cache(codec, nid, val); snd_hda_set_pin_ctl_cache(codec, nid, val);
update_hp_automute_hook(codec); call_hp_automute(codec, NULL);
return 1; return 1;
} }
...@@ -3861,22 +3851,6 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja ...@@ -3861,22 +3851,6 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja
} }
EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch); EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch);
/* update jack retasking */
static void update_automute_all(struct hda_codec *codec)
{
struct hda_gen_spec *spec = codec->spec;
update_hp_automute_hook(codec);
if (spec->line_automute_hook)
spec->line_automute_hook(codec, NULL);
else
snd_hda_gen_line_automute(codec, NULL);
if (spec->mic_autoswitch_hook)
spec->mic_autoswitch_hook(codec, NULL);
else
snd_hda_gen_mic_autoswitch(codec, NULL);
}
/* call appropriate hooks */ /* call appropriate hooks */
static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack)
{ {
...@@ -3907,6 +3881,14 @@ static void call_mic_autoswitch(struct hda_codec *codec, ...@@ -3907,6 +3881,14 @@ static void call_mic_autoswitch(struct hda_codec *codec,
snd_hda_gen_mic_autoswitch(codec, jack); snd_hda_gen_mic_autoswitch(codec, jack);
} }
/* update jack retasking */
static void update_automute_all(struct hda_codec *codec)
{
call_hp_automute(codec, NULL);
call_line_automute(codec, NULL);
call_mic_autoswitch(codec, NULL);
}
/* /*
* Auto-Mute mode mixer enum support * Auto-Mute mode mixer enum support
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册