Marc's Public Blog - Linux Hacking


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Diving | Dreamstate | Edc | Electronics | Exercising | Festivals | Flying | Halloween | Hbot | Hiking | Linux | Linuxha | Monuments | Museums | Oshkosh | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



>>> Back to post index <<<

2024/06/24 Linux on Lenovo P17gen2
π 2024-06-24 01:01 in Computers, Linux
I had a forced upgrade from P73 to P17gen2 after my P73 suddenly died, and the upgrade wasn't as seamless as I was hoping for. First, the new laptop did not support SATA M2 anymore, and removed the 2.5" Sata drive slot despite the huge laptop size, so I had to get new drives (all 3 had to be M2 NVME).

I have to admit now that while I've been using debian since 1997 and I'm not super interested in switching again to ubuntu, especially when I already did once, and they honestly sucked and let me down enough that I went back to debian. But in this case, debian didn't support sound right this new laptop, especially sound input (microphone), and it took several days of work painstakenly diffing the latest ubuntu 23 that worked, and debian that did not. Eventually got debian to work though.

P73 (after it died) next to P17gen2
P73 (after it died) next to P17gen2

Intro

You should look at these pages first:
  • My Linux on Thinkpad P70 page has most of the info you need and that is still valid for P73 and P17gen2
  • this explains Upgrading from Sata SSD, to M2 Sata, to M2 NVME on P70
  • How to get the P70 to charge from slimtip adapters it doesn't like
  • By then Lenovo messed up P73 power further and it refused to even use an 20V power unless I built special trickery, so this page helps with getting around power limitations
  • And definitely read this page on Thinkpad P70 vs P73 vs P17
  • Note that as per the last page linked above, I do not recommend getting a P17 if you already have a P73. I found nothing really better in the P17gen2 despite it being 2 years newer. Quite disappointing.

    Power

    That's the biggest issue on this laptop, battery use is way too high, even under windows, and Lenovo could not be bothered to make it work with USB-PD, unlike Dell who did a fine job of that.

    The page with workaround again, but it's very sad I still had to do this for P17 :(

  • By then Lenovo messed up P73 power further and it refused to even use an 20V power unless I built special trickery, so this page helps with getting around power limitations
  • If you want a laptop with a proper power system and 2x the battery life while being also faster, try the Dell XPS 9730 (see review)

    Configs

    If that helps, a few config files ( You also can get them here )

    /etc/pipewire/microphone.conf

    # https://wiki.archlinux.org/title/PipeWire
    context.objects = [
        { factory = adapter
            args = {
                factory.name           = api.alsa.pcm.source
                node.name              = "microphone"
                node.description       = "Lenovo P17 DMIC16kHz"
                media.class            = "Audio/Source"
    # arecord -l
                api.alsa.path          = "hw:0,7"
            }
        }
    ]

    /etc/modprobe.d/thinkpad..conf

    alias char-major-10-170 thinkpad
    alias /dev/thinkpad thinkpad
    alias /dev/thinkpad/thinkpad thinkpad
    alias /dev/thinkpad/smapi smapi
    alias /dev/thinkpad/superio superio
    alias /dev/thinkpad/rtcmosram rtcmosram
    

    # See http://www.thinkwiki.org/wiki/How_to_get_special_keys_to_work options thinkpad_acpi hotkey=0xff8c7ffb experimental=1 fan_control=1

    options thinkpad enable_smapi=1 enable_superio=1 enable_rtcmosram=1 enable_thinkpadpm=1 #http://www.thinkwiki.org/wiki/Tp_smapi options thinkpad_ec force_io=1 # Invert X and Y: https://wiki.archlinux.org/index.php/HDAPS options hdaps invert=1

    options usbcore autosuspend=1

    # http://www.mjmwired.net/kernel/Documentation/sound/alsa/HD-Audio-Models.txt # http://ubuntuforums.org/showthread.php?t=1316634 options snd-hda-intel probe_mask=1 model=thinkpad

    #options iwlwifi 11n_disable=2

    # To prevent applications from using ALSA's OSS emulation and bypassing # PulseAudio (thereby preventing other applications from playing sound), # make sure the module snd_pcm_oss is not being loaded at boot # https://wiki.archlinux.org/index.php/PulseAudio#ALSA blacklist snd_pcm_oss blacklist snd_mixer_oss

    blacklist dvb_usb_rtl28xxu #blacklist snd_hda_codec_hdmi

    # slows down boot blacklist mei_wdt

    # irq 48: nobody cared (try booting with the "irqpoll" option) # [<00000000c1127e5c>] tis_int_handler [tpm_tis_core] blacklist tpm_tis_core

    Sound

    Sounds got complicated, took me a while to understand how sound now works (so changed so many times), and debug it:
    pipewire replaces pulseaudio https://wiki.archlinux.org/title/PipeWire
    helvum is graphical interface, it's pretty but not sure it's useful
    qpwgraph is the same as helvum
    pulseaudio still needed to talk to it.
    

    Check out the linux kernel config options in here if that helps.

    sauron:~$ pactl info Server String: /run/user/500/pulse/native Library Protocol Version: 35 Server Protocol Version: 35 Is Local: yes Client Index: 557 Tile Size: 65472 User Name: merlin Host Name: sauron.svh.merlins.org Server Name: PulseAudio (on PipeWire 0.3.65) Server Version: 15.0.0 Default Sample Specification: float32le 2ch 48000Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.stereo-fallback Default Source: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.stereo-fallback.monitor Cookie: 1ece:0308

    sauron:/etc/modprobe.d# inxi -aA Audio: Device-1: Intel Tiger Lake-H HD Audio vendor: Lenovo driver: sof-audio-pci-intel-tgl alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 00:1f.3 chip-ID: 8086:43c8 class-ID: 0401 Device-2: NVIDIA GA104 High Definition Audio vendor: Lenovo driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:228b class-ID: 0403 API: ALSA v: k6.6.8-amd64-volpre-sysrq-20231218 status: kernel-api with: aoss type: oss-emulator tools: alsamixer,amixer Server-1: PipeWire v: 0.3.65 status: n/a (root, process) with: 1: pipewire-pulse status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl

    ====================== microphone not working ====================== https://forum.endeavouros.com/t/pipewire-pipewire-media-session-vs-wireplumber/20705 wireplumber is new and inevitable, it uses LUA and different config files

    https://wiki.archlinux.org/title/PipeWire /usr/share/wireplumber/main.lua.d/50-alsa-config.lua -- ["api.alsa.use-acp"] = true, => yeah, this kind of works but prevents headphones from working later

    default output is Tiger Lake HD Audio Controller microphone is HD Autdio Controller DMIC 16Khz

    Instead of fixing in wireplugger, fix in pipewire which was not super documented:

    Tried again with /etc/pipewire/microphone.conf after ln -s /usr/share/pipewire /etc/pipewire ---------------------------------------------------------------------------- merlin:/etc/pipewire$ ls -l /etc/pipewire lrwxrwxrwx 1 root root 19 Dec 25 03:37 /etc/pipewire -> /usr/share/pipewire merlin:/etc/pipewire$ cat microphone.conf # https://wiki.archlinux.org/title/PipeWire context.objects = [ { factory = adapter args = { factory.name = api.alsa.pcm.source node.name = "microphone" node.description = "Lenovo P17 DMIC16kHz" media.class = "Audio/Source" # arecord -l api.alsa.path = "hw:0,7" } } ] ----------------------------------------------------------------------------

    then restart: killall pipewire pipewire-pulse (which gets auto restarted)

    changes Audio |- Devices: | 44. GA104 High Definition Audio Controller [alsa] | 45. Tiger Lake-H HD Audio Controller [alsa] | |- Sinks: | * 54. Tiger Lake-H HD Audio Controller Stereo [vol: 0.71] | |- Sink endpoints: | |- Sources: | 55. Tiger Lake-H HD Audio Controller Stereo [vol: 0.61]

    to Audio |- Devices: | 45. Tiger Lake-H HD Audio Controller [alsa:pcm] | 51. GA104 High Definition Audio Controller [alsa:pcm] | |- Sinks: | * 33. Tiger Lake-H HD Audio Controller [vol: 0.89] | 37. GA104 High Definition Audio Controller (HDMI 1) [vol: 1.00] | 38. GA104 High Definition Audio Controller (HDMI 3) [vol: 1.00] | 39. GA104 High Definition Audio Controller (HDMI 2) [vol: 1.00] | 40. GA104 High Definition Audio Controller (HDMI 0) [vol: 1.00] | 363. Tiger Lake-H HD Audio Controller (HDA Analog Deep Buffer (*)) [vol: 1.00] | 366. Tiger Lake-H HD Audio Controller (HDMI3 (*)) [vol: 1.00] | 377. Tiger Lake-H HD Audio Controller (HDMI2 (*)) [vol: 1.00] | 378. Tiger Lake-H HD Audio Controller (HDMI1 (*)) [vol: 1.00] | |- Sink endpoints: | |- Sources: | 364. Tiger Lake-H HD Audio Controller (DMIC16kHz (*)) [vol: 0.61] | 365. Tiger Lake-H HD Audio Controller (DMIC (*)) [vol: 1.00] | * 411. Tiger Lake-H HD Audio Controller [vol: 0.55]

    ubuntu had this instead: Audio Chip: Realtek ALC287 |- Devices: | 44. Tiger Lake-H HD Audio Controller [alsa] | 45. GA104 High Definition Audio Controller [alsa] | |- Sinks: | 46. Tiger Lake-H HD Audio Controller HDMI / DisplayPort 3 Output [vol: 1.00] | 47. Tiger Lake-H HD Audio Controller HDMI / DisplayPort 2 Output [vol: 1.00] | 48. Tiger Lake-H HD Audio Controller HDMI / DisplayPort 1 Output [vol: 1.00] | * 49. Tiger Lake-H HD Audio Controller Speaker + Headphones [vol: 0.40] | |- Sink endpoints: | |- Sources: | 50. Tiger Lake-H HD Audio Controller Headphones Stereo Microphone [vol: 1.00] | * 51. Tiger Lake-H HD Audio Controller Digital Microphone [vol: 1.00]

    sauron:~# lsmod | grep snd snd_seq_dummy 12288 0 snd_hrtimer 12288 1 snd_hda_codec_hdmi 90112 1 snd_hda_codec_realtek 196608 1 snd_hda_codec_generic 110592 1 snd_hda_codec_realtek snd_soc_dmic 12288 1 snd_sof_pci_intel_tgl 12288 2 snd_sof_intel_hda_common 208896 1 snd_sof_pci_intel_tgl snd_sof_intel_hda 24576 1 snd_sof_intel_hda_common snd_sof_pci 24576 2 snd_sof_intel_hda_common,snd_sof_pci_intel_tgl snd_sof_xtensa_dsp 12288 1 snd_sof_intel_hda_common snd_soc_hdac_hda 24576 1 snd_sof_intel_hda_common snd_soc_acpi_intel_match 98304 2 snd_sof_intel_hda_common,snd_sof_pci_intel_tgl snd_soc_acpi 16384 2 snd_soc_acpi_intel_match,snd_sof_intel_hda_common snd_hda_intel 57344 0 soundwire_intel 69632 1 snd_sof_intel_hda_common snd_sof_intel_hda_mlink 40960 2 soundwire_intel,snd_sof_intel_hda_common snd_sof_probes 24576 0 snd_sof 352256 4 snd_sof_pci,snd_sof_intel_hda_common,snd_sof_probes,snd_sof_intel_hda snd_sof_utils 16384 1 snd_sof snd_intel_dspcfg 36864 3 snd_hda_intel,snd_sof,snd_sof_intel_hda_common snd_intel_sdw_acpi 16384 2 snd_sof_intel_hda_common,snd_intel_dspcfg snd_soc_skl_hda_dsp 24576 4 snd_soc_intel_hda_dsp_common 16384 1 snd_soc_skl_hda_dsp snd_hda_codec 217088 8 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek, snd_soc_intel_hda_dsp_common,snd_soc_hdac_hda,snd_sof_intel_hda,snd_soc_skl_hda_dsp snd_hwdep 20480 1 snd_hda_codec snd_soc_hdac_hdmi 45056 1 snd_soc_skl_hda_dsp snd_hda_ext_core 40960 5 snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_ hda_mlink,snd_sof_intel_hda snd_hda_core 147456 11 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core, snd_hda_codec,snd_hda_codec_realtek,snd_soc_intel_hda_dsp_common,snd_sof_intel_hda_common,snd_soc_hdac_hdmi, snd_soc_hdac_hda,snd_sof_intel_hda snd_soc_core 421888 8 soundwire_intel,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi, snd_soc_hdac_hda,snd_sof_probes,snd_soc_dmic,snd_soc_skl_hda_dsp snd_compress 28672 2 snd_soc_core,snd_sof_probes snd_pcm_dmaengine 16384 1 snd_soc_core snd_pcm 192512 13 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof, snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_compress,snd_soc_core,snd_sof_utils,snd_hda_core,snd_pcm_dmaengine snd_seq_midi 20480 0 snd_seq_midi_event 16384 1 snd_seq_midi snd_seq 106496 9 snd_seq_midi,snd_seq_midi_event,snd_seq_dummy snd_timer 53248 3 snd_seq,snd_hrtimer,snd_pcm snd_rawmidi 53248 1 snd_seq_midi snd_seq_device 16384 3 snd_seq,snd_seq_midi,snd_rawmidi snd_ctl_led 24576 0 snd 155648 26 snd_ctl_led,snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep, snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_sof,snd_timer,snd_soc_hdac_hdmi,snd_compress,thinkpad_acpi, snd_soc_core,snd_pcm,snd_rawmidi soundcore 16384 2 snd_ctl_led,snd ledtrig_audio 12288 3 snd_ctl_led,snd_hda_codec_generic,thinkpad_acpi ac97_bus 12288 1 snd_soc_core sauron:~# dmesg | grep snd [ 30.162413] snd_hda_intel 0000:00:1f.3: vgaarb: pci_notify [ 30.162418] snd_hda_intel 0000:00:1f.3: runtime IRQ mapping not provided by arch [ 30.162422] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100 [ 30.162441] snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver [ 30.162444] snd_hda_intel 0000:00:1f.3: vgaarb: pci_notify [ 30.838258] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC287: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker [ 30.853017] snd_hda_codec_realtek ehdaudio0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 30.871445] snd_hda_codec_realtek ehdaudio0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0) [ 30.892281] snd_hda_codec_realtek ehdaudio0D0: mono: mono_out=0x0 [ 30.892292] snd_hda_codec_realtek ehdaudio0D0: inputs: [ 30.892342] snd_hda_codec_realtek ehdaudio0D0: Mic=0x19 [ 30.969586] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten [ 30.977231] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten sauron:~# dmesg | grep firmware [ 2.855848] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/tgl_dmc_ver2_12.bin (v2.12) [ 2.881616] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.1.1.bin version 70.1.1 [ 2.881621] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc_7.9.3.bin version 7.9.3 [ 3.942915] psmouse serio2: trackpoint: Elan TrackPoint firmware: 0x12, buttons: 3/3 [ 29.602566] systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f). [ 30.386592] iwlwifi 0000:09:00.0: loaded firmware version 83.e8f84e98.0 ty-a0-gf-a0-83.ucode op_mode iwlmvm [ 469.044883] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.1.1.bin version 70.1.1 [ 469.044897] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc_7.9.3.bin version 7.9.3 [ 621.435387] iwlwifi 0000:09:00.0: loaded firmware version 83.e8f84e98.0 ty-a0-gf-a0-83.ucode op_mode iwlmvm [ 3319.317148] Bluetooth: hci0: Minimum firmware build 1 week 10 2014 [ 3319.325256] Bluetooth: hci0: Found device firmware: intel/ibt-0041-0041.sfi [ 3320.667073] Bluetooth: hci0: Waiting for firmware download to complete [50195.773603] usb 3-7: device firmware changed [74491.611751] Bluetooth: hci0: Minimum firmware build 1 week 10 2014 [74491.620036] Bluetooth: hci0: Found device firmware: intel/ibt-0041-0041.sfi [74492.962244] Bluetooth: hci0: Waiting for firmware download to complete [86582.232349] iwlwifi 0000:09:00.0: loaded firmware version 83.e8f84e98.0 ty-a0-gf-a0-83.ucode op_mode iwlmvm [87048.949201] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.1.1.bin version 70.1.1 [87048.949215] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc_7.9.3.bin version 7.9.3 [88544.085573] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.1.1.bin version 70.1.1 [88544.085590] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc_7.9.3.bin version 7.9.3 [88711.577697] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.1.1.bin version 70.1.1 [88711.577711] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc_7.9.3.bin version 7.9.3 [88712.922837] Bluetooth: hci0: Minimum firmware build 1 week 10 2014

    See more images for Linux on Lenovo P17gen2

    More pages: July 2002 February 2004 March 2004 November 2004 April 2005 August 2005 January 2006 July 2006 August 2007 November 2007 January 2008 October 2008 November 2008 December 2008 January 2009 May 2009 July 2009 August 2009 September 2009 November 2009 December 2009 January 2010 March 2010 April 2010 June 2010 August 2010 October 2010 January 2011 July 2011 August 2011 December 2011 January 2012 March 2012 May 2012 August 2012 December 2012 January 2013 March 2013 May 2013 September 2013 November 2013 January 2014 March 2014 April 2014 May 2014 October 2014 January 2015 March 2015 May 2015 January 2016 February 2016 June 2016 July 2016 August 2016 October 2016 January 2017 September 2017 January 2018 March 2018 December 2018 January 2019 January 2020 May 2020 January 2021 September 2021 March 2023 April 2023 December 2023 June 2024 November 2024

    >>> Back to post index <<<

    Contact Email