Skip to content

Commit 82dbb9d

Browse files
Eero Nurkkalatmlind
authored andcommitted
OMAP: GPIO: Avoid generating extra IRQs
It is possible for GPIO IRQ lines configured with falling edge triggering only to get IRQs at the rising edge upon the exit of offmode. And vice versa. Prevent such IRQs to arrive by generating the IRQ obeying the detection scheme. Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
1 parent 79e44c9 commit 82dbb9d

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

arch/arm/plat-omap/gpio.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ void omap2_gpio_resume_after_retention(void)
18951895
return;
18961896
for (i = 0; i < gpio_bank_count; i++) {
18971897
struct gpio_bank *bank = &gpio_bank[i];
1898-
u32 l;
1898+
u32 l, gen, gen0, gen1;
18991899

19001900
if (!(bank->enabled_non_wakeup_gpios))
19011901
continue;
@@ -1916,14 +1916,33 @@ void omap2_gpio_resume_after_retention(void)
19161916
#endif
19171917
l ^= bank->saved_datain;
19181918
l &= bank->non_wakeup_gpios;
1919-
if (l) {
1919+
1920+
/*
1921+
* No need to generate IRQs for the rising edge for gpio IRQs
1922+
* configured with falling edge only; and vice versa.
1923+
*/
1924+
gen0 = l & bank->saved_fallingdetect;
1925+
gen0 &= bank->saved_datain;
1926+
1927+
gen1 = l & bank->saved_risingdetect;
1928+
gen1 &= ~(bank->saved_datain);
1929+
1930+
/* FIXME: Consider GPIO IRQs with level detections properly! */
1931+
gen = l & (~(bank->saved_fallingdetect) &
1932+
~(bank->saved_risingdetect));
1933+
/* Consider all GPIO IRQs needed to be updated */
1934+
gen |= gen0 | gen1;
1935+
1936+
if (gen) {
19201937
u32 old0, old1;
19211938
#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
19221939
defined(CONFIG_ARCH_OMAP4)
19231940
old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
19241941
old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1925-
__raw_writel(old0 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
1926-
__raw_writel(old1 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1942+
__raw_writel(old0 | gen, bank->base +
1943+
OMAP24XX_GPIO_LEVELDETECT0);
1944+
__raw_writel(old1 | gen, bank->base +
1945+
OMAP24XX_GPIO_LEVELDETECT1);
19271946
__raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
19281947
__raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
19291948
#endif

0 commit comments

Comments
 (0)