From c56620ec02373a1f820b79a728696269fcbb51aa Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 7 Mar 2013 18:40:58 +0100 Subject: [PATCH] --- yaml --- r: 371695 b: refs/heads/master c: 8ba955cef30921417dffba901a8af5a2662a1dec h: refs/heads/master i: 371693: 9ae5633176ca9ed79c7d7ad252cee7739b68e835 371691: c09a88de528cf6a5554edb85bffa2ea19653b7a8 371687: a58240fff956547948b00949514b855a5a41c105 371679: 74502a2476fc0d24e048743907d7bc908277f1d7 v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/hda_generic.c | 45 ++++++++++++++++--------------- trunk/sound/pci/hda/hda_generic.h | 1 + 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index 179dbde346b3..fa33fee34de2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f811c3cf8fae63ecc8a937ba7376490e2565f8f1 +refs/heads/master: 8ba955cef30921417dffba901a8af5a2662a1dec diff --git a/trunk/sound/pci/hda/hda_generic.c b/trunk/sound/pci/hda/hda_generic.c index c8791225b2ba..fb232c118e91 100644 --- a/trunk/sound/pci/hda/hda_generic.c +++ b/trunk/sound/pci/hda/hda_generic.c @@ -1890,6 +1890,17 @@ static int create_speaker_out_ctls(struct hda_codec *codec) * independent HP controls */ +/* update HP auto-mute state too */ +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, struct snd_ctl_elem_info *uinfo) { @@ -1950,12 +1961,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol, else *dacp = spec->alt_dac_nid; - /* update HP auto-mute state too */ - if (spec->hp_automute_hook) - spec->hp_automute_hook(codec, NULL); - else - snd_hda_gen_hp_automute(codec, NULL); - + update_hp_automute_hook(codec); ret = 1; } unlock: @@ -2237,17 +2243,14 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force) PIN_IN | (as_mic ? vref_val : 0)); } - if (as_mic) - val |= PIN_IN; - else - val = PIN_HP; - set_pin_target(codec, pin, val, true); - - /* update HP auto-mute state too */ - if (spec->hp_automute_hook) - spec->hp_automute_hook(codec, NULL); - else - snd_hda_gen_hp_automute(codec, NULL); + if (!spec->hp_mic_jack_modes) { + if (as_mic) + val |= PIN_IN; + else + val = PIN_HP; + set_pin_target(codec, pin, val, true); + update_hp_automute_hook(codec); + } } /* create a shared input with the headphone out */ @@ -2654,6 +2657,8 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol, val = snd_hda_get_default_vref(codec, nid); } snd_hda_set_pin_ctl_cache(codec, nid, val); + update_hp_automute_hook(codec); + return 1; } @@ -2677,6 +2682,7 @@ static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin) if (!knew) return -ENOMEM; knew->private_value = pin; + spec->hp_mic_jack_modes = 1; return 0; } @@ -3800,10 +3806,7 @@ static void update_automute_all(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); + update_hp_automute_hook(codec); if (spec->line_automute_hook) spec->line_automute_hook(codec, NULL); else diff --git a/trunk/sound/pci/hda/hda_generic.h b/trunk/sound/pci/hda/hda_generic.h index 984bf301ebbb..094e6af7a107 100644 --- a/trunk/sound/pci/hda/hda_generic.h +++ b/trunk/sound/pci/hda/hda_generic.h @@ -221,6 +221,7 @@ struct hda_gen_spec { unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */ unsigned int indep_hp_enabled:1; /* independent HP enabled */ unsigned int have_aamix_ctl:1; + unsigned int hp_mic_jack_modes:1; /* loopback mixing mode */ bool aamix_mode;