linux-stable/drivers/input
Paul Cercueil 9b5db7aab4 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 2702ea7dbe ("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>
2017-10-19 16:50:39 -07:00
..
gameport Input: gameport - use setup_timer 2017-04-10 20:41:39 -07:00
joystick Merge branch 'next' into for-linus 2017-09-15 09:52:21 -07:00
keyboard Input: tca8418 - enable interrupt after it has been requested 2017-10-19 16:50:20 -07:00
misc Input: axp20x-pek - fix module not auto-loading for axp221 pek 2017-10-19 16:50:28 -07:00
mouse Input: synaptics - disable kernel tracking on SMBus devices 2017-10-09 20:52:39 -07:00
rmi4 Merge branch 'bind_unbind' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core into next 2017-07-24 16:51:18 -07:00
serio Input: i8042 - add Gigabyte P57 to the keyboard reset table 2017-09-15 09:51:22 -07:00
tablet Input: wacom_serial4 - constify serio_device_id 2017-08-18 17:15:09 -07:00
touchscreen Input: goodix - poll the 'buffer status' bit before reading data 2017-10-19 16:50:39 -07:00
apm-power.c
evbug.c
evdev.c input: utilize new cdev_device_add helper function 2017-03-21 06:44:32 +01:00
ff-core.c Input: uinput - avoid FF flush when destroying device 2017-09-21 16:31:22 -07:00
ff-memless.c
input-compat.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
input-compat.h drivers/input: eliminate INPUT_COMPAT_TEST macro 2016-03-25 16:37:42 -07:00
input-leds.c
input-mt.c Input: update input_mt_report_pointer_emulation to support hovering 2016-06-01 14:21:10 -07:00
input-polldev.c
input.c Input: constify attribute_group structures 2017-07-12 14:18:26 -07:00
joydev.c input: utilize new cdev_device_add helper function 2017-03-21 06:44:32 +01:00
Kconfig Input: mousedev - stop offering PS/2 to userspace by default 2017-01-31 11:31:49 -08:00
Makefile Input: synaptics-rmi4 - add support for Synaptics RMI4 devices 2016-03-10 16:02:39 -08:00
matrix-keymap.c Input: matrix-keypad - switch to using generic device properties 2017-01-31 11:31:48 -08:00
mousedev.c Input: mousedev - fix implicit conversion warning 2017-07-25 13:54:31 -07:00
sparse-keymap.c Input: sparse-keymap - remove sparse_keymap_free() 2017-05-29 20:02:01 -07:00