diff options
author | Bitan Biswas <bbiswas@nvidia.com> | 2011-11-15 14:39:02 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:50:16 -0800 |
commit | d42e1fd52adbed786f13bd22dce41fee58146465 (patch) | |
tree | fb09283a2f4f41a2dd5f96a7267adcd22d6cf483 /arch/arm/mach-tegra/wakeups-t3.c | |
parent | c40df1b08359db110ef153d470e3e3da7a5ba575 (diff) |
arm: tegra: power: lp0 wake enable modified
GPIO based lp0 wakeup needed to support search for its irq
as well as GPIO bank irq in table. This is implemented
in this change.
lp0 wakeup irq enable using enable_irq_wake needs to be
called in specific drivers. Additionally, in some cases
wake irq needs to be updated in tegra wakeup table.
bug 890309
bug 902114
Change-Id: I983318172ffb020f565763cfe2bb29018223dcd0
Reviewed-on: http://git-master/r/64395
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: Rffcadeee341a73f2ea6d62e31d507e9a8dce5a0e
Diffstat (limited to 'arch/arm/mach-tegra/wakeups-t3.c')
-rw-r--r-- | arch/arm/mach-tegra/wakeups-t3.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/arch/arm/mach-tegra/wakeups-t3.c b/arch/arm/mach-tegra/wakeups-t3.c index da9ecbfd00d7..823736204362 100644 --- a/arch/arm/mach-tegra/wakeups-t3.c +++ b/arch/arm/mach-tegra/wakeups-t3.c @@ -19,12 +19,11 @@ #include <mach/iomap.h> #include <mach/irqs.h> +#include <mach/gpio.h> #include "gpio-names.h" -#define NUM_WAKE_EVENTS 39 - -static int tegra_wake_event_irq[NUM_WAKE_EVENTS] = { +static int tegra_wake_event_irq[] = { TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PO5), /* wake0 */ TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV1), /* wake1 */ TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PL1), /* wake2 */ @@ -64,14 +63,49 @@ static int tegra_wake_event_irq[NUM_WAKE_EVENTS] = { TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PBB1), /* wake36 */ -EINVAL, /* TEGRA_USB3_VBUS, */ /* wake37 */ -EINVAL, /* TEGRA_USB3_ID, */ /* wake38 */ + INT_USB, /* TEGRA_USB1_UTMIP, */ /* wake39 */ + INT_USB2, /* TEGRA_USB2_UTMIP, */ /* wake40 */ + INT_USB3, /* TEGRA_USB3_UTMIP, */ /* wake41 */ }; int tegra_irq_to_wake(int irq) { int i; - for (i = 0; i < ARRAY_SIZE(tegra_wake_event_irq); i++) - if (tegra_wake_event_irq[i] == irq) + int wake_irq; + int search_gpio; + static int last_wake = -1; + + /* Two level wake irq search for gpio based wakeups - + * 1. check for GPIO irq(based on tegra_wake_event_irq table) + * e.g. for a board, wake7 based on GPIO PU6 and irq==390 done first + * 2. check for gpio bank irq assuming search for GPIO irq + * preceded this search. + * e.g. in this step check for gpio bank irq GPIO6 irq==119 + */ + for (i = 0; i < ARRAY_SIZE(tegra_wake_event_irq); i++) { + /* return if step 1 matches */ + if (tegra_wake_event_irq[i] == irq) { + pr_info("Wake%d for irq=%d\n", i, irq); + last_wake = i; + return i; + } + + /* step 2 below uses saved last_wake from step 1 + * in previous call */ + search_gpio = irq_to_gpio( + tegra_wake_event_irq[i]); + if (search_gpio < 0) + continue; + wake_irq = tegra_gpio_get_bank_int_nr(search_gpio); + if (wake_irq < 0) + continue; + if ((last_wake == i) && + (wake_irq == irq)) { + pr_info("gpio bank wake found: wake%d for irq=%d\n", + i, irq); return i; + } + } return -EINVAL; } @@ -81,7 +115,7 @@ int tegra_wake_to_irq(int wake) if (wake < 0) return -EINVAL; - if (wake >= NUM_WAKE_EVENTS) + if (wake >= ARRAY_SIZE(tegra_wake_event_irq)) return -EINVAL; return tegra_wake_event_irq[wake]; |