Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
Subsystems (2)
cover Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
Hi All,
Here is a patch which should fix the touchscreen issues some people have been seeing on some recent Lenovo AMD CPU using models:
https://bugzilla.kernel.org/show_bug.cgi?id=207759
There are 2 reasons why this is a RFC:
1. It is compile-tested only ATM, I'm waiting for feedback from the reporters of the issue.
2. The fix which I wrote is somewhat simple. It should work, but there might be older touchscreens which actually need to use the Elan specific protocol implemented by elants_i2c.ko; while the ACPI-fwnode describing the touchscreen falsely contains one of the i2c-hid ACPI compatiblity-id strings. This would of course be a bug in the ACPI tables, but I have seen this before.
2. might lead to regressions (or it might be a non-issue) so I was hoping for some input on this from Benjamin as he originally wroter the elants_i2c code.
Regards,
Hans
Hans de Goede (1):
Input: elants_i2c - Do not bind to i2c-hid compatible ACPI
instantiated devices
drivers/input/touchscreen/elants_i2c.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Signature · 1 line
2.30.1
RFC 1/1 Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
Several users have been reporting that elants_i2c gives several errors during probe and that their touchscreen does not work on their Lenovo AMD based laptops with a touchscreen with a ELAN0001 ACPI hardware-id:
[ 0.550596] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vcc33 not found, using dummy regulator [ 0.551836] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vccio not found, using dummy regulator [ 0.560932] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121 [ 0.562427] elants_i2c i2c-ELAN0001:00: software reset failed: -121 [ 0.595925] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121 [ 0.597974] elants_i2c i2c-ELAN0001:00: software reset failed: -121 [ 0.621893] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121 [ 0.622504] elants_i2c i2c-ELAN0001:00: software reset failed: -121 [ 0.632650] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (4d 61 69 6e): -121 [ 0.634256] elants_i2c i2c-ELAN0001:00: boot failed: -121 [ 0.699212] elants_i2c i2c-ELAN0001:00: invalid 'hello' packet: 00 00 ff ff [ 1.630506] elants_i2c i2c-ELAN0001:00: Failed to read fw id: -121 [ 1.645508] elants_i2c i2c-ELAN0001:00: unknown packet 00 00 ff ff
Despite these errors, the elants_i2c driver stays bound to the device (it returns 0 from its probe method despite the errors), blocking the i2c-hid driver from binding.
Manually unbinding the elants_i2c driver and binding the i2c-hid driver makes the touchscreen work.
Add a check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid compatiblity-id strings, and if it does make elants_i2c not bind, so that the i2c-hid driver can bind.
This assumes that non of the (older) elan touchscreens which actually need the elants_i2c driver falsely advertise an i2c-hid compatiblity-id string in their ACPI-fwnodes. If some of them actually do have this false advertising, then this change may lead to regressions.
Note this change is a no-op for none ACPI instantiated i2c-clients or when ACPI support is not enabled in the kernel.
--- drivers/input/touchscreen/elants_i2c.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/input/touchscreen/elants_i2c.c +10 -0
@@ -1228,6 +1228,12 @@ static void elants_i2c_power_off(void *_data) } } +static const struct acpi_device_id i2c_hid_ids[] = { + {"ACPI0C50" ,0 }, + {"PNP0C50" ,0 }, + { }, +}; +static int elants_i2c_probe (struct i2c_client *client,const struct i2c_device_id *id) {
@@ -1236,6 +1242,10 @@ static int elants_i2c_probe(struct i2c_client *client,unsigned long irqflags;int error; +/* Don't bind to i2c-hid compatible devices, these are handled by the i2c-hid drv. */ +if (acpi_match_device_ids (ACPI_COMPANION (&client->dev), i2c_hid_ids) ==0 ) +return -ENODEV ; +if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) {dev_err (&client->dev,"%s: i2c check functionality error\n" ,DEVICE_NAME );
Signature · 1 line
2.30.1