[ARM] pxa: add MFP_LPM_KEEP_OUTPUT flag to pin config
authorEric Miao <eric.y.miao@gmail.com>
Mon, 11 Jan 2010 13:25:15 +0000 (21:25 +0800)
committerEric Miao <eric.y.miao@gmail.com>
Tue, 11 May 2010 15:24:59 +0000 (17:24 +0200)
Some pins are expected to keep their last level during suspend, and
introduce MFP_LPM_KEEP_OUTPUT for this.

Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
arch/arm/mach-pxa/mfp-pxa2xx.c

index 658b28e..c54cef2 100644 (file)
@@ -25,6 +25,8 @@
 #define MFP_DIR(x)             (((x) >> 23) & 0x1)
 
 #define MFP_LPM_CAN_WAKEUP     (0x1 << 24)
+#define MFP_LPM_KEEP_OUTPUT    (0x1 << 25)
+
 #define WAKEUP_ON_EDGE_RISE    (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE)
 #define WAKEUP_ON_EDGE_FALL    (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_FALL)
 #define WAKEUP_ON_EDGE_BOTH    (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_BOTH)
index cf6b720..c98b5a8 100644 (file)
@@ -328,6 +328,17 @@ static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state)
 {
        int i;
 
+       /* set corresponding PGSR bit of those marked MFP_LPM_KEEP_OUTPUT */
+       for (i = 0; i < pxa_last_gpio; i++) {
+               if ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) &&
+                   (GPDR(i) & GPIO_bit(i))) {
+                       if (GPLR(i) & GPIO_bit(i))
+                               PGSR(i) |= GPIO_bit(i);
+                       else
+                               PGSR(i) &= ~GPIO_bit(i);
+               }
+       }
+
        for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
 
                saved_gafr[0][i] = GAFR_L(i);