summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2019-03-25 18:43:18 -0400
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2019-03-27 09:26:14 -0400
commitda38ef3ed10a09248e13ae16530c2c6d448dc47d (patch)
treea25646dead13b31c69829f204ffe69d3a09f3375 /drivers/gpio/gpio-omap.c
parent06dce84ec76bef5698acc498b76457e585b9efda (diff)
gpio: gpio-omap: add check for off wake capable gpios
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>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index a28196453029..4d1bf884fcbc 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -352,6 +352,22 @@ static void omap_clear_gpio_debounce(struct gpio_bank *bank, unsigned offset)
352 } 352 }
353} 353}
354 354
355/*
356 * Off mode wake-up capable GPIOs in bank(s) that are in the wakeup domain.
357 * See TRM section for GPIO for "Wake-Up Generation" for the list of GPIOs
358 * in wakeup domain. If bank->non_wakeup_gpios is not configured, assume none
359 * are capable waking up the system from off mode.
360 */
361static bool omap_gpio_is_off_wakeup_capable(struct gpio_bank *bank, u32 gpio_mask)
362{
363 u32 no_wake = bank->non_wakeup_gpios;
364
365 if (no_wake)
366 return !!(~no_wake & gpio_mask);
367
368 return false;
369}
370
355static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio, 371static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
356 unsigned trigger) 372 unsigned trigger)
357{ 373{
@@ -383,13 +399,7 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
383 } 399 }
384 400
385 /* This part needs to be executed always for OMAP{34xx, 44xx} */ 401 /* This part needs to be executed always for OMAP{34xx, 44xx} */
386 if (!bank->regs->irqctrl) { 402 if (!bank->regs->irqctrl && !omap_gpio_is_off_wakeup_capable(bank, gpio)) {
387 /* On omap24xx proceed only when valid GPIO bit is set */
388 if (bank->non_wakeup_gpios) {
389 if (!(bank->non_wakeup_gpios & gpio_bit))
390 goto exit;
391 }
392
393 /* 403 /*
394 * Log the edge gpio and manually trigger the IRQ 404 * Log the edge gpio and manually trigger the IRQ
395 * after resume if the input level changes 405 * after resume if the input level changes
@@ -402,7 +412,6 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
402 bank->enabled_non_wakeup_gpios &= ~gpio_bit; 412 bank->enabled_non_wakeup_gpios &= ~gpio_bit;
403 } 413 }
404 414
405exit:
406 bank->level_mask = 415 bank->level_mask =
407 readl_relaxed(bank->base + bank->regs->leveldetect0) | 416 readl_relaxed(bank->base + bank->regs->leveldetect0) |
408 readl_relaxed(bank->base + bank->regs->leveldetect1); 417 readl_relaxed(bank->base + bank->regs->leveldetect1);