Brightness not working after upgrading to Ubuntu 22.04

I had the same issue with Ubuntu 20.04 but I managed to resolve it with the help found on this forum, but now when I upgraded to 22.04 the same issue happens again.
I guess the Nvidia driver version doesn’t matter but here it is just in case: 515.65.01
Kernel: 5.15.0-46-generic

This is my grub file:

# If you change this file, run 'update-grub' afterward to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia.NVreg_RegistryDwords=EnableBrightnessControl=1 acpi_backlight=vendor amdgpu.backlight=0 acpi_osi=linux"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

I have Legion 5 with Ryzen 7, iGPU is AMD, and the dedicated GPU is Nvidia, currently, I’m on switchable graphics.

ls /sys/class/backlight

amdgpu_bl0  ideapad  nvidia_0

When I use brightness keys then the brightness file in ideapad is updated and this is not reflected on the laptop.
But if I manually edit the brightness file in amdgpu_bl0 then I see the brightness change on the laptop.

I tried changing the acpi_backlight option to video, vendor and native, but neither of those worked.

So my question is how to force the OS/kernel (or whatever) to update amdgpu_bl0 instead of ideapad.

nvidia-bug-report.log.gz (316.0 KB)

If amdgpu_bl0 changes brightness, you have switched to hybrid graphics. In that case you should remove

amdgpu.backlight=0 nvidia.NVreg_RegistryDwords=EnableBrightnessControl=1

from kernel cmdline.
The brightness control is handled by gnome-settings-daemon which picks the backlight device based on assumptions that can’t be overridden, unfortunately.

This is how it looks like now: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor acpi_osi=linux"
but still, the brightness is not working.
Also maybe it’s worth mentioning, I’m using KDE, so I guess I don’t use gnome-settings-daemon

In KDE, power devil is doing the same with the same logic. Since it now uses the (defunct) ideapad handle, maybe raise an issue with the ideapad-laptop module devs.

Reported: Bug #1986990 “Brightness keys on Legion 5 laptop are changing br...” : Bugs : ideapad-laptop

Attaching it here since someone else might benefit from the answers on the Launchpad.