ARM: mach-shmobile: Suspend-to-RAM support
Magnus Damm
maintainerPATCH 1/1 ARM: mach-shmobile: Suspend-to-RAM support
From: Magnus Damm <[email protected]>
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct shmobile_suspend_ops are kept global to allow cpu-specific code to override the callbacks if needed.
---
arch/arm/mach-shmobile/Makefile | 3 + arch/arm/mach-shmobile/include/mach/common.h | 1 arch/arm/mach-shmobile/suspend.c | 47 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+)
arch/arm/mach-shmobile/Makefile +3 -0
@@ -30,6 +30,9 @@ obj-$(CONFIG_ARCH_SH7377) += entry-intc. obj-$(CONFIG_ARCH_SH7372) += entry-intc.o obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o +# PM objects +obj-$(CONFIG_SUSPEND) += suspend.o + # Board objects obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o
arch/arm/mach-shmobile/include/mach/common.h +1 -0
@@ -8,6 +8,7 @@ struct clk;extern int clk_init (void );extern void shmobile_handle_irq_intc (struct pt_regs *);extern void shmobile_handle_irq_gic (struct pt_regs *); +extern struct platform_suspend_ops shmobile_suspend_ops;extern void sh7367_init_irq (void );extern void sh7367_add_early_devices (void );
arch/arm/mach-shmobile/suspend.c new file +47 -0
47 lines not on this page · raw message
Quoted 9 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct
shmobile_suspend_opsare kept global to allow cpu-specific code to override the callbacks if needed.Signed-off-by Magnus Damm <[email protected]>---
I'd like to test some of my patches on top of this one, but I'm not sure how to wake up the system from sleep.
Thanks,
Rafael
Quoted 77 lines
arch/arm/mach-shmobile/Makefile | 3 + arch/arm/mach-shmobile/include/mach/common.h | 1 arch/arm/mach-shmobile/suspend.c | 47 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+)arch/arm/mach-shmobile/Makefile +3
-0@@ -30,6 +30,9 @@ obj-$(CONFIG_ARCH_SH7377) += entry-intc. obj-$(CONFIG_ARCH_SH7372) += entry-intc.o obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o +# PM objects +obj-$(CONFIG_SUSPEND) += suspend.o + # Board objects obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o obj-$(CONFIG_MACH_G4EVM) += board-g4evm.oarch/arm/mach-shmobile/include/mach/common.h +1
-0@@ -8,6 +8,7 @@ struct clk;extern int clk_init (void );extern void shmobile_handle_irq_intc (struct pt_regs *);extern void shmobile_handle_irq_gic (struct pt_regs *); +extern struct platform_suspend_ops shmobile_suspend_ops;extern void sh7367_init_irq (void );extern void sh7367_add_early_devices (void );arch/arm/mach-shmobile/suspend.c new file +47
-0@@ -0,0 +1,47 @@ +/* +* Suspend-to-RAM support code for SH-Mobile ARM +* +* Copyright (C) 2011 Magnus Damm +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ + +#include <linux/pm.h> +#include <linux/suspend.h> +#include <linux/module.h> +#include <linux/err.h> +#include <asm/system.h> +#include <asm/io.h> + +static int shmobile_suspend_default_enter (suspend_state_t suspend_state) +{ +cpu_do_idle (); +return 0 ; +} + +static int shmobile_suspend_begin (suspend_state_t state) +{ +disable_hlt (); +return 0 ; +} + +static void shmobile_suspend_end (void ) +{ +enable_hlt (); +} + +struct platform_suspend_ops shmobile_suspend_ops = { + .begin = shmobile_suspend_begin, + .end = shmobile_suspend_end, + .enter = shmobile_suspend_default_enter, + .valid = suspend_valid_only_mem, +}; + +static int __init shmobile_suspend_init (void ) +{ +suspend_set_ops (&shmobile_suspend_ops); +return 0 ; +} +late_initcall (shmobile_suspend_init);
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct
shmobile_suspend_opsare kept global to allow cpu-specific code to override the callbacks if needed.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Magnus Damm <[email protected]>---
I'd like to test some of my patches on top of this one, but I'm not sure how to wake up the system from sleep.
On mackerel you press one of the buttons on the edge of the board between the power-supply and the USB console connectors. On ap4evb it might be possible to use "phone" buttons on the board for that too, but you probably have to allow wake up somewhere, last I checked it didn't work out of the box.
Thanks
Guennadi
Quoted 78 lines
Thanks,
RafaelQuoted 73 lines
arch/arm/mach-shmobile/Makefile | 3 + arch/arm/mach-shmobile/include/mach/common.h | 1 arch/arm/mach-shmobile/suspend.c | 47 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+)arch/arm/mach-shmobile/Makefile +3
-0@@ -30,6 +30,9 @@ obj-$(CONFIG_ARCH_SH7377) += entry-intc. obj-$(CONFIG_ARCH_SH7372) += entry-intc.o obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o +# PM objects +obj-$(CONFIG_SUSPEND) += suspend.o + # Board objects obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o obj-$(CONFIG_MACH_G4EVM) += board-g4evm.oarch/arm/mach-shmobile/include/mach/common.h +1
-0@@ -8,6 +8,7 @@ struct clk;extern int clk_init (void );extern void shmobile_handle_irq_intc (struct pt_regs *);extern void shmobile_handle_irq_gic (struct pt_regs *); +extern struct platform_suspend_ops shmobile_suspend_ops;extern void sh7367_init_irq (void );extern void sh7367_add_early_devices (void );arch/arm/mach-shmobile/suspend.c new file +43
-0@@ -0,0 +1,47 @@ +/* +* Suspend-to-RAM support code for SH-Mobile ARM +* +* Copyright (C) 2011 Magnus Damm +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ + +#include <linux/pm.h> +#include <linux/suspend.h> +#include <linux/module.h> +#include <linux/err.h> +#include <asm/system.h> +#include <asm/io.h> + +static int shmobile_suspend_default_enter (suspend_state_t suspend_state) +{ +cpu_do_idle (); +return 0 ; +} + +static int shmobile_suspend_begin (suspend_state_t state) +{ +disable_hlt (); +return 0 ; +} + +static void shmobile_suspend_end (void ) +{ +enable_hlt (); +} + +struct platform_suspend_ops shmobile_suspend_ops = { + .begin = shmobile_suspend_begin, + .end = shmobile_suspend_end, + .enter = shmobile_suspend_default_enter, + .valid = suspend_valid_only_mem, +}; + +static int __init shmobile_suspend_init (void ) +{
Quoted 9 lines
arch/arm/mach-shmobile/suspend.c line 47
Quoted 4 lines
arch/arm/mach-shmobile/suspend.c new file +4
-0+suspend_set_ops (&shmobile_suspend_ops); +return 0 ; +} +late_initcall (shmobile_suspend_init);--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Magnus Damm
maintainerQuoted 13 lines · Guennadi Liakhovetski
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct
shmobile_suspend_opsare kept global to allow cpu-specific code to override the callbacks if needed.Signed-off-by Magnus Damm <[email protected]>---
Quoted 8 lines
Quoted 2 lines
I'd like to test some of my patches on top of this one, but I'm not sure how to wake up the system from sleep.
On mackerel you press one of the buttons on the edge of the board between the power-supply and the USB console connectors. On ap4evb it might be possible to use "phone" buttons on the board for that too, but you probably have to allow wake up somewhere, last I checked it didn't work out of the box.
Yeah, thanks Guennadi!
On Mackerel you can of course use the Androidish keypad to wake up, but the touch panel worked as well last time i tested. Basically any driver that supports wake-up should work.
/ magnus
Quoted 24 lines · Magnus Damm
Quoted 13 lines · Guennadi Liakhovetski
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Magnus Damm
From: Magnus Damm <[email protected]>
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct
shmobile_suspend_opsare kept global to allow cpu-specific code to override the callbacks if needed.Signed-off-by Magnus Damm <[email protected]>---
Quoted 8 lines
Quoted 2 lines
I'd like to test some of my patches on top of this one, but I'm not sure how to wake up the system from sleep.
On mackerel you press one of the buttons on the edge of the board between the power-supply and the USB console connectors. On ap4evb it might be possible to use "phone" buttons on the board for that too, but you probably have to allow wake up somewhere, last I checked it didn't work out of the box.
Quoted 5 lines
Yeah, thanks Guennadi!
On Mackerel you can of course use the Androidish keypad to wake up, but the touch panel worked as well last time i tested. Basically any driver that supports wake-up should work.
The keypad didn't work for me (I guess I'm missing a patch or something), but I was able to wake the board up using the serial console (with one of your recent patches).
Thanks,
Rafael