[PATCH 2/2] ALSA: hda/realtek - Fix Lenovo Thinkpad X1 Carbon 7th quirk value

From: Benjamin Poirier
Date: Tue Feb 11 2020 - 00:57:59 EST


As a result of commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker
on Lenovo Carbon X1 7th gen"), the maximum sound output level on my
machine, an X1 Carbon, was reduced to ~60% of its previous level.

This laptop model has two sets of stereo speakers: Front and Bass (aka Rear
in some contexts).
Before commit d2cd795c4ece, volume control was commonly ineffective (using
the Master slider in alsa or pulseaudio apparently had little effect or
alternated between mute or max with nothing in between - more details
below)
commit d2cd795c4ece added quirk ALC285_FIXUP_SPEAKER2_TO_DAC1 which
resulted in assigning both sets of speakers to the same DAC, bringing
the two sets of speakers under one effective volume control but also
lowering the max output volume noticeably.

Fix this by changing the quirk so that each set of speakers can be
controlled individually and the max output volume is restored to what it
was before commit d2cd795c4ece.

Since there is no documentation about the audio codec, here is some
detailed information about the result of applying different quirks.
DAC connection (which is what's affected by the quirk) is reported as found
in /proc/asound/card0/codec#0, Node 0x17.
pavucontrol controls are reported with the device configured with the
"Analog Surround 4.0 Output" profile.

no quirk
Loud max output volume
DAC connection
Connection: 3
0x02 0x03 0x06*
Controls in alsamixer
Master controls front speakers only.
Speaker controls front speakers only.
Bass Speaker is a toggle that mutes everything.
PCM controls all speakers.
There is no "Front" mixer.
Controls in pavucontrol
"Front Left"/"Front Right" sliders work as expected.
"Rear Left"/"Rear Right" sliders seem to operate in a
non-linear fashion such that most values above 0% result in
max volume output.
-> Because the bass speakers (Rear) are more powerful, the
net effect is that when the channels are linked into a
single slider, it seems like it has just two modes: mute or
max.
ALC285_FIXUP_SPEAKER2_TO_DAC1
Weak (~60%) max output volume
DAC connection
Connection: 3
0x02* 0x03 0x06
In-driver Connection: 1
0x02
Controls in alsamixer
Master controls all four speakers.
Speaker controls all four speakers.
Bass Speaker is a toggle that mutes everything.
PCM controls all four speakers.
There is no "Front" mixer.
Controls in pavucontrol
"Front Left"/"Front Right" sliders have no effect.
"Rear Left"/"Rear Right" sliders control both front and
bass speakers.
-> Volume control is effective but it's not possible to
control front and bass speakers individually.
ALC295_FIXUP_DISABLE_DAC3
Loud max output volume
DAC connection
Connection: 3
0x02 0x03* 0x06
In-driver Connection: 2
0x02 0x03
Controls in alsamixer
Master controls all speakers.
Speaker is a toggle that mutes everything.
Bass Speaker controls bass speakers only.
PCM controls all speakers.
Front controls front speakers only.
Controls in pavucontrol
"Front Left"/"Front Right" sliders control front speakers
only.
"Rear Left"/"Rear Right" sliders control bass speakers
only.
-> Volume control is effective and it's possible to control
each of the four speakers individually.

In summary, Node 0x17 DAC connection 0x3 offers the loudest max volume and
the most detailed mixer controls. That connection is obtained with quirk
ALC295_FIXUP_DISABLE_DAC3. Therefore, change the ThinkPad X1 Carbon 7th to
use ALC295_FIXUP_DISABLE_DAC3.

Fixes: d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen")
Link: https://lore.kernel.org/alsa-devel/20200210025249.GA2700@f3/
Cc: Jaroslav Kysela <perex@xxxxxxxx>
Cc: Kailang Yang <kailang@xxxxxxxxxxx>
Signed-off-by: Benjamin Poirier <benjamin.poirier@xxxxxxxxx>
---
sound/pci/hda/patch_realtek.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 05d44df2008e..3171da10123e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7268,7 +7268,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
- SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
+ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC295_FIXUP_DISABLE_DAC3),
SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
--
2.25.0