blob: 74b30bade2c15c380c0d3fd721d5aa80a957ef79 [file] [log] [blame]
Magnus Dammc3dada12011-04-29 02:23:28 +09001/*
2 * Suspend-to-RAM support code for SH-Mobile ARM
3 *
4 * Copyright (C) 2011 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/pm.h>
12#include <linux/suspend.h>
13#include <linux/module.h>
14#include <linux/err.h>
Thomas Gleixnerf7b861b2013-03-21 22:49:38 +010015#include <linux/cpu.h>
16
Magnus Dammc3dada12011-04-29 02:23:28 +090017#include <asm/io.h>
David Howells9f97da72012-03-28 18:30:01 +010018#include <asm/system_misc.h>
Magnus Dammc3dada12011-04-29 02:23:28 +090019
Geert Uytterhoeven2e41e5f2016-01-28 16:20:48 +010020#include "common.h"
21
Magnus Dammc3dada12011-04-29 02:23:28 +090022static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
23{
24 cpu_do_idle();
25 return 0;
26}
27
28static int shmobile_suspend_begin(suspend_state_t state)
29{
Thomas Gleixnerf7b861b2013-03-21 22:49:38 +010030 cpu_idle_poll_ctrl(true);
Magnus Dammc3dada12011-04-29 02:23:28 +090031 return 0;
32}
33
34static void shmobile_suspend_end(void)
35{
Thomas Gleixnerf7b861b2013-03-21 22:49:38 +010036 cpu_idle_poll_ctrl(false);
Magnus Dammc3dada12011-04-29 02:23:28 +090037}
38
39struct platform_suspend_ops shmobile_suspend_ops = {
40 .begin = shmobile_suspend_begin,
41 .end = shmobile_suspend_end,
42 .enter = shmobile_suspend_default_enter,
43 .valid = suspend_valid_only_mem,
44};
45
Shawn Guo21cc1b72012-04-26 21:58:41 +080046int __init shmobile_suspend_init(void)
Magnus Dammc3dada12011-04-29 02:23:28 +090047{
48 suspend_set_ops(&shmobile_suspend_ops);
49 return 0;
50}