[alsa-devel] [PATCH] ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
Signed-off-by: Jaroslav Kysela perex@perex.cz --- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d2bf70a1d2fd..a596790d4245 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -5544,6 +5544,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec, } }
+/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */ +static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + hda_nid_t conn[1] = { 0x02 }; + snd_hda_override_conn_list(codec, 0x17, 1, conn); + } +} + /* Hook to update amp GPIO4 for automute */ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, struct hda_jack_callback *jack) @@ -5846,6 +5856,7 @@ enum { ALC225_FIXUP_DISABLE_MIC_VREF, ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, ALC295_FIXUP_DISABLE_DAC3, + ALC285_FIXUP_SPEAKER2_TO_DAC1, ALC280_FIXUP_HP_HEADSET_MIC, ALC221_FIXUP_HP_FRONT_MIC, ALC292_FIXUP_TPT460, @@ -6646,6 +6657,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc295_fixup_disable_dac3, }, + [ALC285_FIXUP_SPEAKER2_TO_DAC1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + }, [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { @@ -7221,6 +7236,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, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), 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), @@ -7405,6 +7421,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"}, {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, + {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"}, {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
On Fri, 29 Nov 2019 15:40:27 +0100, Jaroslav Kysela wrote:
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
Signed-off-by: Jaroslav Kysela perex@perex.cz
Thanks, applied now.
Takashi
On 2019/11/29 15:40 +0100, Jaroslav Kysela wrote:
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
Signed-off-by: Jaroslav Kysela perex@perex.cz
sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
This patch is now commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen"). There was then followup commit 86353aa70ed0 ("ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen").
As a result of those, the maximum sound output level on my laptop reduced to ~60% of what it used to be.
Moreover, the quirk name is inaccurate. I have a "ThinkPad X1 Carbon 7th" (as confirmed by dmidecode) and its audio device id is: Subsystem: Lenovo Cannon Point-LP High Definition Audio Controller [17aa:2292] but the patches list: SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC295_FIXUP_DISABLE_DAC3), (notice the mixup of id 0x2292).
Applying the following diff brings the volume back to previous levels and brings functional volume control:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 68832f52c1ad..ed41e3fb5566 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7260,7 +7260,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 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC295_FIXUP_DISABLE_DAC3), SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), 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),
I can send a patch to fix the problems for my laptop but then I don't know what's up for other devices that built on ALC285_FIXUP_SPEAKER2_TO_DAC1.
On 2020/02/10 11:52 +0900, Benjamin Poirier wrote:
On 2019/11/29 15:40 +0100, Jaroslav Kysela wrote:
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
Signed-off-by: Jaroslav Kysela perex@perex.cz
sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
This patch is now commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen"). There was then followup commit 86353aa70ed0 ("ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen").
Sorry, commit id 86353aa70ed0 is the backport on stable/linux-5.4.y branch, mainline id is: 54a6a7dc107d ("ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen")
As a result of those, the maximum sound output level on my laptop reduced to ~60% of what it used to be.
Moreover, the quirk name is inaccurate. I have a "ThinkPad X1 Carbon 7th" (as confirmed by dmidecode) and its audio device id is: Subsystem: Lenovo Cannon Point-LP High Definition Audio Controller [17aa:2292] but the patches list: SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC295_FIXUP_DISABLE_DAC3), (notice the mixup of id 0x2292).
Applying the following diff brings the volume back to previous levels and brings functional volume control:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 68832f52c1ad..ed41e3fb5566 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7260,7 +7260,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 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
- SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC295_FIXUP_DISABLE_DAC3), SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), 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),
I can send a patch to fix the problems for my laptop but then I don't know what's up for other devices that built on ALC285_FIXUP_SPEAKER2_TO_DAC1.
Hi,
This platform speaker 2 bind DAC 0x2 was default. Use ALC295_FIXUP_DISABLE_DAC3 model will place to DAC 0x3. DAC 0x3 was use as Headphone.
If you want to use as your patch, you could use it at your site. Thanks.
BR, Kailang
-----Original Message----- From: Benjamin Poirier benjamin.poirier@gmail.com Sent: Monday, February 10, 2020 11:04 AM To: Jaroslav Kysela perex@perex.cz Cc: ALSA development alsa-devel@alsa-project.org; Takashi Iwai tiwai@suse.de; Kailang kailang@realtek.com Subject: Re: [alsa-devel] [PATCH] ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
On 2020/02/10 11:52 +0900, Benjamin Poirier wrote:
On 2019/11/29 15:40 +0100, Jaroslav Kysela wrote:
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
Signed-off-by: Jaroslav Kysela perex@perex.cz
sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
This patch is now commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen"). There was then followup commit 86353aa70ed0 ("ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen").
Sorry, commit id 86353aa70ed0 is the backport on stable/linux-5.4.y branch, mainline id is: 54a6a7dc107d ("ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen")
As a result of those, the maximum sound output level on my laptop reduced to ~60% of what it used to be.
Moreover, the quirk name is inaccurate. I have a "ThinkPad X1 Carbon 7th" (as confirmed by dmidecode) and its audio device id is: Subsystem: Lenovo Cannon Point-LP High Definition Audio Controller [17aa:2292] but the patches list: SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th",
ALC285_FIXUP_SPEAKER2_TO_DAC1),
SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC295_FIXUP_DISABLE_DAC3), (notice the mixup of id 0x2292).
Applying the following diff brings the volume back to previous levels and brings functional volume control:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 68832f52c1ad..ed41e3fb5566 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7260,7 +7260,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 Yoga 7th",
ALC285_FIXUP_SPEAKER2_TO_DAC1),
- SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th",
+ALC295_FIXUP_DISABLE_DAC3), SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th",
ALC285_FIXUP_SPEAKER2_TO_DAC1),
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),
I can send a patch to fix the problems for my laptop but then I don't know what's up for other devices that built on ALC285_FIXUP_SPEAKER2_TO_DAC1.
------Please consider the environment before printing this e-mail.
On 2020/02/10 09:11 +0000, Kailang wrote:
Hi,
This platform speaker 2 bind DAC 0x2 was default.
No, 0x6 was the default. commits d2cd795c4ece & 54a6a7dc107d changed it to 0x2 which reduced the max volume.
Use ALC295_FIXUP_DISABLE_DAC3 model will place to DAC 0x3. DAC 0x3 was use as Headphone.
No, none of these quirks have an effect on the headphones.
Do you have a ThinkPad X1 Carbon 7th gen to actually test this code?
If you do, in the output of dmidecode, under "System Information", what's the "Product Name" and "Version"? And what's the pci sub device id for the audio device? The behavior you're describing doesn't match the behavior of the laptop I have here sitting in front of me.
Anyways, I've just tested the headphone port on my machine with the change I posted earlier and it still works as expected - when I plug in headphones, sound comes out through the headphones, when I unplug the headphones, sound comes out through the four speakers loud and clear.
Here's the relevant part of Node 0x17 from /proc/asound/card0/codec#0 with different quirks applied and the level of sound output through the speakers:
no quirk Connection: 3 0x02 0x03 0x06* -> loud volume ALC285_FIXUP_SPEAKER2_TO_DAC1 Connection: 3 0x02* 0x03 0x06 In-driver Connection: 1 0x02 -> weak volume ALC295_FIXUP_DISABLE_DAC3 Connection: 3 0x02 0x03* 0x06 In-driver Connection: 2 0x02 0x03 -> loud volume
Dne 10. 02. 20 v 13:14 Benjamin Poirier napsal(a):
On 2020/02/10 09:11 +0000, Kailang wrote:
Hi,
This platform speaker 2 bind DAC 0x2 was default.
No, 0x6 was the default. commits d2cd795c4ece & 54a6a7dc107d changed it to 0x2 which reduced the max volume.
Use ALC295_FIXUP_DISABLE_DAC3 model will place to DAC 0x3. DAC 0x3 was use as Headphone.
No, none of these quirks have an effect on the headphones.
Do you have a ThinkPad X1 Carbon 7th gen to actually test this code?
If you do, in the output of dmidecode, under "System Information", what's the "Product Name" and "Version"? And what's the pci sub device id for the audio device? The behavior you're describing doesn't match the behavior of the laptop I have here sitting in front of me.
Anyways, I've just tested the headphone port on my machine with the change I posted earlier and it still works as expected - when I plug in headphones, sound comes out through the headphones, when I unplug the headphones, sound comes out through the four speakers loud and clear.
Here's the relevant part of Node 0x17 from /proc/asound/card0/codec#0 with different quirks applied and the level of sound output through the speakers:
no quirk Connection: 3 0x02 0x03 0x06* -> loud volume ALC285_FIXUP_SPEAKER2_TO_DAC1 Connection: 3 0x02* 0x03 0x06 In-driver Connection: 1 0x02 -> weak volume ALC295_FIXUP_DISABLE_DAC3 Connection: 3 0x02 0x03* 0x06 In-driver Connection: 2 0x02 0x03 -> loud volume
Kailang, what's the difference between nodes 0x02 and 0x03 for this codec? Or the DACs are setup differently?
The problem with those Realtek codecs is that they have many "hidden" functions controlled by the undocumented registers.
I have not tested 0x03. Also, both pair of stereo speakers should be connected to one DAC for X1 otherwise we will lose the volume control.
Jaroslav
On 2020/02/10 13:54 +0100, Jaroslav Kysela wrote:
Dne 10. 02. 20 v 13:14 Benjamin Poirier napsal(a):
[...]
Here's the relevant part of Node 0x17 from /proc/asound/card0/codec#0 with different quirks applied and the level of sound output through the speakers:
no quirk Connection: 3 0x02 0x03 0x06* -> loud volume ALC285_FIXUP_SPEAKER2_TO_DAC1 Connection: 3 0x02* 0x03 0x06 In-driver Connection: 1 0x02 -> weak volume ALC295_FIXUP_DISABLE_DAC3 Connection: 3 0x02 0x03* 0x06 In-driver Connection: 2 0x02 0x03 -> loud volume
Kailang, what's the difference between nodes 0x02 and 0x03 for this codec? Or the DACs are setup differently?
The problem with those Realtek codecs is that they have many "hidden" functions controlled by the undocumented registers.
I have not tested 0x03. Also, both pair of stereo speakers should be connected to one DAC for X1 otherwise we will lose the volume control.
Thanks for your reply, however, that statement is incorrect.
The bass speakers don't need to be connected to the same DAC as the front speakers. In fact, I found that it's better to connect them to different DACs: that gives louder max volume and that also gives individual control for front and bass speakers. But it has to be the right DACs: 0x02 and 0x03, not 0x02 and 0x06!
As I wrote in my first mail in this thread,
Applying the following diff brings the volume back to previous levels and brings functional volume control:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I'm not suggesting to simply revert commit d2cd795c4ece ("ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen"), I'm suggesting to use a different quirk.
I went back and collected detailed observations regarding the mixer controls with each quirk. 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. This is probably linked to the fact that "Bass Speaker" is just a toggle in alsamixer. -> 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, ALC295_FIXUP_DISABLE_DAC3 offers the loudest max volume and the most detailed mixer controls. I'll send patches shortly.
Another interesting fact that I found while looking more into this is that the Audio device PCI SSID on the Carbon is 0x2292 but the codec SSID is 0x2293!
If you have access to an X1 7th gen of some sort (Carbon or Yoga), please post `dmidecode -t system`, `lspci -vnn` and the content of "/proc/asound/card0/codec#0" so that we can better compare in case of different behavior.
participants (4)
-
Benjamin Poirier
-
Jaroslav Kysela
-
Kailang
-
Takashi Iwai