Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296919
b: refs/heads/master
c: 68942ed
h: refs/heads/master
i:
  296917: 5e3be70
  296915: b11dae5
  296911: dcfd5ec
v: v3
  • Loading branch information
Kevin Hilman authored and Grant Likely committed Mar 12, 2012
1 parent d8ddfb8 commit c181b5c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2aa4177264c1a459779d6e35fae22adf17a9232
refs/heads/master: 68942edb09f69b6e09522d1d346665eb3aadde49
34 changes: 34 additions & 0 deletions trunk/drivers/gpio/gpio-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,30 @@ static int omap_gpio_runtime_suspend(struct device *dev)
struct gpio_bank *bank = platform_get_drvdata(pdev);
u32 l1 = 0, l2 = 0;
unsigned long flags;
u32 wake_low, wake_hi;

spin_lock_irqsave(&bank->lock, flags);

/*
* Only edges can generate a wakeup event to the PRCM.
*
* Therefore, ensure any wake-up capable GPIOs have
* edge-detection enabled before going idle to ensure a wakeup
* to the PRCM is generated on a GPIO transition. (c.f. 34xx
* NDA TRM 25.5.3.1)
*
* The normal values will be restored upon ->runtime_resume()
* by writing back the values saved in bank->context.
*/
wake_low = bank->context.leveldetect0 & bank->context.wake_en;
if (wake_low)
__raw_writel(wake_low | bank->context.fallingdetect,
bank->base + bank->regs->fallingdetect);
wake_hi = bank->context.leveldetect1 & bank->context.wake_en;
if (wake_hi)
__raw_writel(wake_hi | bank->context.risingdetect,
bank->base + bank->regs->risingdetect);

if (bank->power_mode != OFF_MODE) {
bank->power_mode = 0;
goto update_gpio_context_count;
Expand Down Expand Up @@ -1256,6 +1278,18 @@ static int omap_gpio_runtime_resume(struct device *dev)

spin_lock_irqsave(&bank->lock, flags);
_gpio_dbck_enable(bank);

/*
* In ->runtime_suspend(), level-triggered, wakeup-enabled
* GPIOs were set to edge trigger also in order to be able to
* generate a PRCM wakeup. Here we restore the
* pre-runtime_suspend() values for edge triggering.
*/
__raw_writel(bank->context.fallingdetect,
bank->base + bank->regs->fallingdetect);
__raw_writel(bank->context.risingdetect,
bank->base + bank->regs->risingdetect);

if (!bank->enabled_non_wakeup_gpios || !bank->workaround_enabled) {
spin_unlock_irqrestore(&bank->lock, flags);
return 0;
Expand Down

0 comments on commit c181b5c

Please sign in to comment.