The current HDA generic parser initializes / modifies the amp values always in stereo, but this seems causing the problem on ALC3229
codec
that has a few mono channel widgets: namely, these mono widgets
react
to actions for both channels equally.
In the driver code, we do care the mono channel and create a control only for the left channel (as defined in HD-audio spec) for such a node. When the control is updated, only the left channel value is changed. However, in the resume, the right channel value is also restored from the initial value we took as stereo, and this
overwrites
the left channel value. This ends up being the silent output as the right channel has been never touched and remains muted.
This patch covers the places where unconditional stereo amp accesses are done and converts to the conditional accesses.
Seem the number of amp-in vals is not only depend on widget cap mono
In your example, node 0xf is mono and has only one connection
Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00] Connection: 1 0x0d
Refer to block diagram in alc272 datasheet
Node 0xf has two mute switch
https://launchpadlibrarian.net/200283132/AlsaInfo.txt
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
Refer to HDA Specification
7.1.3 Widget Interconnection Rules
- When a stereo widget is an input to a mono widget, only the
L-channel of
the source drives the sink.
There is one exception to this rule, which allows a mono Mixer Widget
to
mix the L- and R-channels of a single stereo widget into a mono
channel.
This exception occurs only when the sink widget is: A Mixer Widget,
and Is
identified as “mono,” and Contains exactly one entry in its connection list, and The single widget identified in its connection list
(source) is
“stereo.”
In this case, this mixer is required to have two inputs, the first
being
driven by the L-channel of the stereo source and the second by the R-channel.
The signals are summed up in that case, indeed, but what we do care here is about which amp channel value to control. So, it's irrelevant from the code change.
After reconsidering this, I see your point now. The widget 0x0f in the first example above needs to have stereo (left and right) amp values. What's confusing is that the second case above does *not* have stereo amp values. That is, this exception is applied only for a single stereo-to-mono mix route, not for M-to-N mixing.
It seem that I am wrong after reconsidering this case
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1432347
It is strange that a four channels codec has three audio outputs as the datasheet only have two DAC
Codec: Realtek ALC272 Address: 1 AFG Function Id: 0x1 (unsol 1) Vendor Id: 0x10ec0272 Subsystem Id: 0x17aac004 Revision Id: 0x100001 No Modem Function Group found Default PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: N/A Default Amp-Out caps: N/A State of AFG node 0x01: Power states: D0 D1 D2 D3 CLKSTOP Power: setting=D0, actual=D0 GPIO: io=2, o=0, i=0, unsolicited=1, wake=0 IO[0]: enable=1, dir=1, wake=0, sticky=0, data=1, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out Control: name="Bass Speaker Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x2c 0x2c] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out Control: name="Speaker Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="ALC272 Analog", type="Audio", device=0 Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x2c 0x2c] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x04 [Audio Output] wcaps 0x41d: 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=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x2c 0x2c] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0