* [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
@ 2021-03-02 14:50 Hans de Goede
2021-03-02 15:38 ` Benjamin Tissoires
2021-03-02 19:42 ` Dmitry Torokhov
0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2021-03-02 14:50 UTC (permalink / raw)
To: Dmitry Torokhov, Benjamin Tissoires; +Cc: Hans de Goede, linux-input
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.
Check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid
compatiblity-id strings and if it has the I2C-HID spec's DSM to get the
HID descriptor address, If it has both then 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
+ DSM in their ACPI-fwnodes. If some of them actually do have this
false advertising, then this change may lead to regressions.
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207759
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/touchscreen/elants_i2c.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 4c2b579f6c8b..510638e5ba5a 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1334,6 +1334,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)
{
@@ -1342,6 +1348,25 @@ static int elants_i2c_probe(struct i2c_client *client,
unsigned long irqflags;
int error;
+#ifdef CONFIG_ACPI
+ /* 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) {
+ static const guid_t i2c_hid_guid =
+ GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
+ 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
+ acpi_handle handle = ACPI_HANDLE(&client->dev);
+ union acpi_object *obj;
+
+ obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
+ ACPI_TYPE_INTEGER);
+ if (obj) {
+ dev_warn(&client->dev, "elants_i2c: This device appears to be an I2C-HID device, not binding\n");
+ ACPI_FREE(obj);
+ return -ENODEV;
+ }
+ }
+#endif
+
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev,
"%s: i2c check functionality error\n", DEVICE_NAME);
--
2.30.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
2021-03-02 14:50 [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices Hans de Goede
@ 2021-03-02 15:38 ` Benjamin Tissoires
2021-03-02 19:42 ` Dmitry Torokhov
1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2021-03-02 15:38 UTC (permalink / raw)
To: Hans de Goede; +Cc: Dmitry Torokhov, open list:HID CORE LAYER
Hi Hans,
On Tue, Mar 2, 2021 at 3:51 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> 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.
>
> Check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid
> compatiblity-id strings and if it has the I2C-HID spec's DSM to get the
> HID descriptor address, If it has both then 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
> + DSM in their ACPI-fwnodes. If some of them actually do have this
> false advertising, then this change may lead to regressions.
I like the v2 much better, and I believe the regressions should be
fairly small now.
One nitpick below:
>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207759
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/input/touchscreen/elants_i2c.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 4c2b579f6c8b..510638e5ba5a 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1334,6 +1334,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)
> {
> @@ -1342,6 +1348,25 @@ static int elants_i2c_probe(struct i2c_client *client,
> unsigned long irqflags;
> int error;
>
> +#ifdef CONFIG_ACPI
> + /* 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) {
> + static const guid_t i2c_hid_guid =
> + GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
> + 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
Andy in https://patchwork.kernel.org/project/linux-input/patch/20210226193225.47129-3-andriy.shevchenko@linux.intel.com/
proposed a few cleanups for i2c-hid.
I believe a similar pacth should be squashed here (the include is the
one I am more worried about).
Besides that:
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
> + acpi_handle handle = ACPI_HANDLE(&client->dev);
> + union acpi_object *obj;
> +
> + obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
> + ACPI_TYPE_INTEGER);
> + if (obj) {
> + dev_warn(&client->dev, "elants_i2c: This device appears to be an I2C-HID device, not binding\n");
> + ACPI_FREE(obj);
> + return -ENODEV;
> + }
> + }
> +#endif
> +
> if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev,
> "%s: i2c check functionality error\n", DEVICE_NAME);
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
2021-03-02 14:50 [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices Hans de Goede
2021-03-02 15:38 ` Benjamin Tissoires
@ 2021-03-02 19:42 ` Dmitry Torokhov
2021-03-10 10:45 ` Hans de Goede
1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2021-03-02 19:42 UTC (permalink / raw)
To: Hans de Goede; +Cc: Benjamin Tissoires, linux-input
On Tue, Mar 02, 2021 at 03:50:57PM +0100, Hans de Goede wrote:
> 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.
>
> Check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid
> compatiblity-id strings and if it has the I2C-HID spec's DSM to get the
> HID descriptor address, If it has both then 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
> + DSM in their ACPI-fwnodes. If some of them actually do have this
> false advertising, then this change may lead to regressions.
>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207759
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/input/touchscreen/elants_i2c.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 4c2b579f6c8b..510638e5ba5a 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1334,6 +1334,12 @@ static void elants_i2c_power_off(void *_data)
> }
> }
>
> +static const struct acpi_device_id i2c_hid_ids[] = {
> + {"ACPI0C50", 0 },
> + {"PNP0C50", 0 },
> + { },
> +};
This ideally needs to be protected by CONFIG_ACPI.
> +
> static int elants_i2c_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> @@ -1342,6 +1348,25 @@ static int elants_i2c_probe(struct i2c_client *client,
> unsigned long irqflags;
> int error;
>
> +#ifdef CONFIG_ACPI
> + /* 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) {
> + static const guid_t i2c_hid_guid =
> + GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
> + 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
> + acpi_handle handle = ACPI_HANDLE(&client->dev);
> + union acpi_object *obj;
> +
> + obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
> + ACPI_TYPE_INTEGER);
> + if (obj) {
> + dev_warn(&client->dev, "elants_i2c: This device appears to be an I2C-HID device, not binding\n");
No need for "elants_i2c" prefix as dev_warn already gives driver info I
believe.
> + ACPI_FREE(obj);
> + return -ENODEV;
> + }
> + }
> +#endif
Could we tuck this away into "elants_acpi_is_hid_device" and have #ifdef
protecting that and have a complementing stub?
> +
> if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev,
> "%s: i2c check functionality error\n", DEVICE_NAME);
As a cleanup should probably drop device prefix from this message as
well.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
2021-03-02 19:42 ` Dmitry Torokhov
@ 2021-03-10 10:45 ` Hans de Goede
0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2021-03-10 10:45 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Benjamin Tissoires, linux-input
Hi,
On 3/2/21 8:42 PM, Dmitry Torokhov wrote:
> On Tue, Mar 02, 2021 at 03:50:57PM +0100, Hans de Goede wrote:
>> 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.
>>
>> Check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid
>> compatiblity-id strings and if it has the I2C-HID spec's DSM to get the
>> HID descriptor address, If it has both then 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
>> + DSM in their ACPI-fwnodes. If some of them actually do have this
>> false advertising, then this change may lead to regressions.
>>
>> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207759
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/input/touchscreen/elants_i2c.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
>> index 4c2b579f6c8b..510638e5ba5a 100644
>> --- a/drivers/input/touchscreen/elants_i2c.c
>> +++ b/drivers/input/touchscreen/elants_i2c.c
>> @@ -1334,6 +1334,12 @@ static void elants_i2c_power_off(void *_data)
>> }
>> }
>>
>> +static const struct acpi_device_id i2c_hid_ids[] = {
>> + {"ACPI0C50", 0 },
>> + {"PNP0C50", 0 },
>> + { },
>> +};
>
> This ideally needs to be protected by CONFIG_ACPI.
>
>> +
>> static int elants_i2c_probe(struct i2c_client *client,
>> const struct i2c_device_id *id)
>> {
>> @@ -1342,6 +1348,25 @@ static int elants_i2c_probe(struct i2c_client *client,
>> unsigned long irqflags;
>> int error;
>>
>> +#ifdef CONFIG_ACPI
>> + /* 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) {
>> + static const guid_t i2c_hid_guid =
>> + GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
>> + 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
>> + acpi_handle handle = ACPI_HANDLE(&client->dev);
>> + union acpi_object *obj;
>> +
>> + obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
>> + ACPI_TYPE_INTEGER);
>> + if (obj) {
>> + dev_warn(&client->dev, "elants_i2c: This device appears to be an I2C-HID device, not binding\n");
>
> No need for "elants_i2c" prefix as dev_warn already gives driver info I
> believe.
Right, I will fix this for v2.
>
>> + ACPI_FREE(obj);
>> + return -ENODEV;
>> + }
>> + }
>> +#endif
>
> Could we tuck this away into "elants_acpi_is_hid_device" and have #ifdef
> protecting that and have a complementing stub?
That is a good idea, I'll do that for v2.
>
>> +
>> if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
>> dev_err(&client->dev,
>> "%s: i2c check functionality error\n", DEVICE_NAME);
>
> As a cleanup should probably drop device prefix from this message as
> well.
Ack.
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-10 10:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 14:50 [PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices Hans de Goede
2021-03-02 15:38 ` Benjamin Tissoires
2021-03-02 19:42 ` Dmitry Torokhov
2021-03-10 10:45 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).