Lenovo ThinkPad X1 Yoga (Gen 3)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Hardware PCI/USB ID Working?
Touchpad (I2C) Yes
TrackPoint (I2C) Yes
Touchscreen 056a:5144 (?) Yes
Pen 056a:5146 Yes
Keyboard Yes
GPU 8086:5917 Yes
Webcam 04f2:b61e Yes
Ethernet 8086:15d7 Yes
Bluetooth 8087:0a2b Yes
MicroSD card slot 0bda:0328 Yes
Audio 8086:9d71 Yes
Wireless 8086:24fd Yes
Mobile broadband 8086:7360 (PCI mode)
2cb7:0007 (USB mode)
Yes, in USB mode
See #Mobile broadband
Fingerprint Reader 06cb:009a Yes

The Lenovo ThinkPad X1 Yoga, 3th generation (X1Y3) is a 2-in-1 convertible laptop introduced in 2018. There are several different models (20ld, 20le, 20lf, 20lg). Its design is closely related to the Lenovo ThinkPad X1 Carbon (Gen 6). It features a 14" screen, 8th-gen Intel Core processors (Kaby Lake), an integrated stylus, and integrated Intel UHD 620 graphics.

To ensure you have this version, install the package dmidecode and run:

# dmidecode -s system-version
ThinkPad X1 Yoga 3rd

Firmware

Several linux users reported their systems were bricked after enabling "Thunderbolt BIOS assist" in the UEFI menu. Lenovo has released BIOS version 1.27 which prevents this issue. See this thread on the Lenovo forums for details.

Under BIOS version 1.24 the embedded controller will no longer spin the fan up properly during high system load causing CPU throttling issues. Reverting to version 1.21 will restore normal functions or you can use the ThinkFanAUR package to control it via the OS. See Fan speed control#ThinkPad laptops for details.

Updates

In August of 2018 Lenovo has joined the Linux Vendor Firmware Service (LVFS) project, which enables firmware updates from within the OS. BIOS updates (and possibly other firmware such as the Thunderbolt controller) can be queried for and installed through fwupd.

Manual

Download the latest BIOS image from the Lenovo Thinkpad X1 Yoga 3rd Gen downloads page. Obtain geteltoritoAUR and run geteltorito.pl -o bios-update.img xxxxxxxx.iso on the downloaded ISO file to create a valid El Torito image file, then flash this file on a USB drive via dd like you would flash Arch installation media. For further information see flashing BIOS from Linux.

The ThinkPad X1 Yoga supports setting a custom splash image at the earliest boot stage (instead of the red "Lenovo" logo), more information can be found in the README.TXT located in the FLASH folder of the update image.

Mobile broadband

Fibocom L850-GL works after turning it into USB mode with https://github.com/xmm7360/xmm7360-usb-modeswitch.

Install the acpi_call-dkms kernel module, then run the xmm2usb tool as root, then wait a few seconds for the USB modem to come up.

Power management

To check whether S3 is recognized and usable by Linux, run:

 # dmesg | grep -i "acpi: (supports"

and check for S3 in the list.

Enabling S3 (with BIOS version 1.33 and after)

Since of May 17, 2019, Lenovo released firmware 1.33, which let you enable legacy S3 sleep in UEFI/BIOS. You can find the option in ThinkPad Setup: Config -> Power and disable the option "Optimized Sleep State for Modern Standby".

Optimized Sleep State for Modern Standby (after BIOS 1.35 the wording has changed to "Sleep State"):

  • Disabled: "legacy" S3 sleep (after BIOS 1.35 the wording has changed to "Linux")
  • Enabled: modern standby (after BIOS 1.35 the wording has changed to "Windows 10")

By setting this option to "Disabled", a warning will appear. The warning describes that a reinstallation of your OS might be mandatory. Accept the warning and both Windows and Linux should work fine. You can do this step even if you already installed a patch to enable s3 sleep. After disabling the optimized sleep state in the bios, and if you did the method to enable s3 sleep before the 1.33 bios update, it is best to remove GRUB_EARLY_INITRD_LINUX_CUSTOM="/acpi_override" in your /etc/default/grub (if you placed that there before), and regenerate the grub cfg using sudo update-grub. Do not forget to remove the acpi_override file as well.

Reboot and verify whether S3 is working by running:

 # dmesg | grep -i "acpi: (supports"

You should now see something like this:

 [    0.230796] ACPI: (supports S0 S3 S4 S5)

Enabling S3 (before BIOS version 1.33)

There is an automated script called x1carbon2018s3 by fiji-flo that was originally intended for use for the X1 Carbon 6th Gen (source). The script and documentation were updated and maintained by lsmith77 to adapt it for the X1 Yoga 3rd Gen. The latest known version is in a fork by ryankhart currently awaiting a pull request. These scripts are recommended for debian-based distributions because of the script including debian-based bash commands.

