Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 1 | /* |
| 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 Gleixner | f7b861b | 2013-03-21 22:49:38 +0100 | [diff] [blame] | 15 | #include <linux/cpu.h> |
| 16 | |
Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 17 | #include <asm/io.h> |
David Howells | 9f97da7 | 2012-03-28 18:30:01 +0100 | [diff] [blame] | 18 | #include <asm/system_misc.h> |
Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 19 | |
| 20 | static int shmobile_suspend_default_enter(suspend_state_t suspend_state) |
| 21 | { |
| 22 | cpu_do_idle(); |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | static int shmobile_suspend_begin(suspend_state_t state) |
| 27 | { |
Thomas Gleixner | f7b861b | 2013-03-21 22:49:38 +0100 | [diff] [blame] | 28 | cpu_idle_poll_ctrl(true); |
Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | static void shmobile_suspend_end(void) |
| 33 | { |
Thomas Gleixner | f7b861b | 2013-03-21 22:49:38 +0100 | [diff] [blame] | 34 | cpu_idle_poll_ctrl(false); |
Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | struct platform_suspend_ops shmobile_suspend_ops = { |
| 38 | .begin = shmobile_suspend_begin, |
| 39 | .end = shmobile_suspend_end, |
| 40 | .enter = shmobile_suspend_default_enter, |
| 41 | .valid = suspend_valid_only_mem, |
| 42 | }; |
| 43 | |
Shawn Guo | 21cc1b7 | 2012-04-26 21:58:41 +0800 | [diff] [blame] | 44 | int __init shmobile_suspend_init(void) |
Magnus Damm | c3dada1 | 2011-04-29 02:23:28 +0900 | [diff] [blame] | 45 | { |
| 46 | suspend_set_ops(&shmobile_suspend_ops); |
| 47 | return 0; |
| 48 | } |