From aa7b27cb96dbadf29308f87d5e189e46d5ca39ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Tue, 13 Dec 2011 22:39:31 -0800 Subject: ARM: omap4: gpio: Fix omap2_gpio_set_wakeupenables to have an effect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wakeupenable bits set by this function do not take effect unless omap4_trigger_ioctrl is called. This function cannot be safely called after any gpio bank is disabled however, so enable the pad wakeup for all the gpio banks, call omap4_trigger_ioctrl, then disable the gpio banks. Change-Id: I4dd5aac70ebfebe9187fc4058d6470e03f89035b Signed-off-by: Arve Hjønnevåg --- drivers/gpio/gpio-omap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 197e4db..6a9bca6 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -29,6 +29,7 @@ #include #include #include +#include /* for omap4_trigger_ioctrl */ #include "../mux.h" @@ -1320,6 +1321,19 @@ static void omap2_gpio_set_wakeupenables(struct gpio_bank *bank) pad_wakeup = __raw_readl(bank->base + bank->regs->irqenable); + /* + * HACK: Ignore gpios that have multiple sources. + * Gpio 0-3 and 86 are special and may be used as gpio + * interrupts without being connected to the pad that + * mux points to. + */ + if (cpu_is_omap44xx()) { + if (bank->id == 0) + pad_wakeup &= ~0xf; + if (bank->id == 2) + pad_wakeup &= ~BIT(22); + } + for_each_set_bit(i, &pad_wakeup, bank->width) { if (!omap_mux_get_wakeupenable(bank->mux[i])) { bank->context.pad_set_wakeupenable |= BIT(i); @@ -1561,6 +1575,14 @@ int omap2_gpio_prepare_for_idle(int off_mode, bool suspend) if (omap2_gpio_set_edge_wakeup(bank, suspend)) ret = -EBUSY; + } + + if (cpu_is_omap44xx()) + omap4_trigger_ioctrl(); + + list_for_each_entry(bank, &omap_gpio_list, node) { + if (!bank->mod_usage) + continue; if (bank->loses_context) if (pm_runtime_put_sync_suspend(bank->dev) < 0) -- cgit v1.1