linux-stable/drivers/input/touchscreen
Hans de Goede 0ea0231dd1 Input: goodix - ensure int GPIO is in input for gpio_count == 1 && gpio_int_idx == 0 case
commit 423622a90a upstream.

Add a special case for gpio_count == 1 && gpio_int_idx == 0 to
goodix_add_acpi_gpio_mappings().

It seems that on newer x86/ACPI devices the reset and irq GPIOs are no
longer listed as GPIO resources instead there is only 1 GpioInt resource
and _PS0 does the whole reset sequence for us.

This means that we must call acpi_device_fix_up_power() on these devices
to ensure that the chip is reset before we try to use it.

This part was already fixed in commit 3de93e6ed2 ("Input: goodix - call
acpi_device_fix_up_power() in some cases") by adding a call to
acpi_device_fix_up_power() to the generic "Unexpected ACPI resources"
catch all.

But it turns out that this case on some hw needs some more special
handling. Specifically the firmware may bootup with the IRQ pin in
output mode. The reset sequence from ACPI _PS0 (executed by
acpi_device_fix_up_power()) should put the pin in input mode,
but the GPIO subsystem has cached the direction at bootup, causing
request_irq() to fail due to gpiochip_lock_as_irq() failure:

[    9.119864] Goodix-TS i2c-GDIX1002:00: Unexpected ACPI resources: gpio_count 1, gpio_int_idx 0
[    9.317443] Goodix-TS i2c-GDIX1002:00: ID 911, version: 1060
[    9.321902] input: Goodix Capacitive TouchScreen as /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-5/i2c-GDIX1002:00/input/input8
[    9.327840] gpio gpiochip0: (INT3453:00): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[    9.327856] gpio gpiochip0: (INT3453:00): unable to lock HW IRQ 26 for IRQ
[    9.327861] genirq: Failed to request resources for GDIX1002:00 (irq 131) on irqchip intel-gpio
[    9.327912] Goodix-TS i2c-GDIX1002:00: request IRQ failed: -5

Fix this by adding a special case for gpio_count == 1 && gpio_int_idx == 0
which adds an ACPI GPIO lookup table for the int GPIO even though we cannot
use it for reset purposes (as there is no reset GPIO).

Adding the lookup will make the gpiod_int = gpiod_get(..., GPIOD_IN) call
succeed, which will explicitly set the direction to input fixing the issue.

Note this re-uses the acpi_goodix_int_first_gpios[] lookup table, since
there is only 1 GPIO in the ACPI resources the reset entry in that
lookup table will amount to a no-op.

Reported-and-tested-by: Michael Smith <1973.mjsmith@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231003215144.69527-1-hdegoede@redhat.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 11:54:16 +02:00
..
88pm860x-ts.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
ad7877.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 64 2019-05-24 17:36:46 +02: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ad7879.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
ads7846.c Input: ads7846 - don't check penirq immediately for 7845 2023-03-11 16:39:43 +01:00
ar1021_i2c.c Input: ar1021 - fix typo in preprocessor macro name 2019-11-11 16:02:30 -08:00
atmel_mxt_ts.c Input: atmel_mxt_ts - fix up inverted RESET handler 2022-08-21 15:15:32 +02:00
auo-pixcir-ts.c Linux 5.2 2019-07-15 09:42:32 -07: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: add bu21029 touch driver 2018-06-24 15:20:12 -07:00
chipone_icn8318.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 176 2019-05-30 11:29:19 -07:00
cyttsp4_core.c Input: introduce input_mt_report_slot_inactive() 2020-05-12 13:18:26 -07:00
cyttsp4_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02: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: introduce input_mt_report_slot_inactive() 2020-05-12 13:18:26 -07:00
cyttsp_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
cyttsp_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02: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: Use fallthrough pseudo-keyword 2020-07-07 11:25:54 -07:00
eeti_ts.c Linux 5.2 2019-07-15 09:42:32 -07: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
elants_i2c.c Input: elants_i2c - properly handle the reset GPIO when power is off 2023-01-14 10:15:30 +01:00
elo.c Input: elo - fix an error code in elo_connect() 2021-03-04 11:38:10 +01:00
exc3000.c Input: exc3000 - add support to query model and fw_version 2020-08-06 17:34:19 -07: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 - ensure int GPIO is in input for gpio_count == 1 && gpio_int_idx == 0 case 2023-10-25 11:54:16 +02: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-07-20 16:05:44 +02:00
hp680_ts_input.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
htcpen.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ili210x.c Input: ili210x - fix reset timing 2022-05-25 09:18:01 +02:00
imx6ul_tsc.c Input: imx6ul_tsc - unify open/close and PM paths 2020-09-16 10:38:57 -07:00
inexio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ipaq-micro-ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iqs5xx.c Input: Use fallthrough pseudo-keyword 2020-07-07 11:25:54 -07:00
jornada720_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Kconfig Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER 2020-11-11 17:50:12 -08:00
lpc32xx_ts.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
mainstone-wm97xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
Makefile Input: add zinitix touchscreen driver 2020-10-04 16:08:09 -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: melfas_mip4 - fix return value check in mip4_probe() 2022-10-05 10:38:41 +02: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 Merge branch 'for-linus' into next 2020-05-17 21:10:28 -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
of_touchscreen.c Input: touchscreen - avoid bitwise vs logical OR warning 2021-12-22 09:30:58 +01: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: pixcir_i2c_ts - remove platform data 2019-10-09 14:56:40 -07:00
raspberrypi-ts.c Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe 2023-05-17 11:48:03 +02:00
raydium_i2c_ts.c Input: raydium_ts_i2c - fix memory leak in raydium_i2c_send() 2022-12-08 11:23:59 +01:00
resistive-adc-touch.c
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-04-21 13:00:54 +02:00
silead.c Input: silead - add workaround for x86 BIOS-es which bring the chip up in a stuck state 2021-05-22 11:40:52 +02: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 - switch to using MT-B protocol 2019-10-28 21:04:27 -07:00
stmfts.c Input: stmfts - do not leave device disabled in stmfts_input_open 2022-06-09 10:21:18 +02:00
stmpe-ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07: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-03-04 11:38:09 +01:00
surface3_spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02: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 - remove set but not used variable 'tscadc_dev' 2019-02-19 10:38:19 -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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
tsc200x-core.h
tsc2004.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
tsc2005.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
tsc2007.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tsc2007_core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tsc2007_iio.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ucb1400_ts.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
usbtouchscreen.c Input: usbtouchscreen - fix control-request directions 2021-07-14 16:55:37 +02:00
wacom_i2c.c Input: wacom_i2c - remove unneeded gpio.h header file 2019-10-27 11:14:25 -07: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
wm831x-ts.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
zinitix.c Input: zinitix - do not report shadow fingers 2022-04-08 14:39:48 +02:00
zylonite-wm97xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00