diff options
-rw-r--r-- | arch/arm/mach-pxa/mfp-pxa2xx.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index c98b5a8c3b0f..e5b79210a90b 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
@@ -178,8 +178,17 @@ int gpio_set_wake(unsigned int gpio, unsigned int on) | |||
178 | if (!d->valid) | 178 | if (!d->valid) |
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | 180 | ||
181 | if (d->keypad_gpio) | 181 | /* Allow keypad GPIOs to wakeup system when |
182 | return -EINVAL; | 182 | * configured as generic GPIOs. |
183 | */ | ||
184 | if (d->keypad_gpio && (MFP_AF(d->config) == 0) && | ||
185 | (d->config & MFP_LPM_CAN_WAKEUP)) { | ||
186 | if (on) | ||
187 | PKWR |= d->mask; | ||
188 | else | ||
189 | PKWR &= ~d->mask; | ||
190 | return 0; | ||
191 | } | ||
183 | 192 | ||
184 | mux_taken = (PWER & d->mux_mask) & (~d->mask); | 193 | mux_taken = (PWER & d->mux_mask) & (~d->mask); |
185 | if (on && mux_taken) | 194 | if (on && mux_taken) |
@@ -239,21 +248,25 @@ static int pxa27x_pkwr_gpio[] = { | |||
239 | int keypad_set_wake(unsigned int on) | 248 | int keypad_set_wake(unsigned int on) |
240 | { | 249 | { |
241 | unsigned int i, gpio, mask = 0; | 250 | unsigned int i, gpio, mask = 0; |
242 | 251 | struct gpio_desc *d; | |
243 | if (!on) { | ||
244 | PKWR = 0; | ||
245 | return 0; | ||
246 | } | ||
247 | 252 | ||
248 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { | 253 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { |
249 | 254 | ||
250 | gpio = pxa27x_pkwr_gpio[i]; | 255 | gpio = pxa27x_pkwr_gpio[i]; |
256 | d = &gpio_desc[gpio]; | ||
251 | 257 | ||
252 | if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP) | 258 | /* skip if configured as generic GPIO */ |
259 | if (MFP_AF(d->config) == 0) | ||
260 | continue; | ||
261 | |||
262 | if (d->config & MFP_LPM_CAN_WAKEUP) | ||
253 | mask |= gpio_desc[gpio].mask; | 263 | mask |= gpio_desc[gpio].mask; |
254 | } | 264 | } |
255 | 265 | ||
256 | PKWR = mask; | 266 | if (on) |
267 | PKWR |= mask; | ||
268 | else | ||
269 | PKWR &= ~mask; | ||
257 | return 0; | 270 | return 0; |
258 | } | 271 | } |
259 | 272 | ||