Skip to content

Commit 9e303f2

Browse files
notazKevin Hilman
authored andcommitted
gpio/omap: fix irq loss while in idle with debounce on
It seems that currently GPIO module is not working correctly during idle when debounce is enabled - the system almost never responds to button presses (observed on OMAP3530 ES2.1 and OMAP3630 ES1.2 pandora boards). Even though wakeups are probably working, it seems that the GPIO module itself is unable to detect input events and generate interrupts. OMAP35x TRM also states that: "If the debounce clock is inactive, the debounce cell gates all input signals and thus cannot be used." So whenever we are disabling debounce clocks (for PM or other reasons), be sure the module's debounce feature is disabled too. Cc: Kevin Hilman <[email protected]> Signed-off-by: Grazvydas Ignotas <[email protected]> Signed-off-by: Kevin Hilman <[email protected]>
1 parent 6b16351 commit 9e303f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/gpio/gpio-omap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank)
174174
if (bank->dbck_enable_mask && !bank->dbck_enabled) {
175175
clk_enable(bank->dbck);
176176
bank->dbck_enabled = true;
177+
178+
__raw_writel(bank->dbck_enable_mask,
179+
bank->base + bank->regs->debounce_en);
177180
}
178181
}
179182

180183
static inline void _gpio_dbck_disable(struct gpio_bank *bank)
181184
{
182185
if (bank->dbck_enable_mask && bank->dbck_enabled) {
186+
/*
187+
* Disable debounce before cutting it's clock. If debounce is
188+
* enabled but the clock is not, GPIO module seems to be unable
189+
* to detect events and generate interrupts at least on OMAP3.
190+
*/
191+
__raw_writel(0, bank->base + bank->regs->debounce_en);
192+
183193
clk_disable(bank->dbck);
184194
bank->dbck_enabled = false;
185195
}

0 commit comments

Comments
 (0)