Skip to contentSkip to conversation

ARM: mx25: Add basic suspend/resume support

PATCH Superseded Fabio Estevam 2 participants 2 messages Feb 2, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 ARM: mx25: Add basic suspend/resume support

From: Fabio Estevam <[email protected]>

Tested basic suspend/resume on a mx25pdk:

$ echo enabled > /sys/class/tty/ttymxc0/power/wakeup
$ echo mem > /sys/power/state

Then press any key in the serial console and the system wakes up.

---
 arch/arm/mach-imx/Makefile     |  2 +-
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/mach-imx25.c |  1 +
 arch/arm/mach-imx/pm-imx25.c   | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-imx/pm-imx25.c
arch/arm/mach-imx/Makefile +1 -1
index fb689d8..9fbe624 100644
@@ -3,7 +3,7 @@ obj-y := cpu.o system.o irq-common.o
 obj-$(CONFIG_SOC_IMX1) += mm-imx1.o
 obj-$(CONFIG_SOC_IMX21) += mm-imx21.o
 
-obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o
+obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o pm-imx25.o
 
 obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o
 obj-$(CONFIG_SOC_IMX27) += mm-imx27.o ehci-imx27.o
arch/arm/mach-imx/common.h +1 -0
index 32b83f0..58a3846 100644
@@ -66,6 +66,7 @@ void imx_gpc_check_dt(void);
 void imx_gpc_set_arm_power_in_lpm(bool power_off);
 void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
+void imx25_pm_init(void);
 
 enum mxc_cpu_pwr_mode {
 	WAIT_CLOCKED,		/* wfi only */
arch/arm/mach-imx/mach-imx25.c +1 -0
index 9379fd0..32dcb5e 100644
@@ -41,6 +41,7 @@ static const char * const imx25_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
 	.init_early	= imx25_init_early,
+	.init_late      = imx25_pm_init,
 	.init_irq	= mx25_init_irq,
 	.dt_compat	= imx25_dt_board_compat,
 MACHINE_END
arch/arm/mach-imx/pm-imx25.c new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ARM: mx25: Add basic suspend/resume support

Quoted 10 lines · On Tuesday 02 February 2016 19:18:06 Fabio Estevam wrote:
arch/arm/mach-imx/pm-imx25.c new file +9 -0
+#ifdef CONFIG_PM
+static int imx25_suspend_enter(suspend_state_t state)
+{
+       switch (state) {
+       case PM_SUSPEND_MEM:
+               cpu_do_idle();
+               break;
+       default:
+               return -EINVAL;

arch/arm/mach-imx/pm-imx25.c line 31

Quoted 10 lines
arch/arm/mach-imx/pm-imx25.c new file +10 -0
+       }
+
+       return 0;
+}
+#else
+static inline int imx25_suspend_enter(suspend_state_t state)
+{
+       return 0;
+}
+#endif

Better remove the #ifdef by doing

void __init imx25_pm_init(void)

{
	if (IS_ENABLED(CONFIG_PM))
		suspend_set_ops(&imx25_suspend_ops);
}

or put the IS_ENABLED() check inside of imx25_suspend_enter().

Arnd