linux/drivers/pinctrl/intel
Hans de Goede a0bf06dc51 pinctrl: cherryview: Preserve CHV_PADCTRL1_INVRXTX_TXDATA flag on GPIOs
One some devices the GPIO should output the inverted value from what
device-drivers / ACPI code expects. The reason for this is unknown,
perhaps these systems use an external buffer chip on the GPIO which
inverts the signal. The BIOS makes this work by setting the
CHV_PADCTRL1_INVRXTX_TXDATA flag.

Before this commit we would unconditionally clear all INVRXTX flags,
including the CHV_PADCTRL1_INVRXTX_TXDATA flag when a GPIO is requested
by a driver (from chv_gpio_request_enable()).

This breaks systems using this setup. Specifically it is causing
problems for systems with a goodix touchscreen, where the BIOS sets the
INVRXTX_TXDATA flag on the GPIO used for the touchscreen's reset pin.

The goodix touchscreen driver by defaults configures this pin as input
(relying on the pull-up to keep it high), but the clearing of the
INVRXTX_TXDATA flag done by chv_gpio_request_enable() causes it to be
driven low for a brief time before the GPIO gets set to input mode.

This causes the touchscreen controller to get reset. On most CHT devs
with this touchscreen this leads to:

[   31.596534] Goodix-TS i2c-GDIX1001:00: i2c test failed attempt 1: -121

The driver retries this though and then everything is fine. But during
reset the touchscreen uses its interrupt pin as bootstrap to determine
which i2c address to use and on the Acer One S1003 the spurious reset
caused by the clearing of the INVRXTX_TXDATA flag causes the controller
to come back up again on the wrong i2c address, breaking things.

This commit fixes both the -121 errors, as well as the total breakage
on the Acer One S1003, by making chv_gpio_clear_triggering() not clear
the INVRXTX_TXDATA flag if the pin is already configured as a GPIO.

Note that chv_pinmux_set_mux() does still unconditionally clear the
flag, so this only affects GPIO usage.

Fixes: a7d4b17166 ("Input: goodix - add support for getting IRQ + reset GPIOs on Cherry Trail devices")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-09-07 11:57:19 +03:00
..
Kconfig pinctrl: cherryview: Switch to use intel_pinctrl_get_soc_data() 2020-08-20 12:37:07 +03:00
Makefile pinctrl: intel: Add Intel Emmitsburg pin controller support 2020-07-21 11:44:21 +03:00
pinctrl-baytrail.c pinctrl: baytrail: Switch to use intel_pinctrl_get_soc_data() 2020-08-20 12:37:07 +03:00
pinctrl-broxton.c pinctrl: broxton: Provide Interrupt Status register offset 2019-08-07 16:45:41 +03:00
pinctrl-cannonlake.c pinctrl: cannonlake: Use generic flag for special GPIO base treatment 2020-04-14 16:17:13 +03:00
pinctrl-cedarfork.c pinctrl: cedarfork: Update pin names according to v1.13c 2019-04-03 14:49:47 +03:00
pinctrl-cherryview.c pinctrl: cherryview: Preserve CHV_PADCTRL1_INVRXTX_TXDATA flag on GPIOs 2020-09-07 11:57:19 +03:00
pinctrl-denverton.c pinctrl: denverton: Update pin names according to v1.08 2019-08-08 12:57:01 +03:00
pinctrl-emmitsburg.c pinctrl: intel: Add Intel Emmitsburg pin controller support 2020-07-21 11:44:21 +03:00
pinctrl-geminilake.c pinctrl: geminilake: Provide Interrupt Status register offset 2019-08-07 16:45:41 +03:00
pinctrl-icelake.c pinctrl: icelake: Use generic flag for special GPIO base treatment 2020-04-14 16:17:13 +03:00
pinctrl-intel.c pinctrl: intel: Extract intel_pinctrl_get_soc_data() helper for wider use 2020-08-18 16:46:39 +03:00
pinctrl-intel.h pinctrl: intel: Update header block to reflect direct dependencies 2020-08-20 12:37:07 +03:00
pinctrl-jasperlake.c pinctrl: intel: Add Intel Jasper Lake pin controller support 2020-04-14 16:17:13 +03:00
pinctrl-lewisburg.c pinctrl: lewisburg: Update pin list according to v1.1v6 2019-11-21 15:04:16 +01:00
pinctrl-lynxpoint.c pinctrl: lynxpoint: Drop no-op ACPI_PTR() call 2020-06-22 13:55:36 +03:00
pinctrl-merrifield.c pinctrl: merrifield: Add I²S bus 2 pins to groups and functions 2020-06-29 17:39:06 +03:00
pinctrl-sunrisepoint.c pinctrl: sunrisepoint: Fix PAD lock register offset for SPT-H 2020-04-13 13:14:35 +03:00
pinctrl-tigerlake.c pinctrl: tigerlake: Add support for Tiger Lake-H 2020-06-29 17:39:06 +03:00