2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 09:13:55 +08:00
linux-next/drivers/gpio
Jon Hunter c9c55d9211 gpio/omap: fix off-mode bug: clear debounce settings on free/reset
This change was originally titled "gpio/omap: fix off-mode bug: clear debounce
clock enable mask on free/reset". The title has been updated slightly to
reflect (what should be) the final fix.

When a GPIO is freed or shutdown, we need to ensure that any debounce settings
are cleared and if the GPIO is the only GPIO in the bank that is currently
using debounce, then disable the debounce clock as well to save power.

Currently, the debounce settings are not cleared on a GPIO free or shutdown and
so during a context restore on subsequent off-mode transition, the previous
debounce values are restored from the shadow copies (bank->context.debounce*)
leading to mismatch state between driver state and hardware state.

This was discovered when board code was doing

  gpio_request_one()
  gpio_set_debounce()
  gpio_free()

which was leaving the GPIO debounce settings in a confused state.  If that GPIO
bank is subsequently used with off-mode enabled, bogus state would be restored,
leaving GPIO debounce enabled which then prevented the CORE powerdomain from
transitioning.

To fix this, introduce a new function called _clear_gpio_debounce() to clear
any debounce settings when the GPIO is freed or shutdown. If this GPIO is the
last debounce-enabled GPIO in the bank, the debounce will also be cut.

Please note that we cannot use _gpio_dbck_disable() to disable the debounce
clock because this has been specifically created for the gpio suspend path
and is intended to shutdown the debounce clock while debounce is enabled.

Special thanks to Kevin Hilman for root causing the bug. This fix is a
collaborative effort with inputs from Kevin Hilman, Grazvydas Ignotas and
Santosh Shilimkar.

Testing:
- This has been unit tested on an OMAP3430 Beagle board, by requesting a gpio,
  enabling debounce and then freeing the gpio and checking the register
  contents, the saved register context and the debounce clock state.
- Kevin Hilman tested on 37xx/EVM board which configures GPIO debounce for the
  ads7846 touchscreen in its board file using the above sequence, and so was
  failing off-mode tests in dynamic idle. Verified that off-mode tests are
  passing with this patch.

V5 changes:
- Corrected author

Reported-by: Paul Walmsley <paul@pwsan.com>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Grazvydas Ignotas <notasas@gmail.com>
Cc: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-10-27 18:27:11 +02:00
..
devres.c gpio: export devm_gpio_request_one 2012-07-05 14:49:13 +02:00
gpio-74x164.c gpio-74x164: Fix buffer allocation size 2012-10-16 19:34:43 +02:00
gpio-ab8500.c gpio: ab8500: fix MODULE_ALIAS for ab8500 2011-07-28 16:19:23 -06:00
gpio-adnp.c gpio: Add Avionic Design N-bit GPIO expander support 2012-09-18 23:27:25 +02:00
gpio-adp5520.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-adp5588.c gpio: adp5588: Use module_i2c_driver 2012-09-04 09:24:10 +02:00
gpio-amd8111.c gpio: add a driver for GPIO pins found on AMD-8111 south bridge chips 2012-07-12 13:40:13 +02:00
gpio-arizona.c gpiolib: Add support for Wolfson Microelectronics Arizona class devices 2012-07-17 20:59:53 +02:00
gpio-bt8xx.c Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2012-10-07 17:49:05 +09:00
gpio-cs5535.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-da9052.c gpio: da9052: Convert to use devm_kzalloc API 2012-09-01 12:53:56 +02:00
gpio-davinci.c gpio: davinci: preparation for switch to common clock framework 2012-09-01 01:12:01 +02:00
gpio-em.c So this is the LW GPIO patch stack for v3.7: 2012-10-02 16:05:10 -07:00
gpio-ep93xx.c gpio/generic: initialize basic_mmio_gpio shadow variables properly 2012-05-19 12:17:35 -06:00
gpio-ge.c powerpc/85xx: Board support for GE IMP3A 2012-03-16 11:15:48 -05:00
gpio-generic.c gpio/generic: initialize basic_mmio_gpio shadow variables properly 2012-05-19 12:17:35 -06:00
gpio-ich.c gpio: gpio-ich: Share ownership of GPIO groups 2012-09-14 09:52:13 +02:00
gpio-it8761e.c gpio: reorganize drivers 2011-06-06 10:10:11 -06:00
gpio-janz-ttl.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-ks8695.c ARM: 7036/1: mach-ks8695: break out GPIO driver specifics 2011-08-22 09:12:54 +01:00
gpio-langwell.c drivers/gpio/gpio-langwell.c: fix error return code 2012-08-07 08:55:52 +02:00
gpio-lpc32xx.c So this is the LW GPIO patch stack for v3.7: 2012-10-02 16:05:10 -07:00
gpio-max730x.c gpio: reorganize drivers 2011-06-06 10:10:11 -06:00
gpio-max732x.c gpio: reorganize drivers 2011-06-06 10:10:11 -06:00
gpio-max7300.c gpio: reorganize drivers 2011-06-06 10:10:11 -06:00
gpio-max7301.c gpio: reorganize drivers 2011-06-06 10:10:11 -06:00
gpio-mc9s08dz60.c gpio: mc9s08dz60: Use devm_kzalloc API 2012-09-01 01:02:27 +02:00
gpio-mc33880.c drivers/gpio: Fix drivers who are implicit users of module.h 2011-10-31 19:31:47 -04:00
gpio-mcp23s08.c gpio-mcp23s08: dbg_show: fix pullup configuration display 2012-05-18 16:48:35 -06:00
gpio-ml-ioh.c gpio: gpio-ml-ioh: Use spinlock for register access protection 2012-08-17 07:35:42 +02:00
gpio-mm-lantiq.c GPIO: MIPS: lantiq: convert gpio-mm-lantiq to OF and of_mm_gpio 2012-05-21 14:31:53 +01:00
gpio-mpc8xxx.c gpio/mpc8xxx: add a const qualifier 2012-09-11 08:56:39 +02:00
gpio-mpc5200.c drivers/gpio: Fix drivers who are implicit users of module.h 2011-10-31 19:31:47 -04:00
gpio-msic.c gpio: msic: Fix calculating register address in msic_gpio_to_oreg() 2012-08-05 01:09:50 +02:00
gpio-msm-v1.c gpio_msm: Move Qualcomm v6 MSM driver into drivers 2011-08-01 04:58:00 -07:00
gpio-msm-v2.c gpio_msm: using for_each_set_bit to simplify the code 2012-09-18 23:16:54 +02:00
gpio-mvebu.c gpio: mvebu: correctly set the value in direction_output() 2012-10-24 07:36:35 +02:00
gpio-mxc.c gpio/mxc: specify gpio base for device tree probe 2012-08-07 08:55:22 +02:00
gpio-mxs.c gpio/mxs: adopt irq_domain support for mxs gpio driver 2012-09-03 09:31:44 +08:00
gpio-omap.c gpio/omap: fix off-mode bug: clear debounce settings on free/reset 2012-10-27 18:27:11 +02:00
gpio-pca953x.c gpio/pca953x: increase variables size to support 24 bit of data 2012-07-17 21:00:18 +02:00
gpio-pcf857x.c gpio: pcf857x: fixup smatch WARNING 2012-09-12 17:45:01 +02:00
gpio-pch.c gpio: gpio-pch: Use spinlock for register access protection 2012-08-17 07:35:42 +02:00
gpio-pl061.c gpio/gpio-pl061: No need of thaw and poweroff routines for hibernate 2012-02-16 06:37:51 -07:00
gpio-pxa.c So this is the LW GPIO patch stack for v3.7: 2012-10-02 16:05:10 -07:00
gpio-rc5t583.c gpio/rc5t583: add gpio driver for RICOH PMIC RC5T583 2012-05-18 22:59:28 -06:00
gpio-rdc321x.c gpio: rdc321x: Prevent removal of modules exporting active GPIOs 2012-09-01 12:52:24 +02:00
gpio-sa1100.c ARM: 7342/2: sa1100: prepare for sparse irq conversion 2012-03-25 23:57:20 +01:00
gpio-samsung.c ARM: soc: driver specific changes 2012-10-01 18:46:13 -07:00
gpio-sch.c gpio-sch: Fix leak of resource 2012-08-05 00:33:48 +02:00
gpio-sodaville.c gpio: Use DEFINE_PCI_DEVICE_TABLE macro 2012-09-04 09:23:07 +02:00
gpio-sta2x11.c gpio-sta2x11: don't use pdata if null 2012-07-05 14:48:49 +02:00
gpio-stmpe.c GPIO changes for v3.4 2012-03-28 14:08:46 -07:00
gpio-stp-xway.c GPIO: MIPS: lantiq: fix overflow inside stp-xway driver 2012-09-13 10:31:00 +02:00
gpio-sx150x.c gpio: sx150x: Use irq_data_get_irq_chip_data() at appropriate places 2012-09-06 09:19:04 +02:00
gpio-tc3589x.c gpio: Enable the tc3298x GPIO expander driver for Device Tree 2012-09-12 23:15:46 +02:00
gpio-tegra.c gpio: tegra: remove useless includes of <mach/*.h> 2012-09-06 11:46:59 -06:00
gpio-timberdale.c gpio-timberdale: fix a potential wrapping issue 2012-10-15 20:50:03 +02:00
gpio-tnetv107x.c ARM: 7039/1: mach-davinci: move DaVinci TNET GPIO driver to GPIO subsystem 2011-08-22 09:12:55 +01:00
gpio-tps6586x.c gpio: tps6586x: Add gpio support through platform driver 2012-07-25 00:36:54 +02:00
gpio-tps65910.c gpio/gpio-tps65910: gpio_chip.of_node referenced without CONFIG_OF_GPIO defined 2012-07-10 22:53:31 +02:00
gpio-tps65912.c gpio: tps65912: Convert to use devm_kzalloc API 2012-09-01 12:55:30 +02:00
gpio-twl4030.c This branch contains changes needed to make omap2+ 2012-09-16 15:35:06 -07:00
gpio-twl6040.c gpio: Add basic support for TWL6040 GPOs 2012-09-19 12:21:20 +02:00
gpio-ucb1400.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-vr41xx.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-vt8500.c arm: vt8500: gpio: Devicetree support for arch-vt8500 2012-09-21 19:23:59 +12:00
gpio-vx855.c gpio: Convert GPIO drivers to module_platform_driver 2012-01-02 00:26:06 -07:00
gpio-wm831x.c gpio: wm831x: Convert to use devm_kzalloc API 2012-09-04 09:25:13 +02:00
gpio-wm8350.c gpio: wm8350: Convert to use devm_kzalloc API 2012-09-04 09:26:06 +02:00
gpio-wm8994.c GPIO changes for v3.6: 2012-07-26 13:56:38 -07:00
gpio-xilinx.c gpiolib: output basic details and consolidate gpio device drivers 2011-12-12 13:40:16 -07:00
gpiolib-of.c gpio: Fix debug message in of_get_named_gpio_flags() 2012-08-17 07:35:25 +02:00
gpiolib.c gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios 2012-10-26 09:25:10 +02:00
Kconfig ARM: soc: late platform updates 2012-10-07 20:55:16 +09:00
Makefile ARM: soc: late platform updates 2012-10-07 20:55:16 +09:00