blob: 0afeb5c7061c3eab613b7698d6431ac199fd8bf4 [file] [log] [blame]
Magnus Damm0af48172011-04-29 02:36:07 +09001/*
2 * CPUIdle 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/cpuidle.h>
13#include <linux/suspend.h>
14#include <linux/module.h>
15#include <linux/err.h>
Robert Leeee807dd2012-03-20 15:22:48 -050016#include <asm/cpuidle.h>
Magnus Damm0af48172011-04-29 02:36:07 +090017#include <asm/io.h>
18
Rafael J. Wysocki5b411472012-08-15 20:58:19 +020019static struct cpuidle_driver shmobile_cpuidle_default_driver = {
Robert Leeee807dd2012-03-20 15:22:48 -050020 .name = "shmobile_cpuidle",
21 .owner = THIS_MODULE,
Robert Leeee807dd2012-03-20 15:22:48 -050022 .states[0] = ARM_CPUIDLE_WFI_STATE,
23 .safe_state_index = 0, /* C1 */
24 .state_count = 1,
Magnus Damm0af48172011-04-29 02:36:07 +090025};
26
Rafael J. Wysocki5b411472012-08-15 20:58:19 +020027static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
28
Daniel Lezcanod5047092013-04-03 12:15:15 +000029void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
Rafael J. Wysocki5b411472012-08-15 20:58:19 +020030{
31 cpuidle_drv = drv;
32}
Magnus Damm0af48172011-04-29 02:36:07 +090033
Daniel Lezcanod5047092013-04-03 12:15:15 +000034int __init shmobile_cpuidle_init(void)
Magnus Damm0af48172011-04-29 02:36:07 +090035{
Daniel Lezcano3cf4bc32013-04-23 08:54:38 +000036 return cpuidle_register(cpuidle_drv, NULL);
Magnus Damm0af48172011-04-29 02:36:07 +090037}