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> 15*f7b861b7SThomas Gleixner #include <linux/cpu.h> 16*f7b861b7SThomas Gleixner 17c3dada18SMagnus Damm #include <asm/io.h> 189f97da78SDavid Howells #include <asm/system_misc.h> 19c3dada18SMagnus Damm 20c3dada18SMagnus Damm static int shmobile_suspend_default_enter(suspend_state_t suspend_state) 21c3dada18SMagnus Damm { 22c3dada18SMagnus Damm cpu_do_idle(); 23c3dada18SMagnus Damm return 0; 24c3dada18SMagnus Damm } 25c3dada18SMagnus Damm 26c3dada18SMagnus Damm static int shmobile_suspend_begin(suspend_state_t state) 27c3dada18SMagnus Damm { 28*f7b861b7SThomas Gleixner cpu_idle_poll_ctrl(true); 29c3dada18SMagnus Damm return 0; 30c3dada18SMagnus Damm } 31c3dada18SMagnus Damm 32c3dada18SMagnus Damm static void shmobile_suspend_end(void) 33c3dada18SMagnus Damm { 34*f7b861b7SThomas Gleixner cpu_idle_poll_ctrl(false); 35c3dada18SMagnus Damm } 36c3dada18SMagnus Damm 37c3dada18SMagnus Damm struct platform_suspend_ops shmobile_suspend_ops = { 38c3dada18SMagnus Damm .begin = shmobile_suspend_begin, 39c3dada18SMagnus Damm .end = shmobile_suspend_end, 40c3dada18SMagnus Damm .enter = shmobile_suspend_default_enter, 41c3dada18SMagnus Damm .valid = suspend_valid_only_mem, 42c3dada18SMagnus Damm }; 43c3dada18SMagnus Damm 4421cc1b7eSShawn Guo int __init shmobile_suspend_init(void) 45c3dada18SMagnus Damm { 46c3dada18SMagnus Damm suspend_set_ops(&shmobile_suspend_ops); 47c3dada18SMagnus Damm return 0; 48c3dada18SMagnus Damm } 49