From: Takashi Iwai Date: Thu, 22 Mar 2012 13:36:50 +0000 (+0100) Subject: ALSA: hda/realtek - Fix ADC assignment with a shared HP/Mic pin X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26acaf08556a3c64ebf8ea3654b51e6acbb0a26c;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ALSA: hda/realtek - Fix ADC assignment with a shared HP/Mic pin The recent Realtek driver tries to assign an extra input via the headphone plug when only a single input source is found. The code worked on Samsung Q1, but it broke ASUS 1015 where the mic is a digital-mic and only a specific ADC works. This patch fixes the assignment of ADC in the shared mic/hp case. Instead of assuming the single ADC at first, reduce the ADCs after trying to assign both mic and HP pins. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42973 Cc: Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8ea2fd654327..9917e55d6f11 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2717,9 +2717,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) int max_nums = ARRAY_SIZE(spec->private_adc_nids); int i, nums = 0; - if (spec->shared_mic_hp) - max_nums = 1; /* no multi streams with the shared HP/mic */ - nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { hda_nid_t src; @@ -4076,6 +4073,7 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (spec->dyn_adc_switch) return; + again: nums = 0; for (n = 0; n < spec->num_adc_nids; n++) { hda_nid_t cap = spec->private_capsrc_nids[n]; @@ -4096,6 +4094,11 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (!nums) { /* check whether ADC-switch is possible */ if (!alc_check_dyn_adc_switch(codec)) { + if (spec->shared_mic_hp) { + spec->shared_mic_hp = 0; + spec->private_imux[0].num_items = 1; + goto again; + } printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" " using fallback 0x%x\n", codec->chip_name, spec->private_adc_nids[0]); @@ -4113,7 +4116,7 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (spec->auto_mic) alc_auto_mic_check_imux(codec); /* check auto-mic setups */ - else if (spec->input_mux->num_items == 1) + else if (spec->input_mux->num_items == 1 || spec->shared_mic_hp) spec->num_adc_nids = 1; /* reduce to a single ADC */ }