diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2013-08-29 12:32:35 +0900 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2013-10-04 17:58:06 -0700 |
commit | 67a86f5a21bd9677f20691e36a3afca5a4a76730 (patch) | |
tree | 3153766843e56111839056643794c56895032b8f | |
parent | f6dfb71954d5eae988074f7d2781a8e57afc0a8e (diff) |
ARM: tegra: add wakeup sources tuning functions
Add tegra_set_wake_gpio() and tegra_set_wake_irq() functions that allow
board files to customize wakeup sources.
Wake sources are fixed and currently defined in wakeups-t11x.c. Defining
custom wake sources for a given project is difficult and can only be
done by:
1) Having compilation conditionals into wakeups-t11x.c to perform
per-board modifications (as is done for Dalmore currently), or
2) Duplicating wakeups-t11x.c and all the code it contains and compiling
the corresponding wakeups sources file for the board.
Neither or these methods can scale, and both actually break the ability
to boot the same kernel binary on different boards. This patch exports
functions that the board init functions can use to modify the wakeup
sources as they need, keeping board-specific changes into board-specific
files.
Change-Id: I2803e5a76f2fc7eaaa9bd343c904719b018357bd
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-on: http://git-master/r/267689
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/281795
Reviewed-by: Todd Poynter <tpoynter@nvidia.com>
Tested-by: Todd Poynter <tpoynter@nvidia.com>
Reviewed-by: Kevin Bruckert <kbruckert@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/pm-irq.h | 10 | ||||
-rw-r--r-- | arch/arm/mach-tegra/wakeups-t11x.c | 21 |
2 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/pm-irq.h b/arch/arm/mach-tegra/pm-irq.h index 10e00e9e513b..1d50e93fe48f 100644 --- a/arch/arm/mach-tegra/pm-irq.h +++ b/arch/arm/mach-tegra/pm-irq.h @@ -23,11 +23,21 @@ u64 tegra_read_pmc_wake_status(void); int tegra_pm_irq_set_wake(int wake, int enable); int tegra_pm_irq_set_wake_type(int wake, int flow_type); bool tegra_pm_irq_lp0_allowed(void); +int tegra_set_wake_gpio(unsigned int wake, int gpio); +int tegra_set_wake_irq(unsigned int wake, int irq); int tegra_gpio_to_wake(int gpio); int tegra_irq_to_wake(int irq); int tegra_wake_to_irq(int wake); int tegra_disable_wake_source(int wake); #else +static inline int tegra_set_wake_gpio(unsigned int wake, int gpio) +{ + return 0; +} +static inline int tegra_set_wake_irq(unsigned int wake, int irq) +{ + return 0; +} static inline int tegra_pm_irq_set_wake_type(int wake, int flow_type) { return 0; diff --git a/arch/arm/mach-tegra/wakeups-t11x.c b/arch/arm/mach-tegra/wakeups-t11x.c index eb00a78b1f75..5b9b09c797d4 100644 --- a/arch/arm/mach-tegra/wakeups-t11x.c +++ b/arch/arm/mach-tegra/wakeups-t11x.c @@ -150,6 +150,27 @@ static int tegra_wake_event_irq[] = { static int last_gpio = -1; +int tegra_set_wake_gpio(unsigned int wake, int gpio) +{ + if (wake < 0 || wake >= ARRAY_SIZE(tegra_gpio_wakes)) + return -EINVAL; + + tegra_wake_event_irq[wake] = -EAGAIN; + tegra_gpio_wakes[wake] = gpio; + + return 0; +} + +int tegra_set_wake_irq(unsigned int wake, int irq) +{ + if (wake < 0 || wake >= ARRAY_SIZE(tegra_wake_event_irq)) + return -EINVAL; + + tegra_wake_event_irq[wake] = irq; + + return 0; +} + int tegra_gpio_to_wake(int gpio) { int i; |