diff options
Diffstat (limited to 'arch/arm/mach-pxa/mfp-pxa2xx.c')
-rw-r--r-- | arch/arm/mach-pxa/mfp-pxa2xx.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index cf6b720c055..1d1419b7345 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
@@ -81,6 +81,7 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c) | |||
81 | PGSR(bank) &= ~mask; | 81 | PGSR(bank) &= ~mask; |
82 | is_out = 1; | 82 | is_out = 1; |
83 | break; | 83 | break; |
84 | case MFP_LPM_INPUT: | ||
84 | case MFP_LPM_DEFAULT: | 85 | case MFP_LPM_DEFAULT: |
85 | break; | 86 | break; |
86 | default: | 87 | default: |
@@ -178,8 +179,17 @@ int gpio_set_wake(unsigned int gpio, unsigned int on) | |||
178 | if (!d->valid) | 179 | if (!d->valid) |
179 | return -EINVAL; | 180 | return -EINVAL; |
180 | 181 | ||
181 | if (d->keypad_gpio) | 182 | /* Allow keypad GPIOs to wakeup system when |
182 | return -EINVAL; | 183 | * configured as generic GPIOs. |
184 | */ | ||
185 | if (d->keypad_gpio && (MFP_AF(d->config) == 0) && | ||
186 | (d->config & MFP_LPM_CAN_WAKEUP)) { | ||
187 | if (on) | ||
188 | PKWR |= d->mask; | ||
189 | else | ||
190 | PKWR &= ~d->mask; | ||
191 | return 0; | ||
192 | } | ||
183 | 193 | ||
184 | mux_taken = (PWER & d->mux_mask) & (~d->mask); | 194 | mux_taken = (PWER & d->mux_mask) & (~d->mask); |
185 | if (on && mux_taken) | 195 | if (on && mux_taken) |
@@ -239,21 +249,25 @@ static int pxa27x_pkwr_gpio[] = { | |||
239 | int keypad_set_wake(unsigned int on) | 249 | int keypad_set_wake(unsigned int on) |
240 | { | 250 | { |
241 | unsigned int i, gpio, mask = 0; | 251 | unsigned int i, gpio, mask = 0; |
242 | 252 | struct gpio_desc *d; | |
243 | if (!on) { | ||
244 | PKWR = 0; | ||
245 | return 0; | ||
246 | } | ||
247 | 253 | ||
248 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { | 254 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { |
249 | 255 | ||
250 | gpio = pxa27x_pkwr_gpio[i]; | 256 | gpio = pxa27x_pkwr_gpio[i]; |
257 | d = &gpio_desc[gpio]; | ||
251 | 258 | ||
252 | if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP) | 259 | /* skip if configured as generic GPIO */ |
260 | if (MFP_AF(d->config) == 0) | ||
261 | continue; | ||
262 | |||
263 | if (d->config & MFP_LPM_CAN_WAKEUP) | ||
253 | mask |= gpio_desc[gpio].mask; | 264 | mask |= gpio_desc[gpio].mask; |
254 | } | 265 | } |
255 | 266 | ||
256 | PKWR = mask; | 267 | if (on) |
268 | PKWR |= mask; | ||
269 | else | ||
270 | PKWR &= ~mask; | ||
257 | return 0; | 271 | return 0; |
258 | } | 272 | } |
259 | 273 | ||
@@ -328,6 +342,17 @@ static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state) | |||
328 | { | 342 | { |
329 | int i; | 343 | int i; |
330 | 344 | ||
345 | /* set corresponding PGSR bit of those marked MFP_LPM_KEEP_OUTPUT */ | ||
346 | for (i = 0; i < pxa_last_gpio; i++) { | ||
347 | if ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) && | ||
348 | (GPDR(i) & GPIO_bit(i))) { | ||
349 | if (GPLR(i) & GPIO_bit(i)) | ||
350 | PGSR(i) |= GPIO_bit(i); | ||
351 | else | ||
352 | PGSR(i) &= ~GPIO_bit(i); | ||
353 | } | ||
354 | } | ||
355 | |||
331 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { | 356 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { |
332 | 357 | ||
333 | saved_gafr[0][i] = GAFR_L(i); | 358 | saved_gafr[0][i] = GAFR_L(i); |