Page MenuHomeFreeBSD

Avoid split I²C transactions in iichid
ClosedPublic

Authored by phk on Jul 14 2025, 3:00 PM.
Referenced Files
Unknown Object (File)
Fri, Oct 10, 11:18 PM
Unknown Object (File)
Fri, Oct 10, 5:01 PM
Unknown Object (File)
Fri, Oct 10, 5:01 PM
Unknown Object (File)
Fri, Oct 10, 11:39 AM
Unknown Object (File)
Fri, Oct 3, 1:13 PM
Unknown Object (File)
Fri, Oct 3, 1:10 PM
Unknown Object (File)
Fri, Oct 3, 7:13 AM
Unknown Object (File)
Tue, Sep 30, 8:28 AM
Subscribers

Details

Summary

(This is actually a re-review, but it has been too long since the first one for me to feel comfortable relying on it.)

Read IIC-HID reports as a single I²C transaction, instead of reading first the two byte length field, holding the bus, and then the rest of the report in a separate transaction.

While technically legal, I²C bus split transactions are not universally supported, and in particular the "Snapdragon Elite" ARM CPU does not seem to support them.

It is also not obvious that they are beneficial in this case, given the overhead of controller setup, interrupts and tear-down.

Test Plan

Runs on my Intel-CPU T14s.
Runs on my Arm-CPU T14s (with additional patches for polling)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

phk requested review of this revision.Jul 14 2025, 3:00 PM
phk created this revision.

LGTM

sys/dev/iicbus/iichid.c
279

actlen of 0xAAAA lies within HID over I2C specs. Out of specs values greater must be greater than 0xFFFC. 0xFFFF of course can not be used here. Nevertheless I doubt that such a long transfers may exist in real life, so it is OK.

302–305

I have a reports of hybrid HID/non-HID devices which may send a reports longer than maxlen, so IMO (actlen <= 2 || actlen == 0xFFFF) is better. IMO actlen > maxlen should just be logged once after driver start.

This revision is now accepted and ready to land.Jul 28 2025, 10:52 PM
This revision was automatically updated to reflect the committed changes.

There's a report of touchpad breakage that traced back to this commit: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289353