[ARM] pxa: add ability to set suspend mode
authorMike Rapoport <mike@compulab.co.il>
Tue, 26 May 2009 06:10:18 +0000 (09:10 +0300)
committerEric Miao <eric.y.miao@gmail.com>
Fri, 5 Jun 2009 02:32:48 +0000 (10:32 +0800)
PXA processors have several low-power modes. Currently kernel supports
only one of these modes for PM_SUSPEND_MEM.

This patch adds ability to set desired suspend mode for PXA27x based
machines.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Reviewed-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
arch/arm/mach-pxa/include/mach/pxa27x.h
arch/arm/mach-pxa/pxa27x.c

index 6876e16c2970dc541c079227adf8127d27947c93..0b702693f4583eef6088febcc96d50f986f6873e 100644 (file)
@@ -16,4 +16,7 @@
 #define ARB_DMA_PARK           (1<<25)    /* Be parked with DMA when idle */
 #define ARB_CORE_PARK          (1<<24)    /* Be parked with core when idle */
 #define ARB_LOCK_FLAG          (1<<23)    /* Only Locking masters gain access to the bus */
+
+extern int __init pxa27x_set_pwrmode(unsigned int mode);
+
 #endif /* __MACH_PXA27x_H */
index c54ad8b3343ce98f5f2597161eede4c66b9d30cd..ec68cc16b4e3347631ee427854b99d505e551692 100644 (file)
@@ -203,6 +203,23 @@ static struct clk_lookup pxa27x_clkregs[] = {
 #define SAVE(x)                sleep_save[SLEEP_SAVE_##x] = x
 #define RESTORE(x)     x = sleep_save[SLEEP_SAVE_##x]
 
+/*
+ * allow platforms to override default PWRMODE setting used for PM_SUSPEND_MEM
+ */
+static unsigned int pwrmode = PWRMODE_SLEEP;
+
+int __init pxa27x_set_pwrmode(unsigned int mode)
+{
+       switch (mode) {
+       case PWRMODE_SLEEP:
+       case PWRMODE_DEEPSLEEP:
+               pwrmode = mode;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
 /*
  * List of global PXA peripheral registers to preserve.
  * More ones like CP and general purpose register values are preserved
@@ -254,7 +271,7 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
                pxa_cpu_standby();
                break;
        case PM_SUSPEND_MEM:
-               pxa27x_cpu_suspend(PWRMODE_SLEEP);
+               pxa27x_cpu_suspend(pwrmode);
                break;
        }
 }