(Optional) To check out this script and its history, visit these GitHub repositories:

Manual method

The manual method can be used in any distribution of Linux. Below is a modified version of the source instructions because some things are hard to understand.

1. Reboot, enter BIOS/UEFI. Go to Config - Thunderbolt (TM) 3 - set Thunderbolt BIOS Assist Mode to Enabled. Set also Security - Secure Boot to Disabled.

2. Install iasl (Intel's compiler/decompiler for ACPI machine language) and cpio. iasl in Ubuntu and possibly other distributions probably do not have the latest release for it to fully work. To make sure you have the latest version, download the source code and make install iasl. cpio can be installed normally with your distribution's package manager

3. Get a dump of ACPI DSDT table: cat /sys/firmware/acpi/tables/DSDT > dsdt.aml

4. Decompile the dump, which will generate a .dsl source based on the .aml ACPI machine language dump: iasl -d dsdt.aml

5. Download the [patch](https://kernel.dk/acpi.patch) and apply it against dsdt.dsl: patch --verbose < acpi.patch

Hunk 2 failed for me, I manually looked for the following in dsdt.dsl:

   Name (SS1, 0x00)
   Name (SS2, 0x00)
   Name (SS3, One)
   One
   Name (SS4, One)
   One

and replaced it with the following (removing the two "One" lines):

   Name (SS1, 0x00)
   Name (SS2, 0x00)
   Name (SS3, One)
   Name (SS4, One)

6. Recompile your patched version of the .dsl source: iasl -ve -tc dsdt.dsl

7. Create a CPIO archive with the correct structure, which GRUB can load on boot. We name the final image acpi_override and copy it into /boot/:

 mkdir -p kernel/firmware/acpi
 cp dsdt.aml kernel/firmware/acpi
 find kernel | cpio -H newc --create > acpi_override
 cp acpi_override /boot

8. GRUB needs to boot the kernel with a parameter setting the deep sleep state as default. Edit /etc/default/grub and add the following:

 GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
 GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"

9. Regenerate the GRUB configuration: sudo update-grub

If the second line of the previous step does not generate the grub to make the initrd lines look like "initrd /boot/acpi_override" in the beginning, then follow the next steps as normal. If it does generate those lines, skip to step 11


10. Tell GRUB to load the new DSDT table on boot in its configuration file usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry and add the new image /boot/acpi_override to the initrd lines for the images that you want the s3 sleep to work in:

 Before:
 initrd /initramfs-4.17.4-200.fc28.x86_64.img
 
 After:
 initrd /boot/acpi_override /initramfs-4.17.4-200.fc28.x86_64.img

11. Reboot and enjoy having a laptop running Linux again... close the lid and the battery does not get drained in a few hours, also the battery no longer stays warm in sleep mode. To verify that things are working:

 # dmesg | grep ACPI | grep supports
 #[    0.195933] ACPI: (supports S0 S3 S4 S5)
 
  cat /sys/power/mem_sleep
 #s2idle [deep]

Fix touchscreen after resume

The X1Y3 has a firmware bug where the touchscreen may not come up again after waking up from S3 suspend/resume.

The following fixes were pulled from: Lenovo Linux Forums

Using acpi_call

This method is preferable because it does not require disabling functionality of the laptop or tinkering with the power management, such as replacing S3 power management by something else such as s2idle.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Not sure the line about acpi_call being abandoned is true. https://github.com/mkottman/acpi_call is definitely abandoned, but the PKGBUILD for acpi_call appears to use acpi_call-dkms to build the package, as evident by the same package versions for both acpi_call-dkms and acpi_call (1.2.2 as of writing). If anything, the upstream URL for acpi_call appears to be outdated; it should probably be updated to https://github.com/nix-community/acpi_call (similarly for acpi_call-lts). See FS#72922. (Discuss in Talk:Lenovo ThinkPad X1 Yoga (Gen 3))

1. Install and enable the acpi_call-dkms kernel module (this is actively maintained and therefore preferable over acpi_call, which has been abandoned since 2013).

2. Add the following SystemD service:

/etc/systemd/system/activate-touch-hack.service
[Unit]
Description=Touch wake Thinkpad X1 Yoga 3rd gen hack
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

[Service]
ExecStart=/bin/sh -c "echo '\\_SB.PCI0.LPCB.EC._Q2A'  > /proc/acpi/call"

[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

3. Enable activate-touch-hack.service.

Disabling Thunderbolt

Some users have reported that disabling Thunderbolt in BIOS -> Security -> IO ports -> Thunderbolt permanently fixes the touchscreen issue. As a consequence, docking stations may have some features disabled.

Using s2idle

Note: This method works with S3 suspend, but requires it to be enabled in a very specific way:

1. Select Sleep State->Windows 10 in bios. This by default will enable s2idle.

/sys/power/mem_sleep
[s2idle] deep

2. To change default to S3 (deep), append mem_sleep_default=deep to the kernel boot line.

3. Reboot and make sure deep is default.

/sys/power/mem_sleep
s2idle [deep]

When S3 suspend is enabled, the touchscreen will not work upon resume from sleep. The touchscreen functionality can be restored by freezing the system (s2idle) after system comes out of suspend.

Method 1 - calling a script from systemd-sleep

1. Create a script to be called by systemd-sleep

/usr/lib/systemd/system-sleep/wacom
#!/bin/sh

case "$1" in
    post)
        rtcwake -m freeze -s 1
        ;;
esac

2. Make sure the executable permissions are set

# chmod a+x /usr/lib/systemd/system-sleep/wacom
Method 2 - systemd service

1. Create a systemd system service file to force the system to enter freeze momentarily

/etc/systemd/system/wake_wacom_hack.service
[Unit]
Description= s2idle for 1 second after resume
After=suspend.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/rtcwake -m freeze -s 1

[Install]
WantedBy=suspend.target

2. Enable wake_wacom_hack.service.

Other fixes

Some users have reported one or two of these temporary fixes to work for them:

  • Quickly close and open the lid to enable sleep.
  • Use the power button (instead of/before opening the lid) to resume from sleep.

Enabling S2idle

Note: Since kernel version 4.18 acpi.ec_no_wakeup=1 is set by default

From the Lenovo forums: Add the following kernel parameter to enable S2idle support:

 acpi.ec_no_wakeup=1

For example, for GRUB, one might edit /etc/default/grub and edit GRUB_CMDLINE_LINUX_DEFAULT:

 GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi.ec_no_wakeup=1"

then perform

 # update-grub

and restart the system.

Note: This supports only S2idle state, not S0i3 state as some seem to have been led to believe!

The power consumption might still be higher than that of the S3 state in this case.

Fingerprint reader

Install the python-validity-gitAUR package.

Touchscreen ghost touches

Some Thinkpad X1Y3 touchscreens are affected by a hardware issue that manifests itself as "ghost touch" events along the outer edges of the screen. On X11, with the xf86-input-wacom driver installed, it's possible to work around this by configuring the tablet driver to ignore touch events in the outermost row of pixels.

First, use xsetwacom to show the sensors (touch, stylus etc.) supported by the touchscreen:

# xsetwacom list devices
Wacom Pen and multitouch sensor Finger touch    id: 9   type: TOUCH     
Wacom Pen and multitouch sensor Pen stylus      id: 10  type: STYLUS    
Wacom Pen and multitouch sensor Pen eraser      id: 18  type: ERASER

Note down the ID of the TOUCH sensor, then check the active area of the touchscreen:

# xsetwacom get 9 Area
0 0 12373 6961

Now configure the Area parameter by moving all edges inward by 1:

# xsetwacom set 9 Area 1 1 12372 6960

If you are still getting ghost clicks, they might be from the stylus tool, in that case repeat the operation with the stylus ID:

# xsetwacom get 10 Area
0 0 30935 17401
# xsetwacom set 10 Area 1 1 30934 17400

Function keys

Key Visible?1 Marked?2 Effect
Fn+Esc No Yes Enables Fn lock
Fn Yes Yes XF86WakeUp
Fn+F1 Yes Yes XF86AudioMute
Fn+F2 Yes Yes XF86AudioLowerVolume
Fn+F3 Yes Yes XF86AudioRaiseVolume
Fn+F4 Yes Yes XF86AudioMicMute
Fn+F5 Yes Yes XF86MonBrightnessDown
Fn+F6 Yes Yes XF86MonBrightnessUp
Fn+F7 Yes Yes XF86Display
Fn+F8 Yes Yes XF86WLAN
Fn+F9 Yes Yes XF86Tools
Fn+F10 Yes Yes XF86Bluetooth
Fn+F11 No Yes Unknown
Fn+F12 Yes Yes XF86Favorites
Fn+B Yes No Break
Fn+K Yes No ScrollLock
Fn+P Yes No Pause
Fn+S Yes No SysRq
Fn+Left Arrow Yes No Home
Fn+Right Arrow Yes No End
Fn+Space No Yes Toggle Keyboard Backlight
  1. The key is visible to xev and similar tools.
  2. The physical key has a symbol on it, which describes its function.

See also