]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
linuxkpi: Add i2c support
authorEmmanuel Vadot <manu@FreeBSD.org>
Thu, 4 Nov 2021 09:42:37 +0000 (10:42 +0100)
committerEmmanuel Vadot <manu@FreeBSD.org>
Tue, 25 Jan 2022 15:15:39 +0000 (16:15 +0100)
commit1961a14a47437595fb7fcdc20e327440e3eb51e2
treeeba554e083f6b3b8f987029bec14b440ea6d55a4
parent9caeb82eab2805782b9c3d9205007c1b0795e808
linuxkpi: Add i2c support

Add i2c support to linuxkpi. This is needed by drm-kmod.
For every i2c_adapter added by i2c_add_adapter we add a child to the
device named "lkpi_iic". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
For every i2c_adapter added by i2c_bit_add_bus we add a child to the
device named "lkpi_iicbb". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
With the help of iic(4), this expose the i2c controller to userspace
allowing a user to query DDC information from a monitor.
e.g.: i2c -f /dev/iic0 -a 0x28 -c 128 -d r
will query the standard EDID from the monitor if plugged.

The bitbang part (lkpi_iicbb) isn't tested at all for now as I don't have
compatible hardware (all my hardware have native i2c controller).

Tested on: Intel (SandyBridge, Skylake, ApolloLake)
Tested on: AMD (Picasso, Polaris (amd64 and arm64))

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33053
sys/compat/linuxkpi/common/include/linux/i2c-algo-bit.h [new file with mode: 0644]
sys/compat/linuxkpi/common/include/linux/i2c.h [new file with mode: 0644]
sys/compat/linuxkpi/common/src/linux_i2c.c [new file with mode: 0644]
sys/compat/linuxkpi/common/src/linux_i2cbb.c [new file with mode: 0644]
sys/compat/linuxkpi/common/src/lkpi_iic_if.m [new file with mode: 0644]
sys/conf/files
sys/conf/kmod.mk
sys/modules/linuxkpi/Makefile