5T33Z0 / OC-Little-Translated

ACPI Hotpatches and Guides for the OpenCore Bootmanager. Enhance and fine-tune your system by adding devices and enabling additional features not covered in the OpenCore Install Guide.
BSD 3-Clause "New" or "Revised" License
494 stars 69 forks source link

SMBus Trackpads #57

Closed 1Revenger1 closed 1 year ago

1Revenger1 commented 1 year ago

Hey, just wanted to provide some corrections (and give some background) for SMBus trackpads.

You group PS/2 and SMBus together, which is a bit weird. SMBus is really a derivative of I2C, which both have much higher data bandwidth compared to PS/2. The main benefit to SMBus (and I2C) is that they send all finger coordinates at once, which the PS/2 bus is not able to do. While 99% of SMBus trackpads I've seen so far do support PS/2 connectivity, this relationship does not hold true the other way around. Many Synaptics PS/2 trackpads (generally Skylake era and older) are not connected over SMBus. Use of SMBus over PS/2 is basically always preferred for Synaptics, especially since Acidanthera's VoodooPS2 has some bugs with how buttons are handled.

SMBus trackpads are not that easy to detect. Best way in Windows is to check the name of the SMBus Controller in Device Manager. Normally, it'll be named "Intel SMBus Controller". When renamed to "Elans SMBus Controller" or "Synaptics SMBus Controller", there is an SMBus trackpad. The HID devices will always be attached to the PS/2 interface due to how the drivers work, but they really are using the higher bandwidth SMBus. In macOS, Acidanthera's VoodooPS2Trackpad will put a property in IORegistry which mentions "Intertouch Support". In Linux, just search for "RMI4" or "Intertouch" in sudo dmesg. If RMI4 appears, then it's an SMBus trackpad. The Linux method though is not that accurate, as many trackpads have to be added manually to a list in the PS/2 Synaptics driver for SMBus support.

Many Thinkpads and HP ProBooks (Ivy Bridge and newer) will use SMBus, though this is not a rule. The Thinkpad 2-in-1s like to use I2C for example. My Thinkpad X1 Extreme (Gen 1 - Coffeelake) uses SMBus, and I believe that was the case for gen 2 as well.

VoodooElans is not complete. Elans SMBus trackpads should use VoodooSMBus from the VoodooSMBus repo. The VoodooSMBus that comes with VoodooRMI is built on a different branch and has different functionality.

Also, VoodooRMI works for Synaptics I2C trackpads. Probably best to replace VoodooI2CSynaptics with it, as VoodooRMI fixes some bugs and has more functionality in general. It also supports the F12 trackpads.

Edit: If you've got extra questions, feel free to ask them. It can get confusing.

5T33Z0 commented 1 year ago

Thanks for the explanations. I will correct it in the description and incorporate the info soon. As far as ThinkPads are concerned: I have a T530 which has an Ivy Bridge CPU but it doesn't use SMBus for the touchpad. So it's either it's not one of the many or SMBus really only became relevant from Haswell onward. Seems like there's a transition period between Ivy Bridge and Haswell. In the end it doesn't really matter because it has to be determined on a case by case basis anyway.

Since I don't have any other hardware to test all the stuff it's a drag really to collect all the info. Especially since almost every guide I could find is outdated and based on patching the DSDT.

1Revenger1 commented 1 year ago

A friend of mine has an HP with an SMBus trackpad and it's Ivy Bridge. It really is a case by case basis. Definitely not going to find any SMBus info in the DSDT as well. It's all determined by reading trackpad registers.

1Revenger1 commented 1 year ago

Currently listed Trackpad IDs which support SMBus (according to Linux): https://github.com/torvalds/linux/blob/master/drivers/input/mouse/synaptics.c#L128-L194 Warning if trackpad potentially supports SMBus but is not listed: https://github.com/torvalds/linux/blob/master/drivers/input/mouse/synaptics.c#L1796-L1797 Where property is set in Synaptics VoodooPS2Trackpad: https://github.com/acidanthera/VoodooPS2/blob/master/VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp#L390-L391

Elans check in VoodooPS2: https://github.com/acidanthera/VoodooPS2/blob/master/VoodooPS2Trackpad/VoodooPS2Elan.cpp#L211-L231 Note that with Elans, I think the PS2 driver is actually pretty good. Less need to use VoodooSMBus with it. Note that the Elans check requires Debug VoodooPS2, unlike the Synaptics check.

Edit: Also, VoodooInput handles bridging info from VoodooPS2/I2C/RMI to macOS. It's main purpose is to spoof a Magic Trackpad 2 so that we get all the really nice gestures. VoodooPS2/RMI handle trackpoint hardware themselves. Generally, trackpoints aren't an important detail for users to worry so I'd focus on trackpads instead, since the trackpads are really what handle the trackpoint hardware.

i8042 = PS2 Controller i801 = SMBus controller

Most Laptops hardware (For illustration purpose, I just show the PS2 side):

 _______     __________
| i8042 | - | Keyboard | (Kbd Port)
|       |   ------------
|       |    __________
|       | - | Trackpad |  (Mouse Port)
 -------    ------------
              |
           ____________
          | Trackpoint |  (PS2 Passthrough port on trackpad)
          --------------

The edge case here is HP, which likes to sometimes mux the Auxiliary/Mouse port on the i8042 controller. This means you'll have a case where the Trackpoint is connected directly to a PS2 port while the trackpad is connected to another PS2 port and the SMBus controller. It'll look more like (on the PS2 side):

 _______     __________
| i8042 | - | Keyboard | (Kbd Port)
|       |   ------------
|       |    __________
|       | - | Trackpad |   (Aux 0)
|       |   ------------
|       |    ____________
|       | - | Trackpoint |  (Aux 1)
|       |    -------------
|       | - (Aux 2)
|       | - (Aux 3)
--------

Acidanthera's VoodooPS2 is able to handle this edge case though, and will just attach VoodooPS2Mouse to the trackpoint.