WSL2-Linux-Kernel/drivers/input/touchscreen
Linus Walleij e941dc13fd Input: zinitix - do not report shadow fingers
I observed the following problem with the BT404 touch pad
running the Phosh UI:

When e.g. typing on the virtual keyboard pressing "g" would
produce "ggg".

After some analysis it turns out the firmware reports that three
fingers hit that coordinate at the same time, finger 0, 2 and
4 (of the five available 0,1,2,3,4).

DOWN
  Zinitix-TS 3-0020: finger 0 down (246, 395)
  Zinitix-TS 3-0020: finger 1 up (0, 0)
  Zinitix-TS 3-0020: finger 2 down (246, 395)
  Zinitix-TS 3-0020: finger 3 up (0, 0)
  Zinitix-TS 3-0020: finger 4 down (246, 395)
UP
  Zinitix-TS 3-0020: finger 0 up (246, 395)
  Zinitix-TS 3-0020: finger 2 up (246, 395)
  Zinitix-TS 3-0020: finger 4 up (246, 395)

This is one touch and release: i.e. this is all reported on
touch (down) and release.

There is a field in the struct touch_event called finger_cnt
which is actually a bitmask of the fingers active in the
event.

Rename this field finger_mask as this matches the use contents
better, then use for_each_set_bit() to iterate over just the
fingers that are actally active.

Factor out a finger reporting function zinitix_report_fingers()
to handle all fingers.

Also be more careful in reporting finger down/up: we were
reporting every event with input_mt_report_slot_state(..., true);
but this should only be reported on finger down or move,
not on finger up, so also add code to check p->sub_status
to see what is happening and report correctly.

After this my Zinitix BT404 touchscreen report fingers
flawlessly.

The vendor drive I have notably does not use the "finger_cnt"
and contains obviously incorrect code like this:

  if (touch_dev->touch_info.finger_cnt > MAX_SUPPORTED_FINGER_NUM)
      touch_dev->touch_info.finger_cnt = MAX_SUPPORTED_FINGER_NUM;

As MAX_SUPPORTED_FINGER_NUM is an ordinal and the field is
a bitmask this seems quite confused.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220228233017.2270599-1-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-03-07 14:23:35 -08:00
..
88pm860x-ts.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
Kconfig Input: ili210x - add ili251x firmware update support 2021-10-16 22:29:35 -07:00
Makefile Input: goodix - add support for controllers without flash 2021-09-20 22:00:29 -07:00
ad7877.c Input: ad7877 - use new structure for SPI transfer delays 2020-12-10 23:39:15 -08:00
ad7879-i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ad7879-spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ad7879.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
ad7879.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ads7846.c Input: ads7846 - do not attempt IRQ workaround when deferring probe 2021-10-15 22:09:48 -07:00
ar1021_i2c.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
atmel_mxt_ts.c Input: atmel_mxt_ts - fix double free in mxt_read_info_block 2021-12-12 21:08:59 -08:00
auo-pixcir-ts.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
bcm_iproc_tsc.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
bu21013_ts.c Input: bu21013_ts - switch to using standard touchscreen properties 2019-09-02 09:07:38 -07:00
bu21029_ts.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
chipone_icn8318.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
chipone_icn8505.c Input: icn8505 - Switch to firmware_request_platform for retreiving the fw 2020-03-20 14:57:54 +01:00
colibri-vf50-ts.c Input: colibri-vf50-ts - remove unneeded gpio.h header file 2019-10-27 11:14:22 -07:00
cy8ctma140.c Input: add driver for the Cypress CY8CTMA140 touchscreen 2020-05-09 22:26:48 -07:00
cy8ctmg110_ts.c Input: cy8ctmg110_ts - switch to using gpiod API 2021-06-05 20:34:16 -07:00
cyttsp4_core.c Input: cyttsp4 - move 'cyttsp4_tch_abs_string' to the only file that references it 2020-11-08 22:35:48 -08:00
cyttsp4_core.h Input: cyttsp4 - move 'cyttsp4_tch_abs_string' to the only file that references it 2020-11-08 22:35:48 -08:00
cyttsp4_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
cyttsp4_spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
cyttsp_core.c Input: cyttsp - remove public header 2021-06-01 21:13:11 -07:00
cyttsp_core.h Input: cyttsp - remove public header 2021-06-01 21:13:11 -07:00
cyttsp_i2c.c Input: cyttsp - remove public header 2021-06-01 21:13:11 -07:00
cyttsp_i2c_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
cyttsp_spi.c Input: cyttsp - remove public header 2021-06-01 21:13:11 -07:00
da9034-ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
da9052_tsi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
dynapro.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
edt-ft5x06.c Input: edt-ft5x06 - added case for EDT EP0110M09 2021-09-05 19:10:11 -07:00
eeti_ts.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
egalax_ts.c Input: egalax_ts - add system wakeup support 2018-09-18 15:28:07 -07:00
egalax_ts_serial.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ektf2127.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
elants_i2c.c Input: elants_i2c - do not check Remark ID on eKTH3900/eKTH5312 2021-12-20 01:01:05 -08:00
elo.c Input: elo - fix an error code in elo_connect() 2021-02-18 14:39:42 -08:00
exc3000.c Input: exc3000 - add type sysfs attribute 2021-03-07 21:56:50 -08:00
fsl-imx25-tcq.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
fujitsu_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
goodix.c Input: goodix - workaround Cherry Trail devices with a bogus ACPI Interrupt() resource 2022-02-28 23:14:53 -08:00
goodix.h Merge branch 'next' into for-linus 2022-01-15 12:09:44 -08:00
goodix_fwupload.c Input: goodix - fix memory leak in goodix_firmware_upload 2021-12-09 21:20:29 -08:00
gunze.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
hampshire.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hideep.c Input: hideep - fix the uninitialized use in hideep_nvm_unlock() 2021-06-19 22:36:28 -07:00
hp680_ts_input.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
htcpen.c isa: Make the remove callback for isa drivers return void 2021-01-26 07:42:27 +01:00
hycon-hy46xx.c Input: add driver for the Hycon HY46XX touchpanel series 2021-04-13 19:08:30 -07:00
ili210x.c Input: ili210x - reduce sample period to 15ms 2021-11-09 22:23:02 -08:00
ilitek_ts_i2c.c Input: Add support for ILITEK Lego Series 2021-04-09 23:23:01 -07:00
imx6ul_tsc.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
inexio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ipaq-micro-ts.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
iqs5xx.c Input: iqs5xx - make reset GPIO optional 2021-03-25 11:14:10 -07:00
jornada720_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lpc32xx_ts.c Input: lpc32xx_ts - convert to use BIT() 2021-03-20 19:48:37 -07:00
mainstone-wm97xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
max11801_ts.c Input: Use fallthrough pseudo-keyword 2020-07-07 11:25:54 -07:00
mc13783_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mcs5000_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
melfas_mip4.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
migor_ts.c Input: migor_ts - convert to SPDX identifiers 2018-11-12 11:52:05 -08:00
mk712.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mms114.c Input: mms114 - support MMS134S 2021-09-06 23:33:26 -07:00
msg2638.c Input: add MStar MSG2638 touchscreen driver 2021-04-09 23:22:38 -07:00
mtouch.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mxs-lradc-ts.c Input: mxs-lradc-ts - use devm_platform_ioremap_resource() 2019-07-24 12:48:47 +03:00
pcap_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
penmount.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pixcir_i2c_ts.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
raspberrypi-ts.c input: raspberrypi-ts: Release firmware handle when not needed 2021-03-22 17:59:51 +01:00
raydium_i2c_ts.c Input: raydium_i2c_ts - make use of the helper function devm_add_action_or_reset() 2021-09-22 21:56:49 -07:00
resistive-adc-touch.c Input: resistive-adc-touch - fix division by zero error on z1 == 0 2021-10-15 22:11:03 -07:00
rohm_bu21023.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
s3c2410_ts.c ARM: s3c: adc: move header to linux/soc/samsung 2020-08-19 21:44:11 +02:00
s6sy761.c Input: s6sy761 - fix coordinate read bit shift 2021-03-07 15:14:25 -08:00
silead.c Input: silead - add pen support 2021-12-12 21:10:23 -08:00
sis_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
st1232.c Input: st1232 - prefer asynchronous probing 2021-10-11 18:32:56 -07:00
stmfts.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
stmpe-ts.c Input: stmpe-ts - add description for 'prop' struct member 2021-01-19 19:03:18 -08:00
sun4i-ts.c Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register 2020-01-10 14:42:52 -08:00
sur40.c Input: sur40 - fix an error code in sur40_probe() 2021-02-16 20:39:53 -08:00
surface3_spi.c Input: surface3_spi - remove set but unused variable 'timestamp' 2021-01-19 19:03:16 -08:00
sx8654.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ti_am335x_tsc.c Input: ti_am335x_tsc - fix a typo in a comment 2022-01-10 12:46:54 -08:00
touchit213.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
touchright.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
touchwin.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tps6507x-ts.c Input: tsc6507x-ts - switch to using polled mode of input devices 2019-10-29 17:13:41 -07:00
ts4800-ts.c Input: ts4800-ts - switch to using polled mode of input devices 2019-10-29 17:13:40 -07:00
tsc40.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 315 2019-06-05 17:37:05 +02:00
tsc200x-core.c Input: tsc200x - make tsc200x_remove() return void 2021-10-12 19:48:54 -07:00
tsc200x-core.h Input: tsc200x - make tsc200x_remove() return void 2021-10-12 19:48:54 -07:00
tsc2004.c Input: tsc200x - make tsc200x_remove() return void 2021-10-12 19:48:54 -07:00
tsc2005.c Input: tsc200x - make tsc200x_remove() return void 2021-10-12 19:48:54 -07:00
tsc2007.h Input: tsc2007 - convert to GPIO descriptors 2021-03-15 17:12:02 -07:00
tsc2007_core.c Input: tsc2007 - make use of device properties 2021-03-15 17:12:04 -07:00
tsc2007_iio.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ucb1400_ts.c Input: ucb1400_ts - remove redundant variable penup 2021-12-19 23:55:25 -08:00
usbtouchscreen.c Input: usbtouchscreen - fix control-request directions 2021-05-24 20:56:11 -07:00
wacom_i2c.c Input: wacom_i2c - clean up the query device fields 2021-11-29 00:15:39 -08:00
wacom_w8001.c Input: wacom_w8001 - allocate additional space for 'phys' 2019-08-20 12:03:46 -07:00
wdt87xx_i2c.c Input: wdt87xx_i2c - replace mdelay() with msleep() in wdt87xx_resume() 2018-07-27 11:59:05 -07:00
wm97xx-core.c Input: wm97xx: Simplify resource management 2022-01-31 13:17:24 +00:00
wm831x-ts.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
wm9705.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
wm9712.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
wm9713.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
zet6223.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
zforce_ts.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
zinitix.c Input: zinitix - do not report shadow fingers 2022-03-07 14:23:35 -08:00
zylonite-wm97xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00