summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-08-18 00:19:27 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:34:17 -0800
commit7f44234fa7b98401d71943e3e33cb09e02d6f672 (patch)
tree339bb3068bb49cc1e7d31837608e5f5219ff1ce2 /drivers/gpio
parent908430a117bad953bf00f058eb4c04480d2f357a (diff)
ARM: tegra: gpio: Add support for waking from suspend
Change-Id: Ifd11daa6eac4ca747aba4a4d98f41270b7055bbb Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-tegra.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 6b1e70e58e21..abc0ceeadac3 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -29,6 +29,8 @@
#include <mach/iomap.h>
+#include "pm-irq.h"
+
#define GPIO_BANK(x) ((x) >> 5)
#define GPIO_PORT(x) (((x) >> 3) & 0x3)
#define GPIO_BIT(x) ((x) & 0x7)
@@ -214,6 +216,8 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)
else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
__irq_set_handler_locked(d->irq, handle_edge_irq);
+ tegra_pm_irq_set_wake_type(d->irq, type);
+
return 0;
}
@@ -303,11 +307,25 @@ void tegra_gpio_suspend(void)
local_irq_restore(flags);
}
-static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable)
+static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable)
{
struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d);
- return irq_set_irq_wake(bank->irq, enable);
+ int ret = 0;
+
+ ret = tegra_pm_irq_set_wake(d->irq, enable);
+
+ if (ret)
+ return ret;
+
+ ret = irq_set_irq_wake(bank->irq, enable);
+
+ if (ret)
+ tegra_pm_irq_set_wake(d->irq, !enable);
+
+ return ret;
}
+#else
+#define tegra_gpio_irq_set_wake NULL
#endif
static struct irq_chip tegra_gpio_irq_chip = {
@@ -316,9 +334,8 @@ static struct irq_chip tegra_gpio_irq_chip = {
.irq_mask = tegra_gpio_irq_mask,
.irq_unmask = tegra_gpio_irq_unmask,
.irq_set_type = tegra_gpio_irq_set_type,
-#ifdef CONFIG_PM
- .irq_set_wake = tegra_gpio_wake_enable,
-#endif
+ .irq_set_wake = tegra_gpio_irq_set_wake,
+ .flags = IRQCHIP_MASK_ON_SUSPEND,
};