2018-09-07 01:43:23 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2011-04-28 17:23:28 +00:00
|
|
|
/*
|
|
|
|
* Suspend-to-RAM support code for SH-Mobile ARM
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Magnus Damm
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/suspend.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/err.h>
|
2013-03-21 21:49:38 +00:00
|
|
|
#include <linux/cpu.h>
|
|
|
|
|
2011-04-28 17:23:28 +00:00
|
|
|
#include <asm/io.h>
|
2012-03-28 17:30:01 +00:00
|
|
|
#include <asm/system_misc.h>
|
2011-04-28 17:23:28 +00:00
|
|
|
|
2016-01-28 15:20:48 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2011-04-28 17:23:28 +00:00
|
|
|
static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
|
|
|
|
{
|
|
|
|
cpu_do_idle();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int shmobile_suspend_begin(suspend_state_t state)
|
|
|
|
{
|
2013-03-21 21:49:38 +00:00
|
|
|
cpu_idle_poll_ctrl(true);
|
2011-04-28 17:23:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void shmobile_suspend_end(void)
|
|
|
|
{
|
2013-03-21 21:49:38 +00:00
|
|
|
cpu_idle_poll_ctrl(false);
|
2011-04-28 17:23:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct platform_suspend_ops shmobile_suspend_ops = {
|
|
|
|
.begin = shmobile_suspend_begin,
|
|
|
|
.end = shmobile_suspend_end,
|
|
|
|
.enter = shmobile_suspend_default_enter,
|
|
|
|
.valid = suspend_valid_only_mem,
|
|
|
|
};
|
|
|
|
|
2012-04-26 13:58:41 +00:00
|
|
|
int __init shmobile_suspend_init(void)
|
2011-04-28 17:23:28 +00:00
|
|
|
{
|
|
|
|
suspend_set_ops(&shmobile_suspend_ops);
|
|
|
|
return 0;
|
|
|
|
}
|