Skip to content

Commit a30eceb

Browse files
Marc Gonzalezarndb
authored andcommitted
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 <marc_gonzalez@sigmadesigns.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 2e2843f commit a30eceb

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

arch/arm/mach-tango/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ AFLAGS_smc.o := -Wa,-march=armv7-a$(plus_sec)
33

44
obj-y += setup.o smc.o
55
obj-$(CONFIG_SMP) += platsmp.o
6+
obj-$(CONFIG_SUSPEND) += pm.o

arch/arm/mach-tango/pm.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <linux/init.h>
2+
#include <linux/suspend.h>
3+
#include <asm/suspend.h>
4+
#include "smc.h"
5+
6+
static int tango_pm_powerdown(unsigned long arg)
7+
{
8+
tango_suspend(virt_to_phys(cpu_resume));
9+
10+
return -EIO; /* tango_suspend has failed */
11+
}
12+
13+
static int tango_pm_enter(suspend_state_t state)
14+
{
15+
if (state == PM_SUSPEND_MEM)
16+
return cpu_suspend(0, tango_pm_powerdown);
17+
18+
return -EINVAL;
19+
}
20+
21+
static const struct platform_suspend_ops tango_pm_ops = {
22+
.enter = tango_pm_enter,
23+
.valid = suspend_valid_only_mem,
24+
};
25+
26+
static int __init tango_pm_init(void)
27+
{
28+
suspend_set_ops(&tango_pm_ops);
29+
return 0;
30+
}
31+
32+
late_initcall(tango_pm_init);

arch/arm/mach-tango/smc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ extern int tango_smc(unsigned int val, unsigned int service);
33
#define tango_set_l2_control(val) tango_smc(val, 0x102)
44
#define tango_start_aux_core(val) tango_smc(val, 0x104)
55
#define tango_set_aux_boot_addr(val) tango_smc(val, 0x105)
6+
#define tango_suspend(val) tango_smc(val, 0x120)
67
#define tango_aux_core_die(val) tango_smc(val, 0x121)
78
#define tango_aux_core_kill(val) tango_smc(val, 0x122)

0 commit comments

Comments
 (0)