aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 5e82acf77c5a..c95c8bde12d0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -185,7 +185,6 @@ struct alc_spec {
185 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ 185 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */
186 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ 186 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */
187 unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ 187 unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */
188 unsigned int use_jack_tbl:1; /* 1 for model=auto */
189 188
190 /* auto-mute control */ 189 /* auto-mute control */
191 int automute_mode; 190 int automute_mode;
@@ -621,17 +620,10 @@ static void alc_mic_automute(struct hda_codec *codec)
621 alc_mux_select(codec, 0, spec->int_mic_idx, false); 620 alc_mux_select(codec, 0, spec->int_mic_idx, false);
622} 621}
623 622
624/* unsolicited event for HP jack sensing */ 623/* handle the specified unsol action (ALC_XXX_EVENT) */
625static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) 624static void alc_exec_unsol_event(struct hda_codec *codec, int action)
626{ 625{
627 struct alc_spec *spec = codec->spec; 626 switch (action) {
628 if (codec->vendor_id == 0x10ec0880)
629 res >>= 28;
630 else
631 res >>= 26;
632 if (spec->use_jack_tbl)
633 res = snd_hda_jack_get_action(codec, res);
634 switch (res) {
635 case ALC_HP_EVENT: 627 case ALC_HP_EVENT:
636 alc_hp_automute(codec); 628 alc_hp_automute(codec);
637 break; 629 break;
@@ -645,6 +637,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
645 snd_hda_jack_report_sync(codec); 637 snd_hda_jack_report_sync(codec);
646} 638}
647 639
640/* unsolicited event for HP jack sensing */
641static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
642{
643 if (codec->vendor_id == 0x10ec0880)
644 res >>= 28;
645 else
646 res >>= 26;
647 res = snd_hda_jack_get_action(codec, res);
648 alc_exec_unsol_event(codec, res);
649}
650
648/* call init functions of standard auto-mute helpers */ 651/* call init functions of standard auto-mute helpers */
649static void alc_inithook(struct hda_codec *codec) 652static void alc_inithook(struct hda_codec *codec)
650{ 653{
@@ -1883,7 +1886,7 @@ static const struct snd_kcontrol_new alc_beep_mixer[] = {
1883}; 1886};
1884#endif 1887#endif
1885 1888
1886static int alc_build_controls(struct hda_codec *codec) 1889static int __alc_build_controls(struct hda_codec *codec)
1887{ 1890{
1888 struct alc_spec *spec = codec->spec; 1891 struct alc_spec *spec = codec->spec;
1889 struct snd_kcontrol *kctl = NULL; 1892 struct snd_kcontrol *kctl = NULL;
@@ -2029,11 +2032,16 @@ static int alc_build_controls(struct hda_codec *codec)
2029 2032
2030 alc_free_kctls(codec); /* no longer needed */ 2033 alc_free_kctls(codec); /* no longer needed */
2031 2034
2032 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); 2035 return 0;
2036}
2037
2038static int alc_build_controls(struct hda_codec *codec)
2039{
2040 struct alc_spec *spec = codec->spec;
2041 int err = __alc_build_controls(codec);
2033 if (err < 0) 2042 if (err < 0)
2034 return err; 2043 return err;
2035 2044 return snd_hda_jack_add_kctls(codec, &spec->autocfg);
2036 return 0;
2037} 2045}
2038 2046
2039 2047
@@ -3233,7 +3241,7 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
3233 int i, err, noutputs; 3241 int i, err, noutputs;
3234 3242
3235 noutputs = cfg->line_outs; 3243 noutputs = cfg->line_outs;
3236 if (spec->multi_ios > 0) 3244 if (spec->multi_ios > 0 && cfg->line_outs < 3)
3237 noutputs += spec->multi_ios; 3245 noutputs += spec->multi_ios;
3238 3246
3239 for (i = 0; i < noutputs; i++) { 3247 for (i = 0; i < noutputs; i++) {
@@ -3904,7 +3912,6 @@ static void set_capture_mixer(struct hda_codec *codec)
3904static void alc_auto_init_std(struct hda_codec *codec) 3912static void alc_auto_init_std(struct hda_codec *codec)
3905{ 3913{
3906 struct alc_spec *spec = codec->spec; 3914 struct alc_spec *spec = codec->spec;
3907 spec->use_jack_tbl = 1;
3908 alc_auto_init_multi_out(codec); 3915 alc_auto_init_multi_out(codec);
3909 alc_auto_init_extra_out(codec); 3916 alc_auto_init_extra_out(codec);
3910 alc_auto_init_analog_input(codec); 3917 alc_auto_init_analog_input(codec);
@@ -4168,6 +4175,8 @@ static int patch_alc880(struct hda_codec *codec)
4168 codec->patch_ops = alc_patch_ops; 4175 codec->patch_ops = alc_patch_ops;
4169 if (board_config == ALC_MODEL_AUTO) 4176 if (board_config == ALC_MODEL_AUTO)
4170 spec->init_hook = alc_auto_init_std; 4177 spec->init_hook = alc_auto_init_std;
4178 else
4179 codec->patch_ops.build_controls = __alc_build_controls;
4171#ifdef CONFIG_SND_HDA_POWER_SAVE 4180#ifdef CONFIG_SND_HDA_POWER_SAVE
4172 if (!spec->loopback.amplist) 4181 if (!spec->loopback.amplist)
4173 spec->loopback.amplist = alc880_loopbacks; 4182 spec->loopback.amplist = alc880_loopbacks;
@@ -4297,6 +4306,8 @@ static int patch_alc260(struct hda_codec *codec)
4297 codec->patch_ops = alc_patch_ops; 4306 codec->patch_ops = alc_patch_ops;
4298 if (board_config == ALC_MODEL_AUTO) 4307 if (board_config == ALC_MODEL_AUTO)
4299 spec->init_hook = alc_auto_init_std; 4308 spec->init_hook = alc_auto_init_std;
4309 else
4310 codec->patch_ops.build_controls = __alc_build_controls;
4300 spec->shutup = alc_eapd_shutup; 4311 spec->shutup = alc_eapd_shutup;
4301#ifdef CONFIG_SND_HDA_POWER_SAVE 4312#ifdef CONFIG_SND_HDA_POWER_SAVE
4302 if (!spec->loopback.amplist) 4313 if (!spec->loopback.amplist)
@@ -4691,6 +4702,8 @@ static int patch_alc882(struct hda_codec *codec)
4691 codec->patch_ops = alc_patch_ops; 4702 codec->patch_ops = alc_patch_ops;
4692 if (board_config == ALC_MODEL_AUTO) 4703 if (board_config == ALC_MODEL_AUTO)
4693 spec->init_hook = alc_auto_init_std; 4704 spec->init_hook = alc_auto_init_std;
4705 else
4706 codec->patch_ops.build_controls = __alc_build_controls;
4694 4707
4695#ifdef CONFIG_SND_HDA_POWER_SAVE 4708#ifdef CONFIG_SND_HDA_POWER_SAVE
4696 if (!spec->loopback.amplist) 4709 if (!spec->loopback.amplist)