]> git.baikalelectronics.ru Git - kernel.git/commit
Input: goodix - poll the 'buffer status' bit before reading data
authorPaul Cercueil <paul@crapouillou.net>
Fri, 13 Oct 2017 18:04:48 +0000 (11:04 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 19 Oct 2017 23:50:39 +0000 (16:50 -0700)
commitb78fd3e2ee2673fa5802d2d704714d50b74e0682
tree01fd4f72856762bb98cd8b75ab4c774bf60a108d
parentcd807294ac255132ddff9295266550c4eec7fd87
Input: goodix - poll the 'buffer status' bit before reading data

The Goodix panel triggers an interrupt on touch events. However, its
registers will contain the valid values a short time after the
interrupt, and not when it's raised. At that moment, the 'buffer status'
bit is set.

Previously, if the 'buffer status' bit was not set when the registers
were read, the data was discarded and no input event was emitted,
causing "finger down" or "finger up" events to be missed sometimes.

This went unnoticed until v4.9, as the DesignWare I2C driver commonly
used with this driver had enough latency for that bug to never trigger
until commit 61027e07c8dc ("i2c: designware: wait for disable/enable only
if necessary").

Now, in the IRQ handler we will poll (with a timeout) the 'buffer status'
bit and process the data of the panel as soon as this bit gets set.

Note that the Goodix panel will send a few spurious interrupts after the
'finger up' event, in which the 'buffer status' bit will never be set.

Cc: Bastien Nocera <hadess@hadess.net>
Cc: russianneuromancer@ya.ru
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
[hdegoede@redhat.com: Change poll loop to use jiffies,
                      add comment about typical poll time]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[dtor: rearranged control flow a bit to avoid explicit goto and double
check]
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/goodix.c