[alsa-devel] [PATCH] ALSA: HDA: Remove over-initialization of mux in ALC269VB
Takashi, would you like to give this one a thought to make sure I haven't missed any case where this verb is needed. For both models (amic and dmic), the verb is re-issued, and the autoparser would either add a mux, or at least set it to a correct start.
The stable-cc (2.6.38+) is set that way because we tried it on top of 2.6.35 and it didn't work on the particular machine. I don't know about 2.6.36 or 2.6.37.
At Thu, 10 Mar 2011 08:59:22 +0100, David Henningsson wrote:
Takashi, would you like to give this one a thought to make sure I haven't missed any case where this verb is needed. For both models (amic and dmic), the verb is re-issued, and the autoparser would either add a mux, or at least set it to a correct start.
Could you give some sample alsa-info outputs affected by this bug?
Basically, setting the verbs in that init table should be harmless if the driver overwrites the setting properly in alc269_auto_init() or via amp-cache/verb-cache on resume.
Does the patch like below fix the issue?
thanks,
Takashi
--- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] ALSA: hda - Initialize special cases for input src in init phase
Currently some special handling for the unusual case like dual-ADCs or a single-input-src is done in the tree-parse time in set_capture_mixer(). But this setup could be overwritten by static init verbs.
This patch moves the initialization into the init phase so that such input-src setup won't be lost.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/hda/patch_realtek.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4261bb8..c1ad3e9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -394,6 +394,7 @@ struct alc_spec { /* other flags */ unsigned int no_analog :1; /* digital I/O only */ unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ + unsigned int single_input_src:1; int init_amp; int codec_variant; /* flag for other variants */
@@ -3919,6 +3920,8 @@ static struct hda_amp_list alc880_lg_loopbacks[] = { * Common callbacks */
+static void alc_init_special_input_src(struct hda_codec *codec); + static int alc_init(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -3929,6 +3932,7 @@ static int alc_init(struct hda_codec *codec)
for (i = 0; i < spec->num_init_verbs; i++) snd_hda_sequence_write(codec, spec->init_verbs[i]); + alc_init_special_input_src(codec);
if (spec->init_hook) spec->init_hook(codec); @@ -5585,6 +5589,7 @@ static void fixup_single_adc(struct hda_codec *codec) spec->capsrc_nids += i; spec->adc_nids += i; spec->num_adc_nids = 1; + spec->single_input_src = 1; } }
@@ -5596,6 +5601,16 @@ static void fixup_dual_adc_switch(struct hda_codec *codec) init_capsrc_for_pin(codec, spec->int_mic.pin); }
+/* initialize some special cases for input sources */ +static void alc_init_special_input_src(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + if (spec->dual_adc_switch) + fixup_dual_adc_switch(codec); + else if (spec->single_input_src) + init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); +} + static void set_capture_mixer(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -5611,7 +5626,7 @@ static void set_capture_mixer(struct hda_codec *codec) int mux = 0; int num_adcs = spec->num_adc_nids; if (spec->dual_adc_switch) - fixup_dual_adc_switch(codec); + num_adcs = 1; else if (spec->auto_mic) fixup_automic_adc(codec); else if (spec->input_mux) { @@ -5620,8 +5635,6 @@ static void set_capture_mixer(struct hda_codec *codec) else if (spec->input_mux->num_items == 1) fixup_single_adc(codec); } - if (spec->dual_adc_switch) - num_adcs = 1; spec->cap_mixer = caps[mux][num_adcs - 1]; } }
On 2011-03-10 12:54, Takashi Iwai wrote:
At Thu, 10 Mar 2011 08:59:22 +0100, David Henningsson wrote:
Takashi, would you like to give this one a thought to make sure I haven't missed any case where this verb is needed. For both models (amic and dmic), the verb is re-issued, and the autoparser would either add a mux, or at least set it to a correct start.
Could you give some sample alsa-info outputs affected by this bug?
Hmm, at least I can get you codec proc (attached) and PCI IDs (8086:27d8 (rev 02), SSID 1043:8437). Let me know if you need anything else.
Basically, setting the verbs in that init table should be harmless if the driver overwrites the setting properly in alc269_auto_init() or via amp-cache/verb-cache on resume.
Ok, although the initialisation verb is still superfluous :-)
Does the patch like below fix the issue?
It does fix the issue when I run it in hda-emu, thanks! I've asked the person with the hardware to test it there as well and I'm awaiting his reply.
thanks,
Takashi
From: Takashi Iwaitiwai@suse.de Subject: [PATCH] ALSA: hda - Initialize special cases for input src in init phase
Currently some special handling for the unusual case like dual-ADCs or a single-input-src is done in the tree-parse time in set_capture_mixer(). But this setup could be overwritten by static init verbs.
This patch moves the initialization into the init phase so that such input-src setup won't be lost.
Signed-off-by: Takashi Iwaitiwai@suse.de
sound/pci/hda/patch_realtek.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4261bb8..c1ad3e9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -394,6 +394,7 @@ struct alc_spec { /* other flags */ unsigned int no_analog :1; /* digital I/O only */ unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
- unsigned int single_input_src:1; int init_amp; int codec_variant; /* flag for other variants */
@@ -3919,6 +3920,8 @@ static struct hda_amp_list alc880_lg_loopbacks[] = {
- Common callbacks
*/
+static void alc_init_special_input_src(struct hda_codec *codec);
- static int alc_init(struct hda_codec *codec) { struct alc_spec *spec = codec->spec;
@@ -3929,6 +3932,7 @@ static int alc_init(struct hda_codec *codec)
for (i = 0; i< spec->num_init_verbs; i++) snd_hda_sequence_write(codec, spec->init_verbs[i]);
alc_init_special_input_src(codec);
if (spec->init_hook) spec->init_hook(codec);
@@ -5585,6 +5589,7 @@ static void fixup_single_adc(struct hda_codec *codec) spec->capsrc_nids += i; spec->adc_nids += i; spec->num_adc_nids = 1;
} }spec->single_input_src = 1;
@@ -5596,6 +5601,16 @@ static void fixup_dual_adc_switch(struct hda_codec *codec) init_capsrc_for_pin(codec, spec->int_mic.pin); }
+/* initialize some special cases for input sources */ +static void alc_init_special_input_src(struct hda_codec *codec) +{
- struct alc_spec *spec = codec->spec;
- if (spec->dual_adc_switch)
fixup_dual_adc_switch(codec);
- else if (spec->single_input_src)
init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
+}
- static void set_capture_mixer(struct hda_codec *codec) { struct alc_spec *spec = codec->spec;
@@ -5611,7 +5626,7 @@ static void set_capture_mixer(struct hda_codec *codec) int mux = 0; int num_adcs = spec->num_adc_nids; if (spec->dual_adc_switch)
fixup_dual_adc_switch(codec);
else if (spec->auto_mic) fixup_automic_adc(codec); else if (spec->input_mux) {num_adcs = 1;
@@ -5620,8 +5635,6 @@ static void set_capture_mixer(struct hda_codec *codec) else if (spec->input_mux->num_items == 1) fixup_single_adc(codec); }
if (spec->dual_adc_switch)
spec->cap_mixer = caps[mux][num_adcs - 1]; } }num_adcs = 1;
At Fri, 11 Mar 2011 09:51:37 +0100, David Henningsson wrote:
On 2011-03-10 12:54, Takashi Iwai wrote:
At Thu, 10 Mar 2011 08:59:22 +0100, David Henningsson wrote:
Takashi, would you like to give this one a thought to make sure I haven't missed any case where this verb is needed. For both models (amic and dmic), the verb is re-issued, and the autoparser would either add a mux, or at least set it to a correct start.
Could you give some sample alsa-info outputs affected by this bug?
Hmm, at least I can get you codec proc (attached) and PCI IDs (8086:27d8 (rev 02), SSID 1043:8437). Let me know if you need anything else.
Thanks, I'll check it, too.
Basically, setting the verbs in that init table should be harmless if the driver overwrites the setting properly in alc269_auto_init() or via amp-cache/verb-cache on resume.
Ok, although the initialisation verb is still superfluous :-)
Yes, I can apply the patch but we can rip off cc to stable.
Does the patch like below fix the issue?
It does fix the issue when I run it in hda-emu, thanks! I've asked the person with the hardware to test it there as well and I'm awaiting his reply.
Good to hear. Let me know if it's confirmed to work.
Takashi
participants (2)
-
David Henningsson
-
Takashi Iwai