Changing brightness only works after system resumes from sleep

I have a Lenovo Legion Slim 7 laptop (15ACH6) running Manjaro 21.2.4, kernel 5.16.11, hybrid (switchable) graphics mode.

On a clean boot, I cannot change the system brightness, but after putting the system to sleep and then resuming, the brightness controls work just fine (although the brightness level is not preserved).

Contents of /sys/class/backlight:

amdgpu_bl1 -> ../../devices/pci0000:00/0000:00:08.1/0000:05:00.0/backlight/amdgpu_bl1/
nvidia_0 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/backlight/nvidia_0/
nvidia_wmi_ec_backlight -> ../../devices/pci0000:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/603E9613-EF25-4338-A3D0-C46177516DB7/backlight/nvidia_wmi_ec_backlight/

When using Fn keys to change the brightness (or the system slider) the brightness value is written to the nvidia_wmi_ec_backlight/brightness file, the other 2 stay the same.

On kernels < 5.16, the nvidia_wmi_ec_backlight module is not present, and I cannot change the brightness whatsoever.

I am wondering what causes this module to behave correctly only after resuming from sleep. I am suspecting some kind of race condition or improper initialization. What kind of investigation should I do in order to understand this behaviour?

EDIT: It appears that on a clean boot I can control the brightness using the amdgpu_bl1 controller:

echo 50 | sudo tee /sys/class/backlight/amdgpu_bl1/brightness

After resuming from sleep, nvidia_wmi_ec_backlight becomes responsible.

I tried most of the “common” fixes, including setting:


but to no avail.

There are no failed services – sudo systemctl list-units --state failed

0 loaded units listed.

Loaded nVidia kernel modules:

Module                  Size  Used by
nvidia_uvm           2650112  0
nvidia_drm             73728  2
nvidia_modeset       1163264  3 nvidia_drm
nvidia_wmi_ec_backlight    16384  0
nvidia              39133184  99 nvidia_uvm,nvidia_modeset
wmi                    40960  3 nvidia_wmi_ec_backlight,wmi_bmof,ideapad_laptop

Output of mhwd -li:

> Installed PCI configs:
                  NAME           VERSION       FREEDRIVER  TYPE
video-hybrid-amd-nvidia-prime    2021.12.18      false     PCI
           video-linux           2018.05.04      true      PCI

Warning: No installed USB configs!

Output of inxi -Fazy:

  Kernel: 5.16.11-2-MANJARO x86_64 bits: 64 compiler: gcc v: 11.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.16-x86_64
    root=UUID=90ce05e9-c961-4edf-b296-4aa16d8b44cd rw quiet splash apparmor=1
    security=apparmor resume=UUID=821b976f-e987-462e-85df-f4bc737f4dec
  Desktop: GNOME 41.4 tk: GTK 3.24.31 wm: gnome-shell dm: GDM 41.3
    Distro: Manjaro Linux base: Arch Linux
  Type: Laptop System: LENOVO product: 82K8 v: Legion S7 15ACH6
    serial: <superuser required> Chassis: type: 10 v: Legion S7 15ACH6
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: NO DPK serial: <superuser required>
    UEFI: LENOVO v: HACN27WW date: 08/02/2021
  ID-1: BAT0 charge: 68.7 Wh (94.0%) condition: 73.1/71.0 Wh (102.9%)
    volts: 15.4 min: N/A model: LGC L20L4PD3 type: Li-poly serial: <filter>
    status: Discharging cycles: 5
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse MX Master 3
    serial: <filter> charge: 100% (should be ignored) rechargeable: yes
    status: Discharging
  Info: model: AMD Ryzen 9 5900HX with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 3 family: 0x19 (25) model-id: 0x50 (80) stepping: 0
    microcode: 0xA50000C
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 1242 high: 1820 min/max: 1200/4679 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1198 2: 1196
    3: 1310 4: 1820 5: 1197 6: 1197 7: 1196 8: 1196 9: 1197 10: 1196 11: 1197
    12: 1197 13: 1195 14: 1197 15: 1197 16: 1197 bogomips: 105440
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional,
    IBRS_FW, STIBP: always-on, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
  Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] vendor: Lenovo
    driver: nvidia v: 510.54 alternate: nouveau,nvidia_drm pcie: gen: 1
    speed: 2.5 GT/s lanes: 8 link-max: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 01:00.0 chip-ID: 10de:2560 class-ID: 0300
  Device-2: AMD Cezanne vendor: Lenovo driver: amdgpu v: kernel pcie: gen: 3
    speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1
    empty: DP-1,DP-2 bus-ID: 05:00.0 chip-ID: 1002:1638 class-ID: 0300
  Device-3: Syntek Integrated Camera type: USB driver: uvcvideo
    bus-ID: 3-3:2 chip-ID: 174f:2435 class-ID: 0e02
  Display: x11 server: v: compositor: gnome-shell driver: X:
    loaded: amdgpu,ati,nvidia unloaded: modesetting,nouveau,radeon
    alternate: fbdev,nv,vesa gpu: amdgpu display-ID: :1 screens: 1
  Screen-1: 0 s-res: 3840x2160 s-size: <missing: xdpyinfo>
  Monitor-1: eDP res: 3840x2160 hz: 60 dpi: 284 size: 344x194mm (13.5x7.6")
    diag: 395mm (15.5")
  OpenGL: renderer: AMD RENOIR (DRM 3.44.0 5.16.11-2-MANJARO LLVM 13.0.1)
    v: 4.6 Mesa 21.3.7 direct render: Yes
  Device-1: NVIDIA vendor: Lenovo driver: snd_hda_intel v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 8 link-max: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:228e class-ID: 0403
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor
    vendor: Lenovo driver: N/A
    alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x pcie: gen: 3
    speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s bus-ID: 05:00.5
    chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 05:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Sound Server-1: ALSA v: k5.16.11-2-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.20 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.47 running: no
  Device-1: Intel Wi-Fi 6 AX200 vendor: Rivet Networks Killer™
    driver: iwlwifi v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
    bus-ID: 02:00.0 chip-ID: 8086:2723 class-ID: 0280
  IF: wlp2s0 state: up mac: <filter>
  Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 1-3:3
    chip-ID: 8087:0029 class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 4 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
  Local Storage: total: 953.87 GiB used: 167.83 GiB (17.6%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix model: HFS001TDE9X084N
    size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: 41010C22 temp: 32.9 C scheme: GPT
  ID-1: / raw-size: 921.36 GiB size: 905.83 GiB (98.31%)
    used: 167.83 GiB (18.5%) fs: ext4 dev: /dev/nvme0n1p3 maj-min: 259:3
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 288 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 32 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/nvme0n1p2 maj-min: 259:2
  System Temperatures: cpu: N/A mobo: N/A
  Fan Speeds (RPM): N/A
  Processes: 365 Uptime: 19m wakeups: 16 Memory: 30.79 GiB
  used: 4.02 GiB (13.1%) Init: systemd v: 250 tool: systemctl Compilers:
  gcc: 11.2.0 Packages: pacman: 1225 lib: 328 Shell: Zsh v: 5.8.1
  running-in: kitty inxi: 3.3.13

I contacted Daniel Dadap, who for the past week developed a workaround which solved my issues.

You can follow the discussion from the mailing list here: patchwork.kernel[.]org/project/platform-driver-x86/patch/

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.