android_kernel_oneplus_msm8998/drivers/gpio
Russell King 28833fee9f gpio: gpio-omap: fix level interrupt idling
[ Upstream commit d01849f7deba81f4959fd9e51bf20dbf46987d1c ]

Tony notes that the GPIO module does not idle when level interrupts are
in use, as the wakeup appears to get stuck.

After extensive investigation, it appears that the wakeup will only be
cleared if the interrupt status register is cleared while the interrupt
is enabled. However, we are currently clearing it with the interrupt
disabled for level-based interrupts.

It is acknowledged that this observed behaviour conflicts with a
statement in the TRM:

CAUTION
  After servicing the interrupt, the status bit in the interrupt status
  register (GPIOi.GPIO_IRQSTATUS_0 or GPIOi.GPIO_IRQSTATUS_1) must be
  reset and the interrupt line released (by setting the corresponding
  bit of the interrupt status register to 1) before enabling an
  interrupt for the GPIO channel in the interrupt-enable register
  (GPIOi.GPIO_IRQSTATUS_SET_0 or GPIOi.GPIO_IRQSTATUS_SET_1) to prevent
  the occurrence of unexpected interrupts when enabling an interrupt
  for the GPIO channel.

However, this does not appear to be a practical problem.

Further, as reported by Grygorii Strashko <grygorii.strashko@ti.com>,
the TI Android kernel tree has an earlier similar patch as "GPIO: OMAP:
Fix the sequence to clear the IRQ status" saying:

 if the status is cleared after disabling the IRQ then sWAKEUP will not
 be cleared and gates the module transition

When we unmask the level interrupt after the interrupt has been handled,
enable the interrupt and only then clear the interrupt. If the interrupt
is still pending, the hardware will re-assert the interrupt status.

Should the caution note in the TRM prove to be a problem, we could
use a clear-enable-clear sequence instead.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
[tony@atomide.com: updated comments based on an earlier TI patch]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27 09:33:48 +02:00
..
devres.c
gpio-74x164.c
gpio-74xx-mmio.c
gpio-104-idio-16.c
gpio-adnp.c gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input 2019-04-03 06:23:28 +02:00
gpio-adp5520.c
gpio-adp5588.c gpio: adp5588: Fix sleep-in-atomic-context bug 2018-10-10 08:52:10 +02:00
gpio-altera.c gpio: altera: Use handle_level_irq when configured as a level_high 2017-12-16 10:33:51 +01:00
gpio-amd8111.c
gpio-amdpt.c
gpio-arizona.c
gpio-ath79.c gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE 2018-02-03 17:04:26 +01:00
gpio-bcm-kona.c
gpio-brcmstb.c
gpio-bt8xx.c
gpio-clps711x.c
gpio-crystalcove.c
gpio-cs5535.c
gpio-da9052.c
gpio-da9055.c
gpio-davinci.c
gpio-dln2.c
gpio-dwapb.c
gpio-em.c
gpio-ep93xx.c
gpio-etraxfs.c
gpio-f7188x.c
gpio-ge.c
gpio-generic.c
gpio-grgpio.c
gpio-ich.c
gpio-intel-mid.c gpio: intel-mid: Fix build warning when !CONFIG_PM 2018-02-25 11:03:42 +01:00
gpio-iop.c gpio: iop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE 2018-02-03 17:04:25 +01:00
gpio-it87.c
gpio-janz-ttl.c
gpio-kempld.c
gpio-ks8695.c
gpio-loongson.c
gpio-lp3943.c
gpio-lpc18xx.c
gpio-lpc32xx.c
gpio-lynxpoint.c
gpio-max730x.c
gpio-max732x.c
gpio-max7300.c
gpio-max7301.c gpio: max7301: fix driver for use with CONFIG_VMAP_STACK 2019-01-13 10:05:27 +01:00
gpio-mb86s7x.c
gpio-mc9s08dz60.c
gpio-mc33880.c
gpio-mcp23s08.c
gpio-ml-ioh.c gpio: ml-ioh: Fix buffer underwrite on probe error path 2018-09-19 22:48:58 +02:00
gpio-mm-lantiq.c
gpio-moxart.c
gpio-mpc8xxx.c gpio: mpc8xxx: Correct irq handler function 2016-10-28 03:01:25 -04:00
gpio-mpc5200.c
gpio-msic.c gpio: msic: fix error return code in platform_msic_gpio_probe() 2018-11-10 07:41:39 -08:00
gpio-mvebu.c
gpio-mxc.c
gpio-mxs.c
gpio-octeon.c
gpio-omap.c gpio: gpio-omap: fix level interrupt idling 2019-04-27 09:33:48 +02:00
gpio-palmas.c
gpio-pca953x.c gpio: pca953x: Fix NBANK calculation for PCA9536 2016-08-20 18:09:17 +02:00
gpio-pcf857x.c
gpio-pch.c
gpio-pl061.c
gpio-pxa.c
gpio-rc5t583.c
gpio-rcar.c gpio: rcar: Add Runtime PM handling for interrupts 2018-05-26 08:49:00 +02:00
gpio-rdc321x.c
gpio-sa1100.c gpio: sa1100: fix irq probing for ucb1x00 2016-10-07 15:23:42 +02:00
gpio-samsung.c
gpio-sch.c
gpio-sch311x.c
gpio-sodaville.c
gpio-spear-spics.c
gpio-sta2x11.c
gpio-stmpe.c
gpio-stp-xway.c
gpio-sx150x.c
gpio-syscon.c
gpio-tb10x.c
gpio-tc3589x.c
gpio-tegra.c gpio: tegra: Move driver registration to subsys_init level 2018-09-19 22:48:56 +02:00
gpio-timberdale.c
gpio-tps6586x.c
gpio-tps65910.c
gpio-tps65912.c
gpio-ts5500.c
gpio-twl4030.c
gpio-twl6040.c
gpio-tz1090-pdc.c
gpio-tz1090.c
gpio-ucb1400.c
gpio-vf610.c gpio: vf610: Mask all GPIO interrupts 2019-03-23 08:44:25 +01:00
gpio-viperboard.c
gpio-vr41xx.c
gpio-vx855.c
gpio-wm831x.c
gpio-wm8350.c
gpio-wm8994.c
gpio-xgene-sb.c
gpio-xgene.c gpio: xgene: mark PM functions as __maybe_unused 2018-02-25 11:03:50 +01:00
gpio-xilinx.c
gpio-xlp.c
gpio-xtensa.c
gpio-zevio.c
gpio-zx.c
gpio-zynq.c
gpiolib-acpi.c
gpiolib-legacy.c
gpiolib-of.c
gpiolib-sysfs.c
gpiolib.c gpio: No NULL owner 2018-06-16 09:54:26 +02:00
gpiolib.h gpiolib: Mark gpio_suffixes array with __maybe_unused 2018-09-26 08:35:09 +02:00
Kconfig gpio: Fix OF build problem on UM 2016-09-07 08:32:43 +02:00
Makefile