diff options
author | eric miao <eric.miao@marvell.com> | 2008-03-11 01:46:28 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 10:29:05 (GMT) |
commit | c0a596d6a138ea281bed4ff3018c07c45dd245a2 (patch) | |
tree | ab3c25663433bf8c3f16026d969f9722d4ecff92 /arch/arm/mach-pxa/pxa27x.c | |
parent | 9b02b2df0099c083ea40ba8c7068e3dcbe381302 (diff) | |
download | linux-c0a596d6a138ea281bed4ff3018c07c45dd245a2.tar.xz |
[ARM] pxa: allow dynamic enable/disable of GPIO wakeup for pxa{25x,27x}
Changes include:
1. rename MFP_LPM_WAKEUP_ENABLE into MFP_LPM_CAN_WAKEUP to indicate
the board capability of this pin to wakeup the system
2. add gpio_set_wake() and keypad_set_wake() to allow dynamically
enable/disable wakeup from GPIOs and keypad GPIO
* these functions are currently kept in mfp-pxa2xx.c due to their
dependency to the MFP configuration
3. pxa2xx_mfp_config() only gives early warning if MFP_LPM_CAN_WAKEUP
is set on incorrect pins
So that the GPIO's wakeup capability is now decided by the following:
a) processor's capability: (only those GPIOs which have dedicated
bits within PWER/PRER/PFER can wakeup the system), this is
initialized by pxa{25x,27x}_init_mfp()
b) board design decides:
- whether the pin is designed to wakeup the system (some of
the GPIOs are configured as other functions, which is not
intended to be a wakeup source), by OR'ing the pin config
with MFP_LPM_CAN_WAKEUP
- which edge the pin is designed to wakeup the system, this
may depends on external peripherals/connections, which is
totally board specific; this is indicated by MFP_LPM_EDGE_*
c) the corresponding device's (most likely the gpio_keys.c) wakeup
attribute:
Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/pxa27x.c')
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 87ade40..b230af2 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -23,6 +23,7 @@ #include <asm/arch/irqs.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/pxa2xx-regs.h> +#include <asm/arch/mfp-pxa27x.h> #include <asm/arch/ohci.h> #include <asm/arch/pm.h> #include <asm/arch/dma.h> @@ -286,37 +287,16 @@ static inline void pxa27x_init_pm(void) {} /* PXA27x: Various gpios can issue wakeup events. This logic only * handles the simple cases, not the WEMUX2 and WEMUX3 options */ -#define PXA27x_GPIO_NOWAKE_MASK \ - ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2)) -#define WAKEMASK(gpio) \ - (((gpio) <= 15) \ - ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \ - : ((gpio == 35) ? (1 << 24) : 0)) - static int pxa27x_set_wake(unsigned int irq, unsigned int on) { int gpio = IRQ_TO_GPIO(irq); uint32_t mask; - if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) { - if (WAKEMASK(gpio) == 0) - return -EINVAL; - - mask = WAKEMASK(gpio); - - if (on) { - if (GRER(gpio) | GPIO_bit(gpio)) - PRER |= mask; - else - PRER &= ~mask; + if (gpio >= 0 && gpio < 128) + return gpio_set_wake(gpio, on); - if (GFER(gpio) | GPIO_bit(gpio)) - PFER |= mask; - else - PFER &= ~mask; - } - goto set_pwer; - } + if (irq == IRQ_KEYPAD) + return keypad_set_wake(on); switch (irq) { case IRQ_RTCAlrm: @@ -329,7 +309,6 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on) return -EINVAL; } -set_pwer: if (on) PWER |= mask; else |