Lenovo IdeaPad Flex 5 14alc05

From ArchWiki

Tango-edit-clear.pngThis article or section does not follow the Laptop page guidelines.Tango-edit-clear.png

Reason: Function keys table needs more XF86 codes (Discuss in Talk:Lenovo IdeaPad Flex 5 14alc05)
Hardware PCI/USB ID Working?
Video 1002:164c Yes
Speakers 1022:15e3 Yes
Microphone Yes
Wireless 8086:2723 Yes
Bluetooth 8087:0029 Yes
Keyboard Yes
Touchpad Yes
Touchscreen Yes
Webcam 5986:212a Yes
Fingerprint sensor 27c6:55b4 No
Pen input Yes
Accelerometer 1022:15e4 No
SD-card reader 10ec:522a Yes

The IdeaPad Flex 5 14alc05 is a 14-inch AMD Lucienne (Ryzen 5000)-based convertible from Lenovo.

Firmware

fwupd does not officially support this device but it can still be used to apply uefi firmware updates.[1]

Updating bios

Warning: Flashing motherboard BIOS is a dangerous activity that can render your motherboard inoperable! While the author of this article has successfully run this procedure, your mileage may vary. Be careful!
Note: Bios settings might be reset, including the boot entry, so make sure you can set up the boot entry for your install after the bios update. See efibootmgr for more information.
Note: The commands fwupdate -l and fwupdate -i may no longer work (error below), but fwupdate -a still works.
(fwupdate:10680): FuPluginUefiCapsule-WARNING **: 12:47:47.256: SMBIOS BIOS Characteristics Extension Byte 2 is invalid -- UEFI Specification is unsupported, but /sys/firmware/efi exists: SMBIOS not supported
Segmentation fault (core dumped)
Note: This article is a copy of the Lenovo IdeaPad Flex 5 14ARE05 BIOS update Guide adapted for this model.

Pre update

Procedure

Run the following commands:

  • Extract the bios .cap file:
$ innoextract file.exe
  • Get the GUID number of your system firmware for the next step. You should get something that looks like example below:
# fwupdate -l
system-firmware type, {e20bafd3-9914-4f4f-9537-3129e090eb3c} version 22315982 can be updated to any version above 22315981
device-firmware type, {e3be8073-66a6-4bf6-966a-c0d58b486c40} version 1 can be updated to any version above 0
device-firmware type, {c85ba1bc-54a7-4aab-9337-eed4746bf09f} version 0 can be updated to any version above 4294967295
  • Schedule the update for the next system reboot, using extracted .cap file:
# fwupdate -a e20bafd3-9914-4f4f-9537-3129e090eb3c /path/to/file.cap
Note: If your ESP path is not located at /boot/efi use --esp-path= to specify path.
  • Verify that the update is pending:
# fwupdate -i
Note: Make sure the device is connected to a power source before rebooting.
  • Reboot if there are no errors and if update is pending.
Warning: Do not interrupt the bios update in any way doing so may result in a bricked device.
Note: During the update the device may beep, turn on and off, and appear unresponsive, this is normal.
  • When the update completes it will boot into the boot menu. At this point it is safe to interact with the device again.

Post update

  • Disable secure boot in the settings to be able to boot into Linux.
  • If your boot loader is not detected, boot into a usb with Arch and use arch-chroot to reinstall your bootloader or use efibootmgr to create a boot entry.

Secure Boot

The BIOS accepts custom Secure Boot keys. To enroll them, you have to use KeyTool from efitools. Follow the guide under Secure Boot#Using KeyTool.

Wireless

The Ideapad Flex 5 14alc05 may come with either Wifi 5 (802.11ac 2x2) or Wifi 6 (802.11ax 2x2), both equipped with Bluetooth 5.0 and connected via M.2 slot (see the PSREF for device specifications). However, Lenovo sources these cards from multiple companies. Depending on the hardware layout, this device may have either an Intel or a Realtek wifi card. Intel wifi cards should work out of the box, reliably and with full performance. Realtek on the other hand does not support Linux, and so Wifi will not work out of the box.

If the card is a Realtek 8852AE or similar, a driver is available as rtw89-dkms-gitAUR.

Note: Bluetooth does not work when using the rtw89 driver on kernel 5.13 or older, and wifi can sometimes be a little underperformant, but it is suitable for daily use.
Tip: This device does not have a networking port, so you will either need a USB to networking port adapter, a USB flash drive to clone the files to from another device, or else compile the driver into the kernel beforehand.

Touchpad/Touchscreen

Sometimes the touchpad and touchscreen will not work after booting due to missing module dependencies, pinctrl_amd is unavailable when the modules for the touchpad/touchscreen get loaded.

To use the touchpad/touchscreen reliably after booting, create the following file:

/etc/modprobe.d/touchpad.conf
softdep hid-multitouch pre: pinctrl_amd
softdep i2c_hid pre: pinctrl_amd
softdep i2c_designware pre: pinctrl_amd
softdep wacom pre: pinctrl_amd

Accelerometer

Since the accelerometer sensor is currently not supported, iio-sensor-proxy will not detect any motion and screen rotation through D-Bus (e.g. with GNOME) is not working.

See https://bbs.archlinux.org/viewtopic.php?pid=1933133#p1933133 and https://bugzilla.kernel.org/show_bug.cgi?id=212615

Power management

(see Lenovo IdeaPad 5 14are05#Power management, similar methods)

System Performance Mode

There are 3 performance modes available: Intelligent Cooling, Extreme Performance and Battery Saving. To set them, you need to call the corresponding ACPI methods.

First install acpi_call (acpi_call-lts for LTS kernel, acpi_call-dkms for other kernels) and load the kernel module:

# modprobe acpi_call

Set it to Battery Saving mode:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001' | tee /proc/acpi/call

Set it to Extreme Performance mode:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001' | tee /proc/acpi/call

Set it to Intelligent Cooling mode:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x000FB001' | tee /proc/acpi/call

To verify your setting:

# echo '\_SB.PCI0.LPC0.EC0.PFMM' | tee /proc/acpi/call
# cat /proc/acpi/call | cut -d '' -f1

where 0x0 stands for Battery Saving, 0x1 for Extreme Performance and 0x2 for Intelligent Cooling.

Battery Conservation

Similarly to #System Performance Mode, make sure you have set up acpi_call.

Turn on:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x03' | tee /proc/acpi/call

Turn off:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x05' | tee /proc/acpi/call

To verify your setting:

# echo '\_SB.PCI0.LPC0.EC0.SMBM' | tee /proc/acpi/call
# cat /proc/acpi/call | cut -d '' -f1

where 0x0 stands for off and 0x1 stands for on. There is also an alternative way to control the conservation mode of the battery.

Rapid Charge

Make sure you have set up acpi_call.

Turn on:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x07' | tee /proc/acpi/call

Turn off:

# echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x08' | tee /proc/acpi/call

To verify your setting:

# echo '\_SB.PCI0.LPC0.EC0.QKCM' | tee /proc/acpi/call
# cat /proc/acpi/call | cut -d '' -f1

where 0x0 stands for off and 0x1 stands for on.

Note however, that this is untested!

Hidden BIOS menu

See https://forums.lenovo.com/topic/findpost/1092/5018261/5262868. You can turn on S3 sleep support.

Issues

Suspend issues (S3 sleep fix) - tested with Bios Version: "G5CN16WW(V1.04)"

Original solution (different Model) is described on reddit.

About issue

Windows has introduced a new sleep mode a.k.a. Modern Standby. It is supposed to be more like a smartphone's deep sleep, which lets the system keep the wifi active and check for emails without needing to fully wake up.

For some reason, this new S0ix sleep mode only works if BIOS does not advertise support for the traditional S3 suspend-to-RAM sleep state. So Linux will do suspend-to-idle sleep, which results in bigger energy consumption.

Some systems have a "Sleep Mode: Windows / Linux" switch in the BIOS to turn S3 support on or off. This is unfortunately not the case for this Lenovo laptop.

Solution

  • Get acpidump and iasl, provided by the acpica package.
  • Dump all your ACPI files into a directory:
$ mkdir ~/acpi/
$ cd ~/acpi/
# acpidump -b
  • Decompile the DSDT table
$ iasl -e *.dat -d dsdt.dat
  • Patch the decompiled DSDT table (dsdt.dsl), using this patch:
$ patch -p1 < dsdt.patch
  • Compile the modified DSDT table
$ iasl -ve -tc dsdt.dsl
$ mkdir -p kernel/firmware/acpi
$ cp dsdt.aml kernel/firmware/acpi
$ find kernel | cpio -H newc --create > acpi_override
  • Copy created cpio file to boot:
# cp acpi_override /boot
  • 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=acpi_override
  • Regenerate the GRUB configuration:
# grub-mkconfig -o /boot/grub/grub.cfg

as a result in the /boot/grub/grub.cfg for the corresponding menu entry(ies) one should be able to find lines that look similar to: initrd /boot/acpi_override

  • Reboot
  • 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]
  • Do not forget to set your system to go into 'deep' sleep
# echo deep > /sys/power/mem_sleep
  • Now try new suspend. Power led should have a slowly pulsing light.

Function keys

Key Visible?1 Marked?2 Effect
Fn+Esc No Yes Toggles Fn lock3
Fn+F1 Yes Yes XF86AudioMute
Fn+F2 Yes Yes XF86AudioLowerVolume
Fn+F3 Yes Yes XF86AudioRaiseVolume
Fn+F4 Yes Yes Mic Mute Toggle
Fn+F5 Yes Yes XF86MonBrightnessDown
Fn+F6 Yes Yes XF86MonBrightnessUp
Fn+F7 Yes Yes Display Extension Mode
Fn+F8 Yes Yes XF86RFKill
Fn+F9 Yes Yes Launch Settings
Fn+F10 Yes Yes Lock Session
Fn+F11 Yes Yes Switch Windows4
Fn+F12 Yes Yes XF86Calculator
Fn+Insert No Yes Lenovo Vantage5
Fn+PrtSc No Yes Screenshot5
Fn+Space No Yes Keyboard Backlight Brightness
Fn+Left Yes Yes Home
Fn+Right Yes Yes End
Fn+Up Yes Yes PageUp
Fn+Down Yes Yes PageDown
  1. The key is visible to xev and similar tools.
  2. The physical key has a symbol on it, which describes its function.
  3. The key has a status indicator LED in it similar to CapsLock
  4. This key behaves like Ctrl+Alt+Tab does on most Desktop Environments
  5. The Lenovo function keys driver provides special functionality for this key on Windows (See https://pcsupport.lenovo.com/de/en/products/laptops-and-netbooks/flex-series/flex-5-14alc05/82hu/82hu002yus/r9137p7f/downloads/driver-list/component?name=Mouse,%20Pen%20and%20Keyboard, under "Lenovo Fn and Function Keys for Windows 10 (64-bit)")

See also