linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/10] gpio: tegra: add gpio wakeup source handling
@ 2013-03-04 11:39 Joseph Lo
  2013-03-05 18:23 ` Stephen Warren
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Lo @ 2013-03-04 11:39 UTC (permalink / raw)
  To: linux-arm-kernel

This patch add the gpio wakeup source handling for the Tegra platform. It
was be done by enabling the irq for the gpio in the gpio controller and
enabling the bank irq of the gpio in the Tegra legacy irq controller when
the system going to suspend.

Based on the work by:
Varun Wadekar <vwadekar@nvidia.com>

Signed-off-by: Joseph Lo <josephl@nvidia.com>
---
 drivers/gpio/gpio-tegra.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 414ad91..e395635 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -72,6 +72,7 @@ struct tegra_gpio_bank {
 	u32 oe[4];
 	u32 int_enb[4];
 	u32 int_lvl[4];
+	u32 wake_enb[4];
 #endif
 };
 
@@ -333,15 +334,31 @@ static int tegra_gpio_suspend(struct device *dev)
 			bank->oe[p] = tegra_gpio_readl(GPIO_OE(gpio));
 			bank->int_enb[p] = tegra_gpio_readl(GPIO_INT_ENB(gpio));
 			bank->int_lvl[p] = tegra_gpio_readl(GPIO_INT_LVL(gpio));
+
+			/* Enable gpio irq for wake up source */
+			tegra_gpio_writel(bank->wake_enb[p],
+					  GPIO_INT_ENB(gpio));
 		}
 	}
 	local_irq_restore(flags);
 	return 0;
 }
 
-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);
+	int gpio = d->hwirq;
+	u32 port, bit, mask;
+
+	port = GPIO_PORT(gpio);
+	bit = GPIO_BIT(gpio);
+	mask = BIT(bit);
+
+	if (enable)
+		bank->wake_enb[port] |= mask;
+	else
+		bank->wake_enb[port] &= ~mask;
+
 	return irq_set_irq_wake(bank->irq, enable);
 }
 #endif
@@ -353,7 +370,7 @@ static struct irq_chip tegra_gpio_irq_chip = {
 	.irq_unmask	= tegra_gpio_irq_unmask,
 	.irq_set_type	= tegra_gpio_irq_set_type,
 #ifdef CONFIG_PM_SLEEP
-	.irq_set_wake	= tegra_gpio_wake_enable,
+	.irq_set_wake	= tegra_gpio_irq_set_wake,
 #endif
 };
 
-- 
1.8.1.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 01/10] gpio: tegra: add gpio wakeup source handling
  2013-03-04 11:39 [PATCH 01/10] gpio: tegra: add gpio wakeup source handling Joseph Lo
@ 2013-03-05 18:23 ` Stephen Warren
  2013-03-27  8:05   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Warren @ 2013-03-05 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/04/2013 04:39 AM, Joseph Lo wrote:
> This patch add the gpio wakeup source handling for the Tegra platform. It
> was be done by enabling the irq for the gpio in the gpio controller and
> enabling the bank irq of the gpio in the Tegra legacy irq controller when
> the system going to suspend.

Grant, Linus, I assume there's a runtime dependency of the rest of this
series on this first patch. Can I get an ack to take this patch through
the Tegra tree? Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 01/10] gpio: tegra: add gpio wakeup source handling
  2013-03-05 18:23 ` Stephen Warren
@ 2013-03-27  8:05   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-03-27  8:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 5, 2013 at 7:23 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 03/04/2013 04:39 AM, Joseph Lo wrote:
>> This patch add the gpio wakeup source handling for the Tegra platform. It
>> was be done by enabling the irq for the gpio in the gpio controller and
>> enabling the bank irq of the gpio in the Tegra legacy irq controller when
>> the system going to suspend.
>
> Grant, Linus, I assume there's a runtime dependency of the rest of this
> series on this first patch. Can I get an ack to take this patch through
> the Tegra tree? Thanks.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Sorry for taking what, 22 days to ACK this... :(

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-27  8:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 11:39 [PATCH 01/10] gpio: tegra: add gpio wakeup source handling Joseph Lo
2013-03-05 18:23 ` Stephen Warren
2013-03-27  8:05   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).