From: Klemens Nanni Subject: Re: acpithinkpad: don't unmask brightness events on version 2 machines To: Jonathan Matthew , tech@openbsd.org Date: Thu, 22 May 2025 03:01:11 +0000 19.05.2025 11:43, Jonathan Matthew пишет: > On my X13 gen 1, the screen brightness down button sets the screen to > minimum brightness, which is not very pleasant. This turns out to be > because both acpithinkpad(4) and acpivout(4) are processing these events, > even though this is a 'version 2' machine where acpithinkpad declines to > take control of screen brightness. > > The diff below resolves this by only unmasking the brightness up/down > events on version 1 machines. Without these events unmasked, only > acpivout is trying to apply screen brightness changes, and everything > works properly. Sounds reasonable. > Has anyone seen this problem on other thinkpads? Could this change > cause problems anywhere else? On my T14 gen3 Intel the brightness down button, when reaching the lowest setting being 0%, would briefly turn the screen off (expected), but then flip back to the second lowest value. Press down again and it repeats. Repeat a third time and it stays off. I reported that in "brightness down step goes down and up again on T14". https://marc.info/?l=openbsd-bugs&m=169125903009872&w=2 With your diff, none of that weird flipping around the lowest values happens and brightness down/up keys cleanly step through all values. Thanks! > > Index: acpithinkpad.c > =================================================================== > RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v > diff -u -p -r1.74 acpithinkpad.c > --- acpithinkpad.c 7 Jul 2023 07:37:59 -0000 1.74 > +++ acpithinkpad.c 19 May 2025 08:26:54 -0000 > @@ -428,10 +428,11 @@ thinkpad_enable_events(struct acpithinkp > } > > /* Enable events we need to know about */ > - mask |= (THINKPAD_MASK_MIC_MUTE | > - THINKPAD_MASK_BRIGHTNESS_UP | > - THINKPAD_MASK_BRIGHTNESS_DOWN | > - THINKPAD_MASK_KBD_BACKLIGHT); > + mask |= THINKPAD_MASK_MIC_MUTE | > + THINKPAD_MASK_KBD_BACKLIGHT; > + if (sc->sc_hkey_version == THINKPAD_HKEY_VERSION1) > + mask |= THINKPAD_MASK_BRIGHTNESS_UP | > + THINKPAD_MASK_BRIGHTNESS_DOWN; > > DPRINTF(("%s: setting event mask to 0x%llx\n", DEVNAME(sc), mask)); > > OpenBSD 7.7-current (GENERIC.MP) #2: Thu May 22 05:44:21 MSK 2025 kn@atar:/sys/arch/amd64/compile/GENERIC.MP real mem = 51214807040 (48842MB) avail mem = 49635430400 (47336MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 3.4 @ 0x900a3000 (80 entries) bios0: vendor LENOVO version "N3MET23W (1.22 )" date 11/07/2024 bios0: LENOVO 21AHCTO1WW efi0 at bios0: UEFI 2.7 efi0: Lenovo rev 0x1220 acpi0 at bios0: ACPI 6.3 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SSDT SSDT SSDT SSDT SSDT TPM2 HPET APIC MCFG ECDT SSDT SSDT SSDT SSDT SSDT SSDT LPIT WSMT SSDT DBGP DBG2 NHLT MSDM SSDT BATB DMAR SSDT SSDT SSDT ASF! BGRT PHAT UEFI FPDT acpi0: wakeup devices PEG0(S4) PEGP(S4) PEGP(S4) PEG2(S4) PEGP(S4) GLAN(S4) XHCI(S3) XDCI(S4) HDAS(S4) CNVW(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 19200000 Hz acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.32 MHz, 06-9a-03, patch 00000437 cpu0: cpuid 1 edx=bfebfbff ecx=77fafbff cpu0: cpuid 6 eax=df8ff7 ecx=409 cpu0: cpuid 7.0 ebx=239c27eb ecx=98c027ac edx=fc1cc410 cpu0: cpuid a vers=5, gp=6, gpwidth=48, ff=3, ffwidth=48 cpu0: cpuid d.1 eax=f cpu0: cpuid 80000001 edx=2c100800 ecx=121 cpu0: cpuid 80000007 edx=100 cpu0: msr 10a=14c8fd6b cpu0: 48KB 64b/line 12-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line 10-way L2 cache, 18MB 64b/line 12-way L3 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 38MHz cpu0: mwait min=64, max=64, C-substates=0.2.0.2.0.1.0.1, IBE cpu1 at mainbus0: apid 8 (application processor) cpu1: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.33 MHz, 06-9a-03, patch 00000437 cpu1: smt 0, core 4, package 0 cpu2 at mainbus0: apid 16 (application processor) cpu2: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.34 MHz, 06-9a-03, patch 00000437 cpu2: smt 0, core 8, package 0 cpu3 at mainbus0: apid 24 (application processor) cpu3: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.31 MHz, 06-9a-03, patch 00000437 cpu3: smt 0, core 12, package 0 cpu4 at mainbus0: apid 32 (application processor) cpu4: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.18 MHz, 06-9a-03, patch 00000437 cpu4: 32KB 64b/line 8-way D-cache, 64KB 64b/line 8-way I-cache, 2MB 64b/line 16-way L2 cache, 18MB 64b/line 12-way L3 cache cpu4: smt 0, core 16, package 0 cpu5 at mainbus0: apid 34 (application processor) cpu5: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu5: smt 0, core 17, package 0 cpu6 at mainbus0: apid 36 (application processor) cpu6: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu6: smt 0, core 18, package 0 cpu7 at mainbus0: apid 38 (application processor) cpu7: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu7: smt 0, core 19, package 0 cpu8 at mainbus0: apid 40 (application processor) cpu8: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.18 MHz, 06-9a-03, patch 00000437 cpu8: smt 0, core 20, package 0 cpu9 at mainbus0: apid 42 (application processor) cpu9: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu9: smt 0, core 21, package 0 cpu10 at mainbus0: apid 44 (application processor) cpu10: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu10: smt 0, core 22, package 0 cpu11 at mainbus0: apid 46 (application processor) cpu11: 12th Gen Intel(R) Core(TM) i7-1270P, 2095.17 MHz, 06-9a-03, patch 00000437 cpu11: smt 0, core 23, package 0 ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins acpimcfg0 at acpi0 acpimcfg0: addr 0xc0000000, bus 0-255 acpiec0 at acpi0 acpiprt0 at acpi0: bus 0 (PC00) acpiprt1 at acpi0: bus 2 (PEG0) acpiprt2 at acpi0: bus -1 (PEG2) acpiprt3 at acpi0: bus -1 (RP01) acpiprt4 at acpi0: bus -1 (RP02) acpiprt5 at acpi0: bus -1 (RP03) acpiprt6 at acpi0: bus -1 (RP04) acpiprt7 at acpi0: bus -1 (RP05) acpiprt8 at acpi0: bus -1 (RP06) acpiprt9 at acpi0: bus -1 (RP07) acpiprt10 at acpi0: bus -1 (RP08) acpiprt11 at acpi0: bus -1 (RP09) acpiprt12 at acpi0: bus -1 (RP10) acpiprt13 at acpi0: bus -1 (RP11) acpiprt14 at acpi0: bus -1 (RP12) acpiprt15 at acpi0: bus -1 (RP13) acpiprt16 at acpi0: bus -1 (RP14) acpiprt17 at acpi0: bus -1 (RP15) acpiprt18 at acpi0: bus -1 (RP16) acpiprt19 at acpi0: bus -1 (RP17) acpiprt20 at acpi0: bus -1 (RP18) acpiprt21 at acpi0: bus -1 (RP19) acpiprt22 at acpi0: bus -1 (RP20) acpiprt23 at acpi0: bus -1 (RP21) acpiprt24 at acpi0: bus -1 (RP22) acpiprt25 at acpi0: bus -1 (RP23) acpiprt26 at acpi0: bus -1 (RP24) acpiprt27 at acpi0: bus -1 (RP25) acpiprt28 at acpi0: bus -1 (RP26) acpiprt29 at acpi0: bus -1 (RP27) acpiprt30 at acpi0: bus -1 (RP28) acpiprt31 at acpi0: bus 32 (TRP0) acpiprt32 at acpi0: bus 80 (TRP2) acpipci0 at acpi0 PC00: 0x00000000 0x00000011 0x00000001 acpithinkpad0 at acpi0: version 2.0 acpiac0 at acpi0: AC unit offline acpibat0 at acpi0: BAT0 model "5B10W51867" serial 6899 type LiP oem "Sunwoda" "LEN0111" at acpi0 not configured "LEN0100" at acpi0 not configured "INTC1046" at acpi0 not configured "INTC1046" at acpi0 not configured "INTC1046" at acpi0 not configured "INTC1046" at acpi0 not configured "LEN0130" at acpi0 not configured "LEN0071" at acpi0 not configured "LEN030B" at acpi0 not configured "ELAN0676" at acpi0 not configured "ACPI000E" at acpi0 not configured pchgpio0 at acpi0 GPI0 addr 0xfd6e0000/0x10000 0xfd6d0000/0x10000 0xfd6a0000/0x10000 0xfd690000/0x10000 irq 14, 360 pins acpibtn0 at acpi0: SLPB(wakeup) acpicpu0 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu2 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu3 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu4 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu5 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu6 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu7 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu8 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu9 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu10 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS acpicpu11 at acpi0: C3(200@1048 mwait.1@0x60), C2(350@127 mwait.1@0x21), C1(1000@1 mwait.1), PSS "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured intelpmc0 at acpi0: PEPD state 0: 0x7f:1:2:0x00:0x0000000000000060 counter: 0x7f:64:0:0x00:0x0000000000000632 frequency: 0 state 1: 0x7f:1:2:0x00:0x0000000000000060 counter: 0x00:32:0:0x03:0x00000000fe00193c frequency: 8197 "INTC1070" at acpi0 not configured acpibtn1 at acpi0: LID_(wakeup) "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured acpibtn2 at acpi0: PWRB "PNP0C0B" at acpi0 not configured "INTC1041" at acpi0 not configured tpm0 at acpi0 TPM_ 2.0 (TIS) addr 0xfed40000/0x5000, device 0x00fc1050 rev 0x1 "USBC000" at acpi0 not configured acpipwrres0 at acpi0: PXP_, resource for PEG0, PEGP, MINI acpipwrres1 at acpi0: PUBS, resource for XHCI acpipwrres2 at acpi0: WWPR, resource for HS02 acpipwrres3 at acpi0: BTRT acpipwrres4 at acpi0: WRST acpipwrres5 at acpi0: PXP_, resource for RP01 acpipwrres6 at acpi0: TBT0, resource for TDM0, TRP0, TRP1 acpipwrres7 at acpi0: TBT1, resource for TDM1, TRP2, TRP3 acpipwrres8 at acpi0: D3C_, resource for TXHC, TDM0, TDM1, TRP0, TRP1, TRP2, TRP3 acpitz0 at acpi0 acpitz0: critical temperature is 128 degC acpipwrres9 at acpi0: PIN_ acpipwrres10 at acpi0: PINP acpivideo0 at acpi0: GFX0 acpivout0 at acpivideo0: DD1F acpivout1 at acpivideo0: DD2F cpu0: using VERW MDS workaround cpu0: Enhanced SpeedStep 2095 MHz: speeds: 2501, 2500, 2200, 2100, 2000, 1900, 1600, 1500, 1400, 1300, 1100, 1000, 800, 700, 500, 400 MHz pci0 at mainbus0 bus 0 0:31:5: mem address conflict 0xfe010000/0x1000 pchb0 at pci0 dev 0 function 0 "Intel Core 12G Host" rev 0x02 inteldrm0 at pci0 dev 2 function 0 "Intel Graphics" rev 0x0c drm0 at inteldrm0 inteldrm0: msi, ALDERLAKE_P, gen 12 "Intel Core 12G DTT" rev 0x02 at pci0 dev 4 function 0 not configured ppb0 at pci0 dev 6 function 0 "Intel Core 12G PCIE" rev 0x02: msi pci1 at ppb0 bus 2 nvme0 at pci1 dev 0 function 0 "Samsung PM9A1" rev 0x00: msix, NVMe 1.3 nvme0: SAMSUNG MZVL21T0HCLR-00BL7, firmware EL2QGXA7, serial S64PNX0TC18017 scsibus1 at nvme0: 2 targets, initiator 0 sd0 at scsibus1 targ 1 lun 0: sd0: 976762MB, 512 bytes/sector, 2000409264 sectors ppb1 at pci0 dev 7 function 0 "Intel Core 12G PCIE" rev 0x02: msi pci2 at ppb1 bus 32 ppb2 at pci0 dev 7 function 2 "Intel Core 12G PCIE" rev 0x02: msi pci3 at ppb2 bus 80 "Intel Core 12G CL" rev 0x01 at pci0 dev 10 function 0 not configured xhci0 at pci0 dev 13 function 0 "Intel Core 12G xHCI" rev 0x02: msi, xHCI 1.20 usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1 "Intel Core 12G TBT" rev 0x02 at pci0 dev 13 function 2 not configured "Intel Core 12G TBT" rev 0x02 at pci0 dev 13 function 3 not configured xhci1 at pci0 dev 20 function 0 "Intel 600 Series xHCI" rev 0x01: msi, xHCI 1.20 usb1 at xhci1: USB revision 3.0 uhub1 at usb1 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1 "Intel 600 Series SRAM" rev 0x01 at pci0 dev 20 function 2 not configured iwx0 at pci0 dev 20 function 3 "Intel Wi-Fi 6 AX211" rev 0x01, msix dwiic0 at pci0 dev 21 function 0 "Intel 600 Series I2C" rev 0x01: apic 2 int 27 iic0 at dwiic0 ihidev0 at iic0 addr 0x15 irq 56, vendor 0x4f3 product 0x3195, ELAN0676 ihidev0: 92 report ids imt0 at ihidev0: clickpad, 5 contacts wsmouse0 at imt0 mux 0 ims0 at ihidev0 reportid 1: 2 buttons wsmouse1 at ims0 mux 0 hid at ihidev0 reportid 5 not configured hid at ihidev0 reportid 6 not configured hid at ihidev0 reportid 7 not configured hid at ihidev0 reportid 11 not configured hid at ihidev0 reportid 12 not configured hid at ihidev0 reportid 13 not configured ims1 at ihidev0 reportid 14: 0 buttons wsmouse2 at ims1 mux 0 hid at ihidev0 reportid 92 not configured "Intel 600 Series HECI" rev 0x01 at pci0 dev 22 function 0 not configured pcib0 at pci0 dev 31 function 0 "Intel 600 Series eSPI" rev 0x01 azalia0 at pci0 dev 31 function 3 "Intel 600 Series HD Audio" rev 0x01: msi azalia0: codecs: Realtek ALC257 audio0 at azalia0 ichiic0 at pci0 dev 31 function 4 "Intel 600 Series SMBus" rev 0x01: apic 2 int 16 iic1 at ichiic0 spdmem0 at iic1 addr 0x51: 32GB DDR4 SDRAM PC4-25600 SO-DIMM "Intel 600 Series SPI" rev 0x01 at pci0 dev 31 function 5 not configured em0 at pci0 dev 31 function 6 "Intel I219-LM" rev 0x01: msi, address e8:80:88:56:d3:d2 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 irq 1 irq 12 pckbd0 at pckbc0 (kbd slot) wskbd0 at pckbd0: console keyboard pms0 at pckbc0 (aux slot) wsmouse3 at pms0 mux 0 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT efifb at mainbus0 not configured uhidev0 at uhub1 port 1 configuration 1 interface 0 "Logitech USB Receiver" rev 2.00/30.00 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 16 buttons, Z and W dir wsmouse4 at ums0 mux 0 uhidev1 at uhub1 port 1 configuration 1 interface 1 "Logitech USB Receiver" rev 2.00/30.00 addr 2 uhidev1: iclass 3/0, 17 report ids uhidpp0 at uhidev1 device 1 mouse "M350" ucc0 at uhidev1 reportid 3: 652 usages, 20 keys, array wskbd1 at ucc0 mux 1 uvideo0 at uhub1 port 4 configuration 1 interface 0 "8SSC21D67422V1SR2C104ZJ Integrated RGB Camera" rev 2.01/10.21 addr 3 video0 at uvideo0 uvideo1 at uhub1 port 4 configuration 1 interface 2 "8SSC21D67422V1SR2C104ZJ Integrated RGB Camera" rev 2.01/10.21 addr 3 video1 at uvideo1 ugen0 at uhub1 port 4 configuration 1 "8SSC21D67422V1SR2C104ZJ Integrated RGB Camera" rev 2.01/10.21 addr 3 ugen1 at uhub1 port 10 "Intel Bluetooth" rev 2.01/0.00 addr 4 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets sd1 at scsibus3 targ 1 lun 0: sd1: 511999MB, 512 bytes/sector, 1048575472 sectors root on sd1a (2b22b08ec9273d80.a) swap on sd1b dump on sd1b inteldrm0: 1920x1200, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0 wskbd1: connecting to wsdisplay0 wsdisplay0: screen 1-5 added (std, vt100 emulation) iwx0: hw rev 0x370, fw 77.f92b5fed.0, pnvm ce1a5094, address a0:29:42:f6:8f:1a drm:pid93457:drm_atomic_helper_wait_for_flip_done *ERROR* [drm] *ERROR* [CRTC:82:pipe A] flip_done timed out drm:pid93457:intel_dsb_wait *ERROR* [drm] *ERROR* [CRTC:82:pipe A] DSB 1 timed out waiting for idle (current head=0xfedb4000, head=0x0, tail=0x1080)