aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAxel Haslam <axelhaslam@ti.com>2011-09-13 15:55:19 -0700
committerTodd Poynor <toddpoynor@google.com>2011-10-06 18:47:25 -0700
commit4b660d8efa30f1a8911114fa5007fcc602f8960f (patch)
tree4152287f6ad2d1410a4dfeb7e9d4be8e0102adb7 /drivers/gpio
parentf42515c120a57bb9087e6efba1b447387870878c (diff)
downloadkernel_samsung_tuna-4b660d8efa30f1a8911114fa5007fcc602f8960f.zip
kernel_samsung_tuna-4b660d8efa30f1a8911114fa5007fcc602f8960f.tar.gz
kernel_samsung_tuna-4b660d8efa30f1a8911114fa5007fcc602f8960f.tar.bz2
GPIO: OMAP: set edge trigger for wakeup gpio
Only edge trigger is supported for wakeup. if a gpio is set as wakeup, and level trigger, make sure we set the edge trigger so that we can wake up. Change-Id: Ibb61042be6ce053729ff20f3cb8d53899afe42b1 Signed-off-by: Axel Haslam <axelhaslam@ti.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-omap.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index a06a054..312d45d 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -44,6 +44,8 @@ struct gpio_regs {
u32 dataout;
u32 debounce;
u32 debounce_en;
+ u32 edge_falling;
+ u32 edge_rising;
};
struct gpio_bank {
@@ -1383,6 +1385,51 @@ static int omap_gpio_pm_runtime_resume(struct device *dev)
}
#ifdef CONFIG_ARCH_OMAP2PLUS
+void omap2_gpio_set_edge_wakeup(void)
+{
+ struct gpio_bank *bank;
+
+ list_for_each_entry(bank, &omap_gpio_list, node) {
+ u32 level_low = 0;
+ u32 level_high = 0;
+ u32 wkup_status = 0;
+
+ level_low = __raw_readl(bank->base +
+ bank->regs->leveldetect0);
+ level_high = __raw_readl(bank->base +
+ bank->regs->leveldetect1);
+ wkup_status = __raw_readl(bank->base +
+ bank->regs->wkup_status);
+ bank->context.edge_falling = __raw_readl(bank->base +
+ bank->regs->fallingdetect);
+ bank->context.edge_rising = __raw_readl(bank->base +
+ bank->regs->risingdetect);
+
+ /*
+ * Set edge trigger for all gpio's that are
+ * expected to produce wakeup from low power.
+ * even if they are set for level detection only.
+ */
+ __raw_writel((bank->context.edge_falling | level_low) & wkup_status,
+ (bank->base + bank->regs->fallingdetect));
+ __raw_writel((bank->context.edge_rising | level_high) & wkup_status,
+ (bank->base + bank->regs->risingdetect));
+
+ }
+}
+
+void omap2_gpio_restore_edge_wakeup(void)
+{
+ struct gpio_bank *bank;
+
+ list_for_each_entry(bank, &omap_gpio_list, node) {
+ /* restore edge setting */
+ __raw_writel(bank->context.edge_falling,
+ (bank->base + bank->regs->fallingdetect));
+ __raw_writel(bank->context.edge_rising,
+ (bank->base + bank->regs->risingdetect));
+ }
+}
void omap2_gpio_prepare_for_idle(int off_mode)
{