xref: /OK3568_Linux_fs/kernel/arch/arm/mach-shmobile/suspend.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Suspend-to-RAM support code for SH-Mobile ARM
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *  Copyright (C) 2011 Magnus Damm
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/pm.h>
9*4882a593Smuzhiyun #include <linux/suspend.h>
10*4882a593Smuzhiyun #include <linux/module.h>
11*4882a593Smuzhiyun #include <linux/err.h>
12*4882a593Smuzhiyun #include <linux/cpu.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <asm/io.h>
15*4882a593Smuzhiyun #include <asm/system_misc.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #include "common.h"
18*4882a593Smuzhiyun 
shmobile_suspend_default_enter(suspend_state_t suspend_state)19*4882a593Smuzhiyun static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
20*4882a593Smuzhiyun {
21*4882a593Smuzhiyun 	cpu_do_idle();
22*4882a593Smuzhiyun 	return 0;
23*4882a593Smuzhiyun }
24*4882a593Smuzhiyun 
shmobile_suspend_begin(suspend_state_t state)25*4882a593Smuzhiyun static int shmobile_suspend_begin(suspend_state_t state)
26*4882a593Smuzhiyun {
27*4882a593Smuzhiyun 	cpu_idle_poll_ctrl(true);
28*4882a593Smuzhiyun 	return 0;
29*4882a593Smuzhiyun }
30*4882a593Smuzhiyun 
shmobile_suspend_end(void)31*4882a593Smuzhiyun static void shmobile_suspend_end(void)
32*4882a593Smuzhiyun {
33*4882a593Smuzhiyun 	cpu_idle_poll_ctrl(false);
34*4882a593Smuzhiyun }
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun struct platform_suspend_ops shmobile_suspend_ops = {
37*4882a593Smuzhiyun 	.begin		= shmobile_suspend_begin,
38*4882a593Smuzhiyun 	.end		= shmobile_suspend_end,
39*4882a593Smuzhiyun 	.enter		= shmobile_suspend_default_enter,
40*4882a593Smuzhiyun 	.valid		= suspend_valid_only_mem,
41*4882a593Smuzhiyun };
42*4882a593Smuzhiyun 
shmobile_suspend_init(void)43*4882a593Smuzhiyun int __init shmobile_suspend_init(void)
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun 	suspend_set_ops(&shmobile_suspend_ops);
46*4882a593Smuzhiyun 	return 0;
47*4882a593Smuzhiyun }
48