From: Kevin Hilman Date: Tue, 23 Oct 2012 18:09:31 +0000 (-0700) Subject: gpio/omap: fix off-mode bug: clear debounce clock enable mask on disable X-Git-Tag: next-20121025~16^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dd7ebd6de33c544e1a7afe50abf0f90506c8d62d;p=karo-tx-linux.git gpio/omap: fix off-mode bug: clear debounce clock enable mask on disable When debounce clocks are disabled, ensure that the banks dbck_enable_mask is cleared also. Otherwise, context restore on subsequent off-mode transition will restore previous value 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. Then, enabling off mode causing bogus state to be restored, leaving GPIO debounce enabled which then prevented the CORE powerdomain from transitioning. Cc: stable@kernel.org Reported-by: Paul Walmsley Cc: Igor Grinberg Acked-by: Santosh Shilimkar Acked-by: Felipe Balbi Signed-off-by: Kevin Hilman Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc3..dee2856cafbd 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -187,6 +187,7 @@ static inline void _gpio_dbck_disable(struct gpio_bank *bank) * to detect events and generate interrupts at least on OMAP3. */ __raw_writel(0, bank->base + bank->regs->debounce_en); + bank->dbck_enable_mask = 0; clk_disable(bank->dbck); bank->dbck_enabled = false;