From: Jonathan Matthew Subject: Re: acpithinkpad: don't unmask brightness events on version 2 machines To: Mark Kettenis Cc: tech@openbsd.org, lucas@sexy.is Date: Fri, 23 May 2025 14:26:56 +1000 On Thu, May 22, 2025 at 02:37:05PM +0200, Mark Kettenis wrote: > > Date: Thu, 22 May 2025 18:51:22 +1000 > > From: Jonathan Matthew > > > > On Thu, May 22, 2025 at 06:06:48AM +0000, Lucas Gabriel Vuotto wrote: > > > On Thu, May 22, 2025 at 04:18:37AM +0000, Lucas Gabriel Vuotto wrote: > > > > Not the same problem, but problems nevertheless. Quoting > > > > https://marc.info/?l=openbsd-misc&m=168377287112603&w=2 > > > > > > > > > Suspend and hibernate works. Lidaction works. Internal mic doesn't work > > > > > but audio recording does work with a headset. Webcam works. vmm works. > > > > > > > > > > Turning down the screen brightness with the keyboard does turn the whole > > > > > screen black for an instant when getting at low values: > > > > > > > > > > display.brightness=100.00% > > > > > display.brightness=75.39% > > > > > display.brightness=57.13% > > > > > display.brightness=42.46% > > > > > display.brightness=32.14% > > > > > display.brightness=23.41% > > > > > display.brightness=17.06% > > > > > display.brightness=12.30% > > > > > display.brightness=8.72% > > > > > display.brightness=5.95% > > > > > display.brightness=4.76% > > > > > display.brightness=3.97% # single black screen blink starts here > > > > > display.brightness=2.77% > > > > > display.brightness=1.98% > > > > > display.brightness=0.79% > > > > > display.brightness=0.00% > > > > > > > > That went away with this patch. As a nice side-effect, my screen doesn't > > > > jump to full brightness the very first time I use any brightness button > > > > and I have more brightness levels: > > > > > > Actually, now my laptop jumps to full brightness everytime I connect or > > > disconnect the AC. > > > > Interesting, mine jumps to very low brightness when I connect or disconnect > > the AC. I'm not sure where those brightness changes come from. > > I wonder if instead of disabling the acpithinkpad(4) brightness button > events, we should disable the acpivout(4) based brightness control > functionality on these machines. > > Or perhaps there is more acpithinkpad(4) functionality that needs to > be disabled on these machines. > > You really need to understand all the moving parts to work on this... My understanding is that on laptops since Windows 8, we're not supposed to use any ACPI based backlight control, but instead use the backlight control provided by inteldrm/amdgpu. jsg@ added this to acpivout(4) a few years ago. The backlight control in acpithinkpad(4) is entirely ACPI based, so we should avoid having it involved in this process on newer machines, which is what my diff does. The brightness changes on AC power events turn out to be from the inteldrm opregion code - the display controller updates some state and then generates an interrupt to tell the driver to change the backlight level. We're supposed to ignore this when we're using native backlight control, but the code that does this is under #ifdef __linux__ - see asle_set_backlight() in src/sys/dev/pci/drm/i915/display/intel_opregion.c. Adding a stub acpi_video_get_backlight_type() makes the brightness changes stop.