All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: goodix: Check the 'data ready' bit before reading data
@ 2015-04-25 10:48 Paul Cercueil
  2015-04-25 12:54 ` Bastien Nocera
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Cercueil @ 2015-04-25 10:48 UTC (permalink / raw)
  To: Bastien Nocera, Dmitry Torokhov; +Cc: linux-input, linux-kernel, Paul Cercueil

The MSB of the first byte read via I2C seems to indicate whether the
data is valid (or ready) when an interrupt is raised. Previously, this
bit was ignored, which resulted in a lot of incorrect detections of
"finger removed" events.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/input/touchscreen/goodix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index ca19668..9fa6c5f 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -98,6 +98,9 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
 		return error;
 	}
 
+	if (!(data[0] & 0x80))
+		return -EAGAIN;
+
 	touch_num = data[0] & 0x0f;
 	if (touch_num > GOODIX_MAX_CONTACTS)
 		return -EPROTO;
-- 
2.1.4


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

* Re: [PATCH] input: goodix: Check the 'data ready' bit before reading data
  2015-04-25 10:48 [PATCH] input: goodix: Check the 'data ready' bit before reading data Paul Cercueil
@ 2015-04-25 12:54 ` Bastien Nocera
  2015-04-27  9:00     ` paul
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien Nocera @ 2015-04-25 12:54 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Dmitry Torokhov, linux-input, linux-kernel

On Sat, 2015-04-25 at 12:48 +0200, Paul Cercueil wrote:
> The MSB of the first byte read via I2C seems to indicate whether the
> data is valid (or ready) when an interrupt is raised. Previously, 
> this
> bit was ignored, which resulted in a lot of incorrect detections of
> "finger removed" events.

This seems correct, but the wording doesn't match the language used in 
the Goodix docs that were posted here some time ago[1].

I would have written:
The MSB of the first byte read via I2C at the coordinates address 
indicate whether the data is valid or ready (called "buffer status" in 
the datasheets) when an interrupt is raised. Previously, this bit was 
ignored, which resulted in a lot of incorrect detections of "finger 
removed" events.

And for the commit subject:
input: goodix: Check the 'buffer status' bit before reading data

This seems correct otherwise.

Signed-off-by: Bastien Nocera <hadess@hadess.net>

with the fixed commit message/subject

[1]: Linked from the device tree support patch:
https://patchwork.ozlabs.org/patch/446838/
Page 16, table c, 0x814E is what we read for coordinates

> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/input/touchscreen/goodix.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/goodix.c 
> b/drivers/input/touchscreen/goodix.c
> index ca19668..9fa6c5f 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -98,6 +98,9 @@ static int goodix_ts_read_input_report(struct 
> goodix_ts_data *ts, u8 *data)
>               return error;
>       }
>  
> +     if (!(data[0] & 0x80))
> +             return -EAGAIN;
> +
>       touch_num = data[0] & 0x0f;
>       if (touch_num > GOODIX_MAX_CONTACTS)
>               return -EPROTO;

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

* Re: [PATCH] input: goodix: Check the 'data ready' bit before reading data
  2015-04-25 12:54 ` Bastien Nocera
@ 2015-04-27  9:00     ` paul
  0 siblings, 0 replies; 4+ messages in thread
From: paul @ 2015-04-27  9:00 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Dmitry Torokhov, linux-input, linux-kernel

Hi Bastien,

Ok, I will send a V2 with a better commit message then.

-Paul

Le 2015-04-25 14:54, Bastien Nocera a écrit :
> On Sat, 2015-04-25 at 12:48 +0200, Paul Cercueil wrote:
>> The MSB of the first byte read via I2C seems to indicate whether the
>> data is valid (or ready) when an interrupt is raised. Previously,
>> this
>> bit was ignored, which resulted in a lot of incorrect detections of
>> "finger removed" events.
> 
> This seems correct, but the wording doesn't match the language used in
> the Goodix docs that were posted here some time ago[1].
> 
> I would have written:
> The MSB of the first byte read via I2C at the coordinates address
> indicate whether the data is valid or ready (called "buffer status" in
> the datasheets) when an interrupt is raised. Previously, this bit was
> ignored, which resulted in a lot of incorrect detections of "finger
> removed" events.
> 
> And for the commit subject:
> input: goodix: Check the 'buffer status' bit before reading data
> 
> This seems correct otherwise.
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
> 
> with the fixed commit message/subject
> 
> [1]: Linked from the device tree support patch:
> https://patchwork.ozlabs.org/patch/446838/
> Page 16, table c, 0x814E is what we read for coordinates
> 
>> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>> ---
>>  drivers/input/touchscreen/goodix.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/input/touchscreen/goodix.c
>> b/drivers/input/touchscreen/goodix.c
>> index ca19668..9fa6c5f 100644
>> --- a/drivers/input/touchscreen/goodix.c
>> +++ b/drivers/input/touchscreen/goodix.c
>> @@ -98,6 +98,9 @@ static int goodix_ts_read_input_report(struct
>> goodix_ts_data *ts, u8 *data)
>>               return error;
>>       }
>> 
>> +     if (!(data[0] & 0x80))
>> +             return -EAGAIN;
>> +
>>       touch_num = data[0] & 0x0f;
>>       if (touch_num > GOODIX_MAX_CONTACTS)
>>               return -EPROTO;

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

* Re: [PATCH] input: goodix: Check the 'data ready' bit before reading data
@ 2015-04-27  9:00     ` paul
  0 siblings, 0 replies; 4+ messages in thread
From: paul @ 2015-04-27  9:00 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Dmitry Torokhov, linux-input, linux-kernel

Hi Bastien,

Ok, I will send a V2 with a better commit message then.

-Paul

Le 2015-04-25 14:54, Bastien Nocera a écrit :
> On Sat, 2015-04-25 at 12:48 +0200, Paul Cercueil wrote:
>> The MSB of the first byte read via I2C seems to indicate whether the
>> data is valid (or ready) when an interrupt is raised. Previously,
>> this
>> bit was ignored, which resulted in a lot of incorrect detections of
>> "finger removed" events.
> 
> This seems correct, but the wording doesn't match the language used in
> the Goodix docs that were posted here some time ago[1].
> 
> I would have written:
> The MSB of the first byte read via I2C at the coordinates address
> indicate whether the data is valid or ready (called "buffer status" in
> the datasheets) when an interrupt is raised. Previously, this bit was
> ignored, which resulted in a lot of incorrect detections of "finger
> removed" events.
> 
> And for the commit subject:
> input: goodix: Check the 'buffer status' bit before reading data
> 
> This seems correct otherwise.
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
> 
> with the fixed commit message/subject
> 
> [1]: Linked from the device tree support patch:
> https://patchwork.ozlabs.org/patch/446838/
> Page 16, table c, 0x814E is what we read for coordinates
> 
>> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>> ---
>>  drivers/input/touchscreen/goodix.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/input/touchscreen/goodix.c
>> b/drivers/input/touchscreen/goodix.c
>> index ca19668..9fa6c5f 100644
>> --- a/drivers/input/touchscreen/goodix.c
>> +++ b/drivers/input/touchscreen/goodix.c
>> @@ -98,6 +98,9 @@ static int goodix_ts_read_input_report(struct
>> goodix_ts_data *ts, u8 *data)
>>               return error;
>>       }
>> 
>> +     if (!(data[0] & 0x80))
>> +             return -EAGAIN;
>> +
>>       touch_num = data[0] & 0x0f;
>>       if (touch_num > GOODIX_MAX_CONTACTS)
>>               return -EPROTO;
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-04-27  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 10:48 [PATCH] input: goodix: Check the 'data ready' bit before reading data Paul Cercueil
2015-04-25 12:54 ` Bastien Nocera
2015-04-27  9:00   ` paul
2015-04-27  9:00     ` paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.