ALSA: HDA: Remove over-initialization of mux in ALC269VB
PATCH 1/1 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.
Signature · 2 lines
David Henningsson, Canonical Ltd. http://launchpad.net/~diwic
Quoted 1 line
From
a6f6fa6a49d14bd1f85042a2575b607233c2a91dMon Sep 17 00:00:00 2001
From: David Henningsson <[email protected]>
Date: Wed, 9 Mar 2011 10:06:17 +0100
Subject: [PATCH] ALSA: HDA: Remove over-initialization of mux in ALC269VB
This initialization verb breaks the automatic mux setup in some cases (e g just one internal mic and nothing else), and it's not needed as both laptop_amic and laptop_dmic models set this verb anyway.
--- sound/pci/hda/patch_realtek.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c +0 -5
@@ -14574,11 +14574,6 @@ static struct hda_verb alc269vb_init_verbs[] = { {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, -/* FIXME: use Mux-type input source selection */ -/* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ -/* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ - {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* set EAPD */ {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, { }
Signature · 1 line
1.7.1
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Thu, 10 Mar 2011 08:59:22 +0100,
Quoted 5 lines · David Henningsson
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 <[email protected]>
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.
--- sound/pci/hda/patch_realtek.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
sound/pci/hda/patch_realtek.c +16 -3
@@ -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 ]; } }
Signature · 1 line
1.7.4.1
Quoted 9 lines · Takashi Iwai
At Thu, 10 Mar 2011 08:59:22 +0100,
Quoted 5 lines · David Henningsson
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.
Quoted 3 lines
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 :-)
Quoted 1 line
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.
Quoted 95 lines
thanks,
Takashi
---
From: Takashi Iwai<[email protected]>
Subject: [PATCH] ALSA: hda - Initialize special cases for input src in init phaseCurrently 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<[email protected]>--- sound/pci/hda/patch_realtek.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)sound/pci/hda/patch_realtek.c +16
-3@@ -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 ]; } }
Signature · 2 lines
David Henningsson, Canonical Ltd. http://launchpad.net/~diwic
Codec: Realtek ALC269VB
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0269
Subsystem Id: 0x10438437
Revision Id: 0x100100
No Modem Function Group found
Default PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCMDefault Amp-In caps: N/A
Default Amp-Out caps: N/A
GPIO: io=2, o=0, i=0, unsolicited=1, wake=0
IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x02 [Audio Output] wcaps 0x1d: Stereo Amp-Out
Control: name="Speaker Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Device: name="ALC269VB Analog", type="Audio", device=0
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals: [0x57 0x57]
Converter: stream=5, channel=0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Node 0x03 [Audio Output] wcaps 0x1d: Stereo Amp-Out
Control: name="Headphone Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals: [0x57 0x57]
Converter: stream=5, channel=0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCMNode 0x04 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x05 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x06 [Audio Output] wcaps 0x211: Stereo Digital
Converter: stream=0, channel=0
Digital:
Digital category: 0x0
PCM:
rates [0x5e0]: 44100 48000 88200 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCMNode 0x07 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In
Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x8b 0x8b]
Converter: stream=0, channel=0
SDI-Select: 0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Connection: 1
0x23Node 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In
Control: name="Capture Switch", index=0, device=0
Control: name="Capture Volume", index=0, device=0
Device: name="ALC269VB Analog", type="Audio", device=0 Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x1f 0x1f]
Converter: stream=1, channel=0
SDI-Select: 0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Connection: 1
0x22Node 0x0a [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97]
Connection: 5
0x18 0x19 0x1a 0x1b 0x1d
Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00]
Connection: 2
0x02 0x0b
Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00]
Connection: 2
0x03 0x0b
Node 0x0e [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00] [0x00]
Connection: 2
0x02 0x0b
Node 0x10 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x11 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x12 [Pin Complex] wcaps 0x40000b: Stereo Amp-In
Control: name="Mic Boost Volume", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0 Amp-In vals: [0x03 0x03]
Pincap 0x00000020: IN
Pin Default 0x99a30920: [Fixed] Mic at Int ATAPI
Conn = ATAPI, Color = Unknown
DefAssociation = 0x2, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN
Node 0x13 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x14 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
Control: name="Speaker Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x00010014: OUT EAPD Detect
EAPD 0x2: EAPD
Pin Default 0x99130110: [Fixed] Speaker at Int ATAPI
Conn = ATAPI, Color = Unknown
DefAssociation = 0x1, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0dNode 0x15 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x16 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x17 [Pin Complex] wcaps 0x40010c: Mono Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80]
Pincap 0x00000010: OUT
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x00:
Connection: 1
0x0f
Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0 Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80]
Pincap 0x00001734: IN OUT Detect
Vref caps: HIZ 50 GRD 80
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x24: IN VREF_80
Unsolicited: tag=00, enabled=0
Connection: 1
0x0d
Node 0x19 [Pin Complex] wcaps 0x40008b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0 Amp-In vals: [0x00 0x00]
Pincap 0x00001724: IN Detect
Vref caps: HIZ 50 GRD 80
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x24: IN VREF_80
Unsolicited: tag=00, enabled=0
Node 0x1a [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Control: name="Headphone Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x0000003c: IN OUT HP Detect
Pin Default 0x03211c1f: [Jack] HP Out at Ext Left
Conn = 1/8, Color = Black
DefAssociation = 0x1, Sequence = 0xf
Pin-ctls: 0xc0: OUT HP
Unsolicited: tag=04, enabled=1
Connection: 2
0x0c 0x0d*Node 0x1b [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0 Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80]
Pincap 0x00000034: IN OUT Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x1d [Pin Complex] wcaps 0x400000: Mono
Pincap 0x00000020: IN
Pin Default 0x4006852d: [N/A] Line Out at Ext N/A
Conn = Digital, Color = Purple DefAssociation = 0x2, Sequence = 0xd
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN
Node 0x1e [Pin Complex] wcaps 0x400381: Stereo Digital
Pincap 0x00000014: OUT Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Connection: 1
0x06
Node 0x1f [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono
Processing caps: benign=0, ncoeff=25
Node 0x21 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00]
Pincap 0x0000001c: OUT HP Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0xc0: OUT HP
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x22 [Audio Selector] wcaps 0x30010b: Stereo Amp-In
Amp-In caps: N/A
Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00]
Connection: 7
0x18* 0x19 0x1a 0x1b 0x1d 0x0b 0x12
Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
Connection: 6
0x18 0x19 0x1a 0x1b 0x1d 0x0b
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Fri, 11 Mar 2011 09:51:37 +0100,
Quoted 10 lines · David Henningsson
Quoted 8 lines · Takashi Iwai
At Thu, 10 Mar 2011 08:59:22 +0100,
Quoted 5 lines · David Henningsson
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.
Quoted 4 lines
Quoted 1 line
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.
Quoted 5 lines
Quoted 3 lines
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.
Quoted 5 lines
Quoted 1 line
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