Created attachment 194370 [details] Support newer thinkpads with LEN0268 id The attached patch adds support for newer Thinkpad models. The patch has been tested on a Thinkpad T480, but should work on other models as well.
I tried this patch on my T480 running r336962. I have not tried the event handling, but the sysctl variables do not seem to report reality (mute, lcd_brightness, thinklight etc...)
- Thinklight is reported by the firmware to be present, but turning it on does nothing, probably is a reminiscence of old good Thinkpads! BTW, it behaves the same under Linux. - lcd_brightness is assumed to be controllable by the driver (the patch does not change that). For instance it fails already to control the brightness on my corebooted x230. This can be adjusted. - Sound mute works fine for me. However, mic mute does not mute the microphone, it does only turn on its led. On Linux, if you mute the microphone via the sound card driver, it checks if there is a thinkpad_set_led registered function (by the thinkpad_acpi), and it does turn off/on the mic led for you. Event handling works fine for me. The acpi_ibm driver is clearly unmaintained on FreeBSD. I can make a lot of improvements to it, but unfortunately I have no access to its repository, and going with patches takes ages...
Improvements are most welcome, and yeah, we're a bit slow on the tickets thing, I'll try to keep an eye on it though, seeing that I have a T480 now :-)
Hi Ali, FYI, I included your patch on top of stable/12 and rololed out this kernel on my T480. You can see what I rolled out at https://github.com/rebost/freebsd/tree/feature/acpi_ibm https://github.com/freebsd/freebsd/compare/stable/12...rebost:feature/acpi_ibm?expand=1#diff-6fc15f69014ba3e0dabd0b064d3f592e Sadly, both Fn buttons and sysctl modification via console have no effect. Neither are the values reported by sysctl dev.acpi_ibm correct If there is anything I can do to help you fix this, just let me know. Thanks for what you have already done. All the best, -- matías mpizarro@lenovo01:/usr/src $ sudo sysctl dev.acpi_ibm dev.acpi_ibm.0.handlerevents: NONE dev.acpi_ibm.0.mic_led: 0 dev.acpi_ibm.0.fan: 1 dev.acpi_ibm.0.fan_level: 0 dev.acpi_ibm.0.fan_speed: 0 dev.acpi_ibm.0.wlan: 1 dev.acpi_ibm.0.bluetooth: 0 dev.acpi_ibm.0.thinklight: 0 dev.acpi_ibm.0.mute: 0 dev.acpi_ibm.0.volume: 0 dev.acpi_ibm.0.lcd_brightness: 0 dev.acpi_ibm.0.hotkey: 2 dev.acpi_ibm.0.eventmask: -5 dev.acpi_ibm.0.events: 1 dev.acpi_ibm.0.availmask: 4294967291 dev.acpi_ibm.0.initialmask: 2056 dev.acpi_ibm.0.%parent: acpi0 dev.acpi_ibm.0.%pnpinfo: _HID=LEN0268 _UID=0 dev.acpi_ibm.0.%location: handle=\_SB_.PCI0.LPCB.EC__.HKEY dev.acpi_ibm.0.%driver: acpi_ibm dev.acpi_ibm.0.%desc: IBM ThinkPad ACPI Extras mpizarro@lenovo01:/usr/src $ sudo sysctl dev.acpi_ibm.0.thinklight=1 dev.acpi_ibm.0.thinklight: 0 -> 0 mpizarro@lenovo01:/usr/src $ sudo sysctl dev.acpi_ibm.0.lcd_brightness=7 dev.acpi_ibm.0.lcd_brightness: 6 -> 7 mpizarro@lenovo01:/usr/src $ sudo sysctl dev.acpi_ibm.0.lcd_brightness=8 dev.acpi_ibm.0.lcd_brightness: 7 sysctl: dev.acpi_ibm.0.lcd_brightness=8: Invalid argument
Hi Matías, The Fn buttons never changed the brightness automatically (even on old already supported Thinkpad models), instead it sends a userspace event to devctl, that is populated by devd. The user typically runs a devd action to change the brightness, and my patch does not change that, see man(4) acpi_ibm. Instead, with the patch applied now you get devd events for FN-brightness up/down. !system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x10 !system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11 then you can, via a devd action, change the brightness using for example hw.acpi.video.lcd0.brightness. Other keys, which did not work without the patch, now send devd events, such as FN-Wireless, FN-Mic. For the brightness part, yes I think something should be done to make the dev.acpi_ibm.0.lcd_brightness syscalls work again, will post here any progress.
Hi Ali, Thanks for the clarifications and all your great work, that's definitely something I can build upon.
Hi, I applied your patch to CURRENT (r342776) on a T480. - The Fn + keys from F4 to F12, TAB, p, 4 and MENU send events to devd. - dev.acpi_ibm.0.mute state reflects the state of F1 LED - dev.acpi_ibm.0.fan can actually be used to turn the fan on and off - dev.acpi_ibm.0.fan_speed seems to be measuring fan speed correctly - dev.acpi_ibm.0.mic_led works as you described. Thanks for your work, let me know if I can help with this patch in any way.
Hi Ali - I've applied on a ThinkPad X1 Yoga 2nd gen on 12 RELEASE. Can confirm the same information as Bojan. Awesome work ! Happy to test more as you go along. -dcasati
(In reply to Ali Abdallah from comment #2) > The acpi_ibm driver is clearly unmaintained on FreeBSD. I can make a lot of > improvements to it, but unfortunately I have no access to its repository, and > going with patches takes ages... Unfortunately, most if not all acpi_XXX(4) drivers are unmaintained; FreeBSD definitely needs people like you to help in this area, one of our weakest. Going with patches (if they are good) would only last until you'd be punished with commit bit for your great work. :-) Until then, I'm sure existing src committers would gladly help to expedite your patches.
Hi Ali - I've applied this patch on 12 STABLE r346130 running on a T480s. Can confirm the same information as Bojan. -xanderio
After a bit more testing it seem that fn-f5 (backlight lower) and fn-f12 (star) send the same notify to devd. backlight lower: Processing event '!system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11' setting *=!system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11 setting _=system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11 setting subsystem=IBM Testing subsystem=IBM against ^ACAD$, invert=0 Testing subsystem=IBM against ^Thermal$, invert=0 Testing subsystem=IBM against ^Suspend$, invert=0 Testing subsystem=IBM against ^Resume$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0 star: Processing event '!system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11' setting *=!system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11 setting _=system=ACPI subsystem=IBM type=\_SB_.PCI0.LPCB.EC__.HKEY notify=0x11 setting subsystem=IBM Testing subsystem=IBM against ^ACAD$, invert=0 Testing subsystem=IBM against ^Thermal$, invert=0 Testing subsystem=IBM against ^Suspend$, invert=0 Testing subsystem=IBM against ^Resume$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0 Testing subsystem=IBM against ^ASUS-Eee$, invert=0
A commit references this bug: Author: gonzo Date: Wed Apr 24 23:10:20 UTC 2019 New revision: 346647 URL: https://svnweb.freebsd.org/changeset/base/346647 Log: [acpi_ibm] Add support for newer Thinkpad models Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah <aliovx@gmail.com> MFC after: 1 week Changes: head/sys/dev/acpi_support/acpi_ibm.c
Thanks for submitting the patch, Ali. I committed it with some minor changes: fixed couple of style(9) issue and made it more compatible with previous behavior to reduce risk of breaking stuff.
A related Phabricator patch and discussion: "Support post-2015 Lenovo models in acpi_ibm / support keyboard backlight (also led(4)) / support micmute led(4)" - https://reviews.freebsd.org/D14103
A commit references this bug: Author: gonzo Date: Wed May 15 21:52:43 UTC 2019 New revision: 347634 URL: https://svnweb.freebsd.org/changeset/base/347634 Log: MFC r346647: [acpi_ibm] Add support for newer Thinkpad models Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah <aliovx@gmail.com> Changes: _U stable/12/ stable/12/sys/dev/acpi_support/acpi_ibm.c
A commit references this bug: Author: gonzo Date: Thu May 16 00:51:30 UTC 2019 New revision: 347636 URL: https://svnweb.freebsd.org/changeset/base/347636 Log: MFC r346647: [acpi_ibm] Add support for newer Thinkpad models Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah <aliovx@gmail.com> Changes: _U stable/11/ stable/11/sys/dev/acpi_support/acpi_ibm.c
Hey Ali, foolishly I bought a new T490, thinking that FreeBSD works well on Thinkpads. Oh well ... So wireless doesn't work, but there's an open PR for that. acpi_ibm(4) does not attach, so I don't have any of the usual events, snd_hda is wonky, too. But one thing at a time. This is on 12.0-RELEASE, what sort of debugging should I try or where are PCI IDs required to have acpi_ibm attach for this model?
(In reply to Ulrich Spoerlein from comment #17) Hi Urlich, Please open new PR for T490 support and attach the output of acpidump -dt to it. I'm going to close this PR as fixed since the original patch was committed and MFCed
^Triage: Track MFC's to stable branches @Ulrich Could you add the wireless support issue ID to this issue's See Also field please