HID: i2c-hid-of: Allow using i2c-hid-of on non OF platforms
authorHans de Goede <hdegoede@redhat.com>
Thu, 13 Apr 2023 09:36:24 +0000 (11:36 +0200)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 13 Apr 2023 14:27:42 +0000 (16:27 +0200)
commit728ec8b6eda8f61dfeb2a4154e90c134d307e1de
tree7c08bcfd96f633545affef4aa16885c99da8c00d
parent9d793e7c1f884637c3bcd932b7a6ec9d976dccfb
HID: i2c-hid-of: Allow using i2c-hid-of on non OF platforms

There are some x86 tablets / 2-in-1s which ship with Android as their
factory OS image. These have pretty broken ACPI tables, relying on
everything being hardcoded in the factory kernel image.

platform/x86/x86-android-tablets.c manually instantiates i2c-clients for
i2c devices on these tablets to make them work with the mainline kernel.

The Lenovo Yoga Book 1 (yb1-x90f/l) is such a 2-in-1. It has 2 I2C-HID
devices its main touchscreen and a Wacom digitizer. Its main touchscreen
can alternatively also be used in HiDeep's native protocol mode but
for the Wacom digitizer we really need I2C-HID.

This patch allows using i2c-hid-of on non OF platforms so that it can
bind to a non ACPI instantiated i2c_client on x86 for the Wacom digitizer.
Note the driver already has an "i2c-over-hid" i2c_device_id (rather then
an of_device_id).

Besides enabling building on non-OF platforms this also replaces
the only of_property_read_u32() call with device_property_read_u32() note
that other properties where already read using device_property_read_...().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20230413093625.71146-3-hdegoede@redhat.com
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/i2c-hid/Kconfig
drivers/hid/i2c-hid/i2c-hid-of.c