HID over I2C

Andriy Gapon avg at FreeBSD.org
Tue Nov 22 22:45:19 UTC 2016


Jonathan,

just a few notes, not a comprehensive answer to your questions.


On 09/03/2016 03:22, Jonathan Anderson wrote:
> Hi all,
> 
> I have a shiny new notebook to run FreeBSD on (the ASUS Zenbook UX305CA). I
> wasn't expecting accelerated graphics to work, so I'm happy enough to get the
> native HD resolution with the scfb driver. The wireless mostly works, too, with
> one known caveat [1] that isn't too annoying. However, of all things, the
> touchpad doesn't work!
> 
> It turns out that this notebook's touchpad is connected using HID over I2C. This
> seems to be a pattern of increasing prevalence, so I'm hoping that FreeBSD
> either has some support for it or else somebody is working on it. However,
> besides the HID-over-I2C bit, I also need updated I2C parts.
> 
> I see that FreeBSD has the 'ig4' module (imported from Dragonfly) for Haswell
> I2C, but I believe that there are some further changes with Skylake (at least
> the Linux folks needed some changes [2]). I'm slightly confused about the
> difference between SMBus and I2C... I believe they're compatible, but they seem
> to be exposed as difference PCI devices [3]. Is this because one is used with
> host-as-master only and the other supports the multi-master mode for async
> transfer?

The relation between I2C bus and SMBus is very roughly similar to the relation
between IP and TCP.
The same could be said about I2C and SMBus controllers, the former are like the
raw IP socket API while the latter are like the TCP socket API.  Again, the
analogy is very approximate.

Another thing to note is that typically each controller is connected to its own
physical bus.

> I've tried simple things like adding the Skylake PCI IDs to `ichsmb`,
> which causes a `/dev/smb0` to be created, but when I try to use `consolehm` I
> get lots of "Device not configured" errors. At any rate, it seems like I need to
> be worried about I2C and not SMBus.

Did you add SMBus controller IDs to ichsmb?
Why not also try to add I2C controller IDs to ichiic / ig4?

> So, I really have two questions for the list:
> 
> 1. Where is the right place to make I2C changes?
> 
> We have the 'ig4' module for the fourth-generation Intel PCH... are we going to
> go down the road of creating an 'ig5', 'ig6', etc.? Should 'ig4' be renamed to
> align with its path in the source tree ('sys/dev/ichiic') and be extended to
> support more recent generations of hardware too?

Regarding ig5, ig6, etc - we have intpm(4) [the name stands for Intel Power
Management] which is originally a driver for an SMBus controller in Intel PIIX4
chipset.  But it also supports SMBus controllers in many AMD chipsets.  There is
no need to fork a driver or change its name just because it happens to support
some newer hardware.

I agree that the double-naming, ichiic vs ig4, is confusing and regrettable.
But the naming is secondary to the function.

> 2. What else is required to support HID over I2C?
> 
> Once I have a working Skylake I2C bus, how do I connect an input device to it?
> We have code for dealing with HID over USB, but that seems pretty tied into USB
> ('sys/dev/usb/input/uhid.c' and 'sys/dev/usb/usb_hid.c'). Now, it's only ~1500
> lines of code, so it mightn't be too hard to re-implement the protocol, but
> ideally one wouldn't have to. If the touchpad can be exposed directly as a
> device, can X itself speak the HID protocol? Alternatively, if we get I2C
> working correctly, will psm magically start to work with the touchpad?

Regarding HID over I2C - I have no idea about that.  I guess that there must be
some open-source drivers and/or public specifications for that
protocol/transport combination.

> [1] http://lists.freebsd.org/pipermail/freebsd-wireless/2016-March/006530.html
> [2] https://bugzilla.kernel.org/show_bug.cgi?id=108581
> [3]
> https://download.01.org/future-platform-configuration-hub/skylake/register-definitions/332219-002.pdf



-- 
Andriy Gapon


More information about the freebsd-mobile mailing list