All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ARM: mx25: Add basic suspend/resume support
@ 2014-07-03  0:27 Fabio Estevam
  2014-07-03  9:17 ` Shawn Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2014-07-03  0:27 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

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 /$ 

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Change since v1:
- Fix blank lines
- Do not create a new file for storing the prototype

 arch/arm/mach-imx/Makefile   |  2 +-
 arch/arm/mach-imx/imx25-dt.c |  1 +
 arch/arm/mach-imx/mx25.h     |  2 ++
 arch/arm/mach-imx/pm-imx25.c | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-imx/pm-imx25.c

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index a364e20..ddc28d4 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -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
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index cf8032b..2872ef7 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -33,6 +33,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      = imx25_pm_init,
 	.init_machine	= imx25_dt_init,
 	.dt_compat	= imx25_dt_board_compat,
 	.restart	= mxc_restart,
diff --git a/arch/arm/mach-imx/mx25.h b/arch/arm/mach-imx/mx25.h
index ec46640..0bb5894 100644
--- a/arch/arm/mach-imx/mx25.h
+++ b/arch/arm/mach-imx/mx25.h
@@ -114,4 +114,6 @@
 extern int mx25_revision(void);
 #endif
 
+void imx25_pm_init(void);
+
 #endif /* ifndef __MACH_MX25_H__ */
diff --git a/arch/arm/mach-imx/pm-imx25.c b/arch/arm/mach-imx/pm-imx25.c
new file mode 100644
index 0000000..560baba
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx25.c
@@ -0,0 +1,41 @@
+/*
+ * 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>
+
+#ifdef CONFIG_PM
+static int mx25_suspend_enter(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_MEM:
+		cpu_do_idle();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+#else
+static inline int mx25_suspend_enter(suspend_state_t state)
+{
+	return 0;
+}
+#endif
+
+static const struct platform_suspend_ops mx25_suspend_ops = {
+	.enter = mx25_suspend_enter,
+	.valid = suspend_valid_only_mem,
+};
+
+void __init imx25_pm_init(void)
+{
+	suspend_set_ops(&mx25_suspend_ops);
+}
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] ARM: mx25: Add basic suspend/resume support
  2014-07-03  0:27 [PATCH v2] ARM: mx25: Add basic suspend/resume support Fabio Estevam
@ 2014-07-03  9:17 ` Shawn Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2014-07-03  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 02, 2014 at 09:27:17PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> 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 /$ 
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Change since v1:
> - Fix blank lines
> - Do not create a new file for storing the prototype
> 
>  arch/arm/mach-imx/Makefile   |  2 +-
>  arch/arm/mach-imx/imx25-dt.c |  1 +
>  arch/arm/mach-imx/mx25.h     |  2 ++
>  arch/arm/mach-imx/pm-imx25.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 45 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/mach-imx/pm-imx25.c
> 
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index a364e20..ddc28d4 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -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
> diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
> index cf8032b..2872ef7 100644
> --- a/arch/arm/mach-imx/imx25-dt.c
> +++ b/arch/arm/mach-imx/imx25-dt.c
> @@ -33,6 +33,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      = imx25_pm_init,
>  	.init_machine	= imx25_dt_init,
>  	.dt_compat	= imx25_dt_board_compat,
>  	.restart	= mxc_restart,
> diff --git a/arch/arm/mach-imx/mx25.h b/arch/arm/mach-imx/mx25.h
> index ec46640..0bb5894 100644
> --- a/arch/arm/mach-imx/mx25.h
> +++ b/arch/arm/mach-imx/mx25.h
> @@ -114,4 +114,6 @@
>  extern int mx25_revision(void);
>  #endif
>  
> +void imx25_pm_init(void);
> +

Shouldn't this be put into #ifndef __ASSEMBLY__ together with
mx25_revision()?  Or can we simply put it into common.h?

>  #endif /* ifndef __MACH_MX25_H__ */
> diff --git a/arch/arm/mach-imx/pm-imx25.c b/arch/arm/mach-imx/pm-imx25.c
> new file mode 100644
> index 0000000..560baba
> --- /dev/null
> +++ b/arch/arm/mach-imx/pm-imx25.c
> @@ -0,0 +1,41 @@
> +/*
> + * 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>
> +
> +#ifdef CONFIG_PM
> +static int mx25_suspend_enter(suspend_state_t state)

imx25_suspend_enter

> +{
> +	switch (state) {
> +	case PM_SUSPEND_MEM:
> +		cpu_do_idle();
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +#else
> +static inline int mx25_suspend_enter(suspend_state_t state)
> +{
> +	return 0;
> +}
> +#endif
> +
> +static const struct platform_suspend_ops mx25_suspend_ops = {

imx25_suspend_ops

Shawn

> +	.enter = mx25_suspend_enter,
> +	.valid = suspend_valid_only_mem,
> +};
> +
> +void __init imx25_pm_init(void)
> +{
> +	suspend_set_ops(&mx25_suspend_ops);
> +}
> -- 
> 1.8.3.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ARM: mx25: Add basic suspend/resume support
  2016-02-02 21:45 Fabio Estevam
@ 2016-02-14  3:24 ` Shawn Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2016-02-14  3:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Feb 02, 2016 at 07:45:38PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> 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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ARM: mx25: Add basic suspend/resume support
@ 2016-02-02 21:45 Fabio Estevam
  2016-02-14  3:24 ` Shawn Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2016-02-02 21:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@nxp.com>

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.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Use IS_ENABLED() instead of ifdef (Arnd).

 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   | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-imx/pm-imx25.c

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index fb689d8..9fbe624 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -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
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 32b83f0..58a3846 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -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 */
diff --git a/arch/arm/mach-imx/mach-imx25.c b/arch/arm/mach-imx/mach-imx25.c
index 9379fd0..32dcb5e 100644
--- a/arch/arm/mach-imx/mach-imx25.c
+++ b/arch/arm/mach-imx/mach-imx25.c
@@ -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
diff --git a/arch/arm/mach-imx/pm-imx25.c b/arch/arm/mach-imx/pm-imx25.c
new file mode 100644
index 0000000..8bba9fc
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx25.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 NXP Semiconductors
+ *
+ * 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>
+
+static int imx25_suspend_enter(suspend_state_t state)
+{
+	if (!IS_ENABLED(CONFIG_PM))
+		return 0;
+
+	switch (state) {
+	case PM_SUSPEND_MEM:
+		cpu_do_idle();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static const struct platform_suspend_ops imx25_suspend_ops = {
+	.enter = imx25_suspend_enter,
+	.valid = suspend_valid_only_mem,
+};
+
+void __init imx25_pm_init(void)
+{
+	suspend_set_ops(&imx25_suspend_ops);
+}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-14  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03  0:27 [PATCH v2] ARM: mx25: Add basic suspend/resume support Fabio Estevam
2014-07-03  9:17 ` Shawn Guo
2016-02-02 21:45 Fabio Estevam
2016-02-14  3:24 ` Shawn Guo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.