linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels
@ 2018-12-14  9:09 Kai-Heng Feng
  2018-12-19 13:09 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Kai-Heng Feng @ 2018-12-14  9:09 UTC (permalink / raw)
  To: jikos, benjamin.tissoires; +Cc: linux-input, linux-kernel, Kai-Heng Feng

While using Elan touchpads, the message floods:
[  136.138487] i2c_hid i2c-DELL08D6:00: i2c_hid_get_input: incomplete report (14/65535)

Though the message flood is annoying, the device it self works without
any issue. I suspect that the device in question takes too much time to
pull the IRQ back to high after I2C host has done reading its data.

Since the host receives all useful data, let's ignore the input report
when there's no data.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 8555ce7e737b..1776afa6d69c 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -50,6 +50,7 @@
 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET	BIT(1)
 #define I2C_HID_QUIRK_NO_RUNTIME_PM		BIT(2)
 #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP		BIT(3)
+#define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
 
 /* flags */
 #define I2C_HID_STARTED		0
@@ -179,6 +180,8 @@ static const struct i2c_hid_quirks {
 		I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
 	{ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001,
 		I2C_HID_QUIRK_NO_RUNTIME_PM },
+	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
+		 I2C_HID_QUIRK_BOGUS_IRQ },
 	{ 0, 0 }
 };
 
@@ -503,6 +506,12 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
 		return;
 	}
 
+	if (ihid->quirks & I2C_HID_QUIRK_BOGUS_IRQ && ret_size == 0xffff) {
+		dev_dbg(&ihid->client->dev,
+			"%s: IRQ triggered but there's no data\n", __func__);
+		return;
+	}
+
 	if ((ret_size > size) || (ret_size < 2)) {
 		dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
 			__func__, size, ret_size);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels
  2018-12-14  9:09 [PATCH] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels Kai-Heng Feng
@ 2018-12-19 13:09 ` Jiri Kosina
  2018-12-28 15:58   ` Kai Heng Feng
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2018-12-19 13:09 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: benjamin.tissoires, linux-input, linux-kernel

On Fri, 14 Dec 2018, Kai-Heng Feng wrote:

> While using Elan touchpads, the message floods:
> [  136.138487] i2c_hid i2c-DELL08D6:00: i2c_hid_get_input: incomplete report (14/65535)
> 
> Though the message flood is annoying, the device it self works without
> any issue. I suspect that the device in question takes too much time to
> pull the IRQ back to high after I2C host has done reading its data.
> 
> Since the host receives all useful data, let's ignore the input report
> when there's no data.

Interesting, never seen such a bug before.

> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid-core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
> index 8555ce7e737b..1776afa6d69c 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-core.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-core.c
> @@ -50,6 +50,7 @@
>  #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET	BIT(1)
>  #define I2C_HID_QUIRK_NO_RUNTIME_PM		BIT(2)
>  #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP		BIT(3)
> +#define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
>  
>  /* flags */
>  #define I2C_HID_STARTED		0
> @@ -179,6 +180,8 @@ static const struct i2c_hid_quirks {
>  		I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
>  	{ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001,
>  		I2C_HID_QUIRK_NO_RUNTIME_PM },
> +	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
> +		 I2C_HID_QUIRK_BOGUS_IRQ },
>  	{ 0, 0 }
>  };
>  
> @@ -503,6 +506,12 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>  		return;
>  	}
>  
> +	if (ihid->quirks & I2C_HID_QUIRK_BOGUS_IRQ && ret_size == 0xffff) {
> +		dev_dbg(&ihid->client->dev,
> +			"%s: IRQ triggered but there's no data\n", __func__);
> +		return;
> +	}

Would it perhaps make sense to make this some sort of printk_once(), so 
that it's immediately apparent from dmesg that the system/device is 
suffering from this particular problem? Might potentially be helpful piece 
of information.

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels
  2018-12-19 13:09 ` Jiri Kosina
@ 2018-12-28 15:58   ` Kai Heng Feng
  0 siblings, 0 replies; 3+ messages in thread
From: Kai Heng Feng @ 2018-12-28 15:58 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: benjamin.tissoires, linux-input, linux-kernel



> On Dec 19, 2018, at 21:09, Jiri Kosina <jikos@kernel.org> wrote:
> 
> On Fri, 14 Dec 2018, Kai-Heng Feng wrote:
> 
>> While using Elan touchpads, the message floods:
>> [  136.138487] i2c_hid i2c-DELL08D6:00: i2c_hid_get_input: incomplete report (14/65535)
>> 
>> Though the message flood is annoying, the device it self works without
>> any issue. I suspect that the device in question takes too much time to
>> pull the IRQ back to high after I2C host has done reading its data.
>> 
>> Since the host receives all useful data, let's ignore the input report
>> when there's no data.
> 
> Interesting, never seen such a bug before.
> 
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> ---
>> drivers/hid/i2c-hid/i2c-hid-core.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>> 
>> diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
>> index 8555ce7e737b..1776afa6d69c 100644
>> --- a/drivers/hid/i2c-hid/i2c-hid-core.c
>> +++ b/drivers/hid/i2c-hid/i2c-hid-core.c
>> @@ -50,6 +50,7 @@
>> #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET	BIT(1)
>> #define I2C_HID_QUIRK_NO_RUNTIME_PM		BIT(2)
>> #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP		BIT(3)
>> +#define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
>> 
>> /* flags */
>> #define I2C_HID_STARTED		0
>> @@ -179,6 +180,8 @@ static const struct i2c_hid_quirks {
>> 		I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
>> 	{ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001,
>> 		I2C_HID_QUIRK_NO_RUNTIME_PM },
>> +	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
>> +		 I2C_HID_QUIRK_BOGUS_IRQ },
>> 	{ 0, 0 }
>> };
>> 
>> @@ -503,6 +506,12 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>> 		return;
>> 	}
>> 
>> +	if (ihid->quirks & I2C_HID_QUIRK_BOGUS_IRQ && ret_size == 0xffff) {
>> +		dev_dbg(&ihid->client->dev,
>> +			"%s: IRQ triggered but there's no data\n", __func__);
>> +		return;
>> +	}
> 
> Would it perhaps make sense to make this some sort of printk_once(), so 
> that it's immediately apparent from dmesg that the system/device is 
> suffering from this particular problem? Might potentially be helpful piece 
> of information.

Good advice, I’ll send a v2 patch to address this issue.

Kai-Heng

> 
> Thanks,
> 
> -- 
> Jiri Kosina
> SUSE Labs
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-28 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14  9:09 [PATCH] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels Kai-Heng Feng
2018-12-19 13:09 ` Jiri Kosina
2018-12-28 15:58   ` Kai Heng Feng

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).