From a30eceb7a59daa2d92cca7f2f30b9bd91a8d7111 Mon Sep 17 00:00:00 2001 From: Marc Gonzalez Date: Thu, 7 Jul 2016 15:08:14 +0200 Subject: ARM: tango: add Suspend-to-RAM support Ask firmware to put RAM in self-refresh mode and power system down. echo mem > /sys/power/state See Documentation/power/states.txt Signed-off-by: Marc Gonzalez Signed-off-by: Arnd Bergmann --- arch/arm/mach-tango/pm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 arch/arm/mach-tango/pm.c (limited to 'arch/arm/mach-tango/pm.c') diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c new file mode 100644 index 000000000000..b05c6d6f99d0 --- /dev/null +++ b/arch/arm/mach-tango/pm.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include "smc.h" + +static int tango_pm_powerdown(unsigned long arg) +{ + tango_suspend(virt_to_phys(cpu_resume)); + + return -EIO; /* tango_suspend has failed */ +} + +static int tango_pm_enter(suspend_state_t state) +{ + if (state == PM_SUSPEND_MEM) + return cpu_suspend(0, tango_pm_powerdown); + + return -EINVAL; +} + +static const struct platform_suspend_ops tango_pm_ops = { + .enter = tango_pm_enter, + .valid = suspend_valid_only_mem, +}; + +static int __init tango_pm_init(void) +{ + suspend_set_ops(&tango_pm_ops); + return 0; +} + +late_initcall(tango_pm_init); -- cgit