18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Suspend-to-RAM support code for SH-Mobile ARM 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Magnus Damm 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/pm.h> 98c2ecf20Sopenharmony_ci#include <linux/suspend.h> 108c2ecf20Sopenharmony_ci#include <linux/module.h> 118c2ecf20Sopenharmony_ci#include <linux/err.h> 128c2ecf20Sopenharmony_ci#include <linux/cpu.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <asm/io.h> 158c2ecf20Sopenharmony_ci#include <asm/system_misc.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include "common.h" 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic int shmobile_suspend_default_enter(suspend_state_t suspend_state) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci cpu_do_idle(); 228c2ecf20Sopenharmony_ci return 0; 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic int shmobile_suspend_begin(suspend_state_t state) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci cpu_idle_poll_ctrl(true); 288c2ecf20Sopenharmony_ci return 0; 298c2ecf20Sopenharmony_ci} 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic void shmobile_suspend_end(void) 328c2ecf20Sopenharmony_ci{ 338c2ecf20Sopenharmony_ci cpu_idle_poll_ctrl(false); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct platform_suspend_ops shmobile_suspend_ops = { 378c2ecf20Sopenharmony_ci .begin = shmobile_suspend_begin, 388c2ecf20Sopenharmony_ci .end = shmobile_suspend_end, 398c2ecf20Sopenharmony_ci .enter = shmobile_suspend_default_enter, 408c2ecf20Sopenharmony_ci .valid = suspend_valid_only_mem, 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciint __init shmobile_suspend_init(void) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci suspend_set_ops(&shmobile_suspend_ops); 468c2ecf20Sopenharmony_ci return 0; 478c2ecf20Sopenharmony_ci} 48