Skip to content

Commit b8339cb

Browse files
tmlindLee Jones
authored andcommitted
gpio: gpio-omap: add check for off wake capable gpios
[ Upstream commit da38ef3 ] We are currently assuming all GPIOs are non-wakeup capable GPIOs as we not configuring the bank->non_wakeup_gpios like we used to earlier with platform_data. Let's add omap_gpio_is_off_wakeup_capable() to make the handling clearer while considering that later patches may want to configure SoC specific bank->non_wakeup_gpios for the GPIOs in wakeup domain. Cc: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Cc: Keerthy <j-keerthy@ti.com> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Russell King <rmk+kernel@armlinux.org.uk> Cc: Tero Kristo <t-kristo@ti.com> Reported-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Change-Id: I42bef0d830a7c4f7c8a210dfeafb3172e0c45371
1 parent 17d7c85 commit b8339cb

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

drivers/gpio/gpio-omap.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,22 @@ static void omap_clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)
295295
}
296296
}
297297

298+
/*
299+
* Off mode wake-up capable GPIOs in bank(s) that are in the wakeup domain.
300+
* See TRM section for GPIO for "Wake-Up Generation" for the list of GPIOs
301+
* in wakeup domain. If bank->non_wakeup_gpios is not configured, assume none
302+
* are capable waking up the system from off mode.
303+
*/
304+
static bool omap_gpio_is_off_wakeup_capable(struct gpio_bank *bank, u32 gpio_mask)
305+
{
306+
u32 no_wake = bank->non_wakeup_gpios;
307+
308+
if (no_wake)
309+
return !!(~no_wake & gpio_mask);
310+
311+
return false;
312+
}
313+
298314
static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
299315
unsigned trigger)
300316
{
@@ -326,13 +342,7 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
326342
}
327343

328344
/* This part needs to be executed always for OMAP{34xx, 44xx} */
329-
if (!bank->regs->irqctrl) {
330-
/* On omap24xx proceed only when valid GPIO bit is set */
331-
if (bank->non_wakeup_gpios) {
332-
if (!(bank->non_wakeup_gpios & gpio_bit))
333-
goto exit;
334-
}
335-
345+
if (!bank->regs->irqctrl && !omap_gpio_is_off_wakeup_capable(bank, gpio)) {
336346
/*
337347
* Log the edge gpio and manually trigger the IRQ
338348
* after resume if the input level changes
@@ -345,7 +355,6 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
345355
bank->enabled_non_wakeup_gpios &= ~gpio_bit;
346356
}
347357

348-
exit:
349358
bank->level_mask =
350359
readl_relaxed(bank->base + bank->regs->leveldetect0) |
351360
readl_relaxed(bank->base + bank->regs->leveldetect1);

0 commit comments

Comments
 (0)