Skip to content

Instantly share code, notes, and snippets.

@x1unix
Last active March 31, 2024 16:53
Show Gist options
  • Save x1unix/67c154d42aa5c8333f43a69acceff635 to your computer and use it in GitHub Desktop.
Save x1unix/67c154d42aa5c8333f43a69acceff635 to your computer and use it in GitHub Desktop.
Lenovo Legion 5 Backlight Fix

Brief explanation

Linux exposes a special interface to control screen brightness via sysfs in /sys/class/backlight (source). The problem is that in Lenovo Legion 5 there are two modules registered to control screen brightness - AMDGPU and ideapad modules:

$ ls /sys/class/backlight
amdgpu_bl0
ideapad

On boot, GNOME and other DE uses ideapad module to control brightness instead of correct amdgpu_bl0.

This solution is tested in GNOME with Wayland and should work in X11 sessions as well.

Prerequisites

  1. Set Switchable Graphics option in BIOS
  2. Install AMDGPU driver and ensure that it's loaded (lsmod | grep amdgpu)

Steps

  1. Disable backlight sync for ideapad backlight module
sudo systemctl mask systemd-backlight@backlight\:ideapad
  1. Set ACPI backlight type in Linux boot params

GRUB (default option for most distros)

Open /etc/default/grub and modify GRUB_CMDLINE_LINUX_DEFAULT variable:

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
- GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
+ GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noveau.modeset=0 acpi_backlight=native"

Rebuild grub config and initramfs:

sudo update-grub

Other bootloaders (like systemd-boot)

Add noveau.modeset=0 acpi_backlight=native to Linux boot params.

@spectrum70
Copy link

this fix does not work for me (Lgion 5 pro, 16ARX8 using nouveau on arch).
Backlight stays always off.

@x1unix
Copy link
Author

x1unix commented Mar 30, 2024

@spectrum70 I am not using Noveau, also model number is different - 15ARH05H

Also please update the issue here: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/784

@spectrum70
Copy link

ok, sorry, thanks,
well my issue is a bit different, i would use nouveau in ADA LOVELACE, debugging since backlight only works from amdgpu_bl0 (and amd card) but not using nvidia card (nouveau), both ideapad or video0 backlight are not working, screen black.

I am debuggin into the backlight modules now.

@x1unix
Copy link
Author

x1unix commented Mar 31, 2024

@spectrum70 please report your issue here if you’re using GNOME: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment