xref: /openbmc/linux/arch/arm/mach-shmobile/suspend.c (revision 21cc1b7ede3cf456cf1d51f8a906093261f7c111)
1c3dada18SMagnus Damm /*
2c3dada18SMagnus Damm  * Suspend-to-RAM support code for SH-Mobile ARM
3c3dada18SMagnus Damm  *
4c3dada18SMagnus Damm  *  Copyright (C) 2011 Magnus Damm
5c3dada18SMagnus Damm  *
6c3dada18SMagnus Damm  * This file is subject to the terms and conditions of the GNU General Public
7c3dada18SMagnus Damm  * License.  See the file "COPYING" in the main directory of this archive
8c3dada18SMagnus Damm  * for more details.
9c3dada18SMagnus Damm  */
10c3dada18SMagnus Damm 
11c3dada18SMagnus Damm #include <linux/pm.h>
12c3dada18SMagnus Damm #include <linux/suspend.h>
13c3dada18SMagnus Damm #include <linux/module.h>
14c3dada18SMagnus Damm #include <linux/err.h>
15c3dada18SMagnus Damm #include <asm/io.h>
169f97da78SDavid Howells #include <asm/system_misc.h>
17c3dada18SMagnus Damm 
18c3dada18SMagnus Damm static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
19c3dada18SMagnus Damm {
20c3dada18SMagnus Damm 	cpu_do_idle();
21c3dada18SMagnus Damm 	return 0;
22c3dada18SMagnus Damm }
23c3dada18SMagnus Damm 
24c3dada18SMagnus Damm static int shmobile_suspend_begin(suspend_state_t state)
25c3dada18SMagnus Damm {
26c3dada18SMagnus Damm 	disable_hlt();
27c3dada18SMagnus Damm 	return 0;
28c3dada18SMagnus Damm }
29c3dada18SMagnus Damm 
30c3dada18SMagnus Damm static void shmobile_suspend_end(void)
31c3dada18SMagnus Damm {
32c3dada18SMagnus Damm 	enable_hlt();
33c3dada18SMagnus Damm }
34c3dada18SMagnus Damm 
35c3dada18SMagnus Damm struct platform_suspend_ops shmobile_suspend_ops = {
36c3dada18SMagnus Damm 	.begin		= shmobile_suspend_begin,
37c3dada18SMagnus Damm 	.end		= shmobile_suspend_end,
38c3dada18SMagnus Damm 	.enter		= shmobile_suspend_default_enter,
39c3dada18SMagnus Damm 	.valid		= suspend_valid_only_mem,
40c3dada18SMagnus Damm };
41c3dada18SMagnus Damm 
42*21cc1b7eSShawn Guo int __init shmobile_suspend_init(void)
43c3dada18SMagnus Damm {
44c3dada18SMagnus Damm 	suspend_set_ops(&shmobile_suspend_ops);
45c3dada18SMagnus Damm 	return 0;
46c3dada18SMagnus Damm }
47