Bug 253900 - Lenovo X1 Carbon 7th Generation requires quirk for proper sound
Summary: Lenovo X1 Carbon 7th Generation requires quirk for proper sound
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-multimedia (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-27 21:38 UTC by Ed Maste
Modified: 2022-07-30 04:26 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2021-02-27 21:38:51 UTC
By default sound on the X1 Carbon 7th Generation is quiet and tinny. It turns out the laptop has two sets of speakers on the top and bottom. The bottom-facing speakers provide more volume and bass.

By default the top and bottom speakers are connected to different DACs, and nothing goes to the DAC connected to the bottom speakers (nid 3).

## Top speakers
dev.hdaa.0.nid20_original: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0001)
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

## Bottom bass speakers
dev.hdaa.0.nid23_original: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid23_config: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid23: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0002)
        Pin cap: 0x0000001c PDC HP OUT
     Pin config: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 3
          + [DISABLED] <- nid=2 [audio output]
          + <- nid=3 [audio output] (selected)
          + [DISABLED] <- nid=6 [audio output] [DISABLED]

References:

- jcs OpenBSD on the Lenovo ThinkPad X1 Carbon (7th Gen) https://jcs.org/2019/08/14/x1c7
  - quirk commit https://github.com/openbsd/src/commit/b4db693dac78b3ae76ca949aac545468758883b4
- Linux bug https://bugzilla.kernel.org/show_bug.cgi?id=207407
- Linux commits
  - 6a6660d049f88b89fd9a4b9db3581b245f7782fa
  - 9774dc218bb628974dcbc76412f970e9258e5f27
  - c37c0ab029569a75fd180edb03d411e7a28a936f
  - 54a6a7dc107da0492a9e84fd7e9a107b3c58138d
  - d2cd795c4ece1a24fda170c35eeb4f17d9826cbb
Comment 1 Taka 2022-02-03 10:56:04 UTC
I have also this problem on a X1 Nano. Any progress?
Comment 2 Jonathan Vasquez 2022-07-29 16:38:14 UTC
This is also affecting me on 13.1-STABLE (makes sense though since CURRENT is also affected). I'm trying to see if there are any hints I can tweak to get this working. For my gen7, both of the speakers are already part of the same association. Headphones also work properly as it's part of the same set by default after patching.

hdaa0: Original pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 18 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 19 40000000 0  0  Line-out      None  Unknown 0x00       Unknown 0
hdaa0: 20 90170110 1  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 23 90170111 1  1  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0: 24 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 25 04a11040 4  0  Mic           Jack  1/8     Right      Black   0
hdaa0: 26 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 27 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 29 40600001 0  1  Modem-line    None  Unknown 0x00       Unknown 0
hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
hdaa0: 33 04211020 2  0  Headphones    Jack  1/8     Right      Black   0

hdaa0: Patching widget caps nid=29 0x00400400 -> 0x00700400
hdaa0: Patching pin config nid=33 0x04211020 -> 0x0321101f

hdaa0: Patched pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 18 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 19 40000000 0  0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa0: 20 90170110 1  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 23 90170111 1  1  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0: 24 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 25 04a11040 4  0  Mic           Jack  1/8     Right      Black   0
hdaa0: 26 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 27 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0: 33 0321101f 1  15 Headphones    Jack  1/8     Left       Black   0

dev.hdaa.0.nid20_original: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0001)
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.0.nid23_original: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid23_config: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid23: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0002)
        Pin cap: 0x0000001c PDC HP OUT
     Pin config: 0x90170111 as=1 seq=1 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 3
          + [DISABLED] <- nid=2 [audio output]
          + <- nid=3 [audio output] (selected)
          + [DISABLED] <- nid=6 [audio output] [DISABLED]
Comment 3 Jonathan Vasquez 2022-07-29 18:33:45 UTC
For now I've added the following quirk to my /boot/loader.conf to invert the top and bottom speakers (preferring the bottom louder one). The issue is still there so with this configuration the bottom will be the one actually outputting content rather than the top one. The headphones will continue to work as usual:

# Prefer bottom louder speakers over top speakers (for now).
# NOTE: The nid20 speakers won't work with this configuration but
# it will at least hide them from audio selection.
hint.hdaa.0.nid23.config="as=1 seq=0"
hint.hdaa.0.nid20.config="as=1 seq=1"
hint.hdaa.0.nid33.config="as=1 seq=15"
Comment 4 Taka 2022-07-30 04:26:05 UTC
Where is the patch?