ARM: mx25: Add basic suspend/resume support
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/1 ARM: mx25: Add basic suspend/resume support
From: Fabio Estevam <[email protected]>
Tested basic suspend/resume on a mx25pdk:
root at freescale /$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. Suspending console(s) (use no_console_suspend to debug)
(Press the keypad)
PM: suspend of devices complete after 5.637 msecs
PM: late suspend of devices complete after 1.649 msecs
PM: noirq suspend of devices complete after 1.874 msecs
PM: noirq resume of devices complete after 1.643 msecs
PM: early resume of devices complete after 1.923 msecs
PM: resume of devices complete after 62.884 msecs
Restarting tasks ... done.
fec 50038000.ethernet eth0: Link is Down
fec 50038000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx root at freescale /$
--- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/imx25-dt.c | 2 ++ arch/arm/mach-imx/pm-imx25.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-imx/pm-imx25.h | 13 +++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/pm-imx25.c create mode 100644 arch/arm/mach-imx/pm-imx25.h
arch/arm/mach-imx/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-y := time.o cpu.o system.o irq-common.o obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o -obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o +obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o pm-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.o
arch/arm/mach-imx/imx25-dt.c +2 -0
@@ -16,6 +16,7 @@#include <asm/mach/time.h> #include "common.h" #include "mx25.h" +#include "pm-imx25.h" static void __init imx25_dt_init (void ) {
@@ -38,6 +39,7 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") .map_io = mx25_map_io, .init_early = imx25_init_early, .init_irq = mx25_init_irq, + .init_late = mx25_pm_init, .init_time = imx25_timer_init, .init_machine = imx25_dt_init, .dt_compat = imx25_dt_board_compat,
arch/arm/mach-imx/pm-imx25.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/suspend.h> +#include <linux/io.h> +#include "pm-imx25.h" + +static int mx25_suspend_enter (suspend_state_t state) +{ +switch (state) { +case PM_SUSPEND_MEM : +cpu_do_idle (); +break ; + +default : +return -EINVAL ; + } +return 0 ; +} + +static const struct platform_suspend_ops mx25_suspend_ops = { + .enter = mx25_suspend_enter, + .valid = suspend_valid_only_mem, +}; + +void __init mx25_pm_init (void ) +{ +suspend_set_ops (&mx25_suspend_ops); +}
arch/arm/mach-imx/pm-imx25.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifdef CONFIG_PM +void mx25_pm_init (void ); +#else +#define mx25_pm_init NULL +#endif
Signature · 1 line
1.8.3.2
PATCH 1/1 ARM: mx25: Add basic suspend/resume support
Quoted 59 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Tested basic suspend/resume on a mx25pdk:
root at freescale /$ echo mem >
/sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. Suspending console(s) (useno_console_suspendto debug)(Press the keypad)
PM: suspend of devices complete after 5.637 msecs
PM: late suspend of devices complete after 1.649 msecs
PM: noirq suspend of devices complete after 1.874 msecs
PM: noirq resume of devices complete after 1.643 msecs
PM: early resume of devices complete after 1.923 msecs
PM: resume of devices complete after 62.884 msecs
Restarting tasks ... done.
fec 50038000.ethernet eth0: Link is Down
fec 50038000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx root at freescale /$Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/imx25-dt.c | 2 ++ arch/arm/mach-imx/pm-imx25.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-imx/pm-imx25.h | 13 +++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/pm-imx25.c create mode 100644 arch/arm/mach-imx/pm-imx25.harch/arm/mach-imx/Makefile +1
-1@@ -3,7 +3,7 @@ obj-y := time.o cpu.o system.o irq-common.o obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o -obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o +obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o pm-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.oarch/arm/mach-imx/imx25-dt.c +1
-0@@ -16,6 +16,7 @@#include <asm/mach/time.h> #include "common.h" #include "mx25.h" +#include "pm-imx25.h" static void __init imx25_dt_init (void ) {
arch/arm/mach-imx/imx25-dt.c DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") · line 42
Quoted 4 lines
arch/arm/mach-imx/imx25-dt.c +1
-0@@ -38,6 +39,7 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") .map_io = mx25_map_io, .init_early = imx25_init_early, .init_irq = mx25_init_irq, + .init_late = mx25_pm_init,
For new code, please use "imx25" constantly for namespace instead of "mx25".
Quoted 19 lines
arch/arm/mach-imx/imx25-dt.c +0
-0.init_time = imx25_timer_init, .init_machine = imx25_dt_init, .dt_compat = imx25_dt_board_compat,arch/arm/mach-imx/pm-imx25.c new file +10
-0@@ -0,0 +1,35 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/suspend.h>
arch/arm/mach-imx/pm-imx25.c line 20
Quoted 10 lines
arch/arm/mach-imx/pm-imx25.c new file +10
-0+#include <linux/io.h> +#include "pm-imx25.h" + +static int mx25_suspend_enter (suspend_state_t state) +{ +switch (state) { +case PM_SUSPEND_MEM : +cpu_do_idle (); +break ; +
Nit: drop this new line ...
arch/arm/mach-imx/pm-imx25.c line 23
Quoted 3 lines
arch/arm/mach-imx/pm-imx25.c new file +3
-0+default : +return -EINVAL ; + }
... and have a new line here.
Quoted 21 lines
arch/arm/mach-imx/pm-imx25.c new file +12
-0+return 0 ; +} + +static const struct platform_suspend_ops mx25_suspend_ops = { + .enter = mx25_suspend_enter, + .valid = suspend_valid_only_mem, +}; + +void __init mx25_pm_init (void ) +{ +suspend_set_ops (&mx25_suspend_ops); +}arch/arm/mach-imx/pm-imx25.h new file +3
-0@@ -0,0 +1,13 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +*
arch/arm/mach-imx/pm-imx25.h line 13
Quoted 10 lines
arch/arm/mach-imx/pm-imx25.h new file +10
-0+* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifdef CONFIG_PM +void mx25_pm_init (void ); +#else +#define mx25_pm_init NULL +#endif
Not sure if it's worth a new header merely for this. Or you plan to add more stuff later?
Shawn
Quoted 3 lines
Signature · 1 line
1.8.3.2