aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r--sound/pci/hda/hda_generic.c68
1 files changed, 38 insertions, 30 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index ae85bbd2e6f8..4b1524a861f3 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -788,6 +788,8 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
788 return; 788 return;
789 if (codec->inv_eapd) 789 if (codec->inv_eapd)
790 enable = !enable; 790 enable = !enable;
791 if (spec->keep_eapd_on && !enable)
792 return;
791 snd_hda_codec_update_cache(codec, pin, 0, 793 snd_hda_codec_update_cache(codec, pin, 0,
792 AC_VERB_SET_EAPD_BTLENABLE, 794 AC_VERB_SET_EAPD_BTLENABLE,
793 enable ? 0x02 : 0x00); 795 enable ? 0x02 : 0x00);
@@ -1938,17 +1940,7 @@ static int create_speaker_out_ctls(struct hda_codec *codec)
1938 * independent HP controls 1940 * independent HP controls
1939 */ 1941 */
1940 1942
1941/* update HP auto-mute state too */ 1943static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack);
1942static void update_hp_automute_hook(struct hda_codec *codec)
1943{
1944 struct hda_gen_spec *spec = codec->spec;
1945
1946 if (spec->hp_automute_hook)
1947 spec->hp_automute_hook(codec, NULL);
1948 else
1949 snd_hda_gen_hp_automute(codec, NULL);
1950}
1951
1952static int indep_hp_info(struct snd_kcontrol *kcontrol, 1944static int indep_hp_info(struct snd_kcontrol *kcontrol,
1953 struct snd_ctl_elem_info *uinfo) 1945 struct snd_ctl_elem_info *uinfo)
1954{ 1946{
@@ -2009,7 +2001,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol,
2009 else 2001 else
2010 *dacp = spec->alt_dac_nid; 2002 *dacp = spec->alt_dac_nid;
2011 2003
2012 update_hp_automute_hook(codec); 2004 call_hp_automute(codec, NULL);
2013 ret = 1; 2005 ret = 1;
2014 } 2006 }
2015 unlock: 2007 unlock:
@@ -2305,7 +2297,7 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force)
2305 else 2297 else
2306 val = PIN_HP; 2298 val = PIN_HP;
2307 set_pin_target(codec, pin, val, true); 2299 set_pin_target(codec, pin, val, true);
2308 update_hp_automute_hook(codec); 2300 call_hp_automute(codec, NULL);
2309 } 2301 }
2310} 2302}
2311 2303
@@ -2714,7 +2706,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol,
2714 val = snd_hda_get_default_vref(codec, nid); 2706 val = snd_hda_get_default_vref(codec, nid);
2715 } 2707 }
2716 snd_hda_set_pin_ctl_cache(codec, nid, val); 2708 snd_hda_set_pin_ctl_cache(codec, nid, val);
2717 update_hp_automute_hook(codec); 2709 call_hp_automute(codec, NULL);
2718 2710
2719 return 1; 2711 return 1;
2720} 2712}
@@ -3859,20 +3851,42 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja
3859} 3851}
3860EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch); 3852EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch);
3861 3853
3862/* update jack retasking */ 3854/* call appropriate hooks */
3863static void update_automute_all(struct hda_codec *codec) 3855static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack)
3864{ 3856{
3865 struct hda_gen_spec *spec = codec->spec; 3857 struct hda_gen_spec *spec = codec->spec;
3858 if (spec->hp_automute_hook)
3859 spec->hp_automute_hook(codec, jack);
3860 else
3861 snd_hda_gen_hp_automute(codec, jack);
3862}
3866 3863
3867 update_hp_automute_hook(codec); 3864static void call_line_automute(struct hda_codec *codec,
3865 struct hda_jack_tbl *jack)
3866{
3867 struct hda_gen_spec *spec = codec->spec;
3868 if (spec->line_automute_hook) 3868 if (spec->line_automute_hook)
3869 spec->line_automute_hook(codec, NULL); 3869 spec->line_automute_hook(codec, jack);
3870 else 3870 else
3871 snd_hda_gen_line_automute(codec, NULL); 3871 snd_hda_gen_line_automute(codec, jack);
3872}
3873
3874static void call_mic_autoswitch(struct hda_codec *codec,
3875 struct hda_jack_tbl *jack)
3876{
3877 struct hda_gen_spec *spec = codec->spec;
3872 if (spec->mic_autoswitch_hook) 3878 if (spec->mic_autoswitch_hook)
3873 spec->mic_autoswitch_hook(codec, NULL); 3879 spec->mic_autoswitch_hook(codec, jack);
3874 else 3880 else
3875 snd_hda_gen_mic_autoswitch(codec, NULL); 3881 snd_hda_gen_mic_autoswitch(codec, jack);
3882}
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);
3876} 3890}
3877 3891
3878/* 3892/*
@@ -4009,9 +4023,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)
4009 snd_printdd("hda-codec: Enable HP auto-muting on NID 0x%x\n", 4023 snd_printdd("hda-codec: Enable HP auto-muting on NID 0x%x\n",
4010 nid); 4024 nid);
4011 snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT, 4025 snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT,
4012 spec->hp_automute_hook ? 4026 call_hp_automute);
4013 spec->hp_automute_hook :
4014 snd_hda_gen_hp_automute);
4015 spec->detect_hp = 1; 4027 spec->detect_hp = 1;
4016 } 4028 }
4017 4029
@@ -4024,9 +4036,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)
4024 snd_printdd("hda-codec: Enable Line-Out auto-muting on NID 0x%x\n", nid); 4036 snd_printdd("hda-codec: Enable Line-Out auto-muting on NID 0x%x\n", nid);
4025 snd_hda_jack_detect_enable_callback(codec, nid, 4037 snd_hda_jack_detect_enable_callback(codec, nid,
4026 HDA_GEN_FRONT_EVENT, 4038 HDA_GEN_FRONT_EVENT,
4027 spec->line_automute_hook ? 4039 call_line_automute);
4028 spec->line_automute_hook :
4029 snd_hda_gen_line_automute);
4030 spec->detect_lo = 1; 4040 spec->detect_lo = 1;
4031 } 4041 }
4032 spec->automute_lo_possible = spec->detect_hp; 4042 spec->automute_lo_possible = spec->detect_hp;
@@ -4068,9 +4078,7 @@ static bool auto_mic_check_imux(struct hda_codec *codec)
4068 snd_hda_jack_detect_enable_callback(codec, 4078 snd_hda_jack_detect_enable_callback(codec,
4069 spec->am_entry[i].pin, 4079 spec->am_entry[i].pin,
4070 HDA_GEN_MIC_EVENT, 4080 HDA_GEN_MIC_EVENT,
4071 spec->mic_autoswitch_hook ? 4081 call_mic_autoswitch);
4072 spec->mic_autoswitch_hook :
4073 snd_hda_gen_mic_autoswitch);
4074 return true; 4082 return true;
4075} 4083}
4076 4084