Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 1 | /* |
| 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 Lee | ee807dd | 2012-03-20 15:22:48 -0500 | [diff] [blame] | 16 | #include <asm/cpuidle.h> |
Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 17 | #include <asm/io.h> |
| 18 | |
Rafael J. Wysocki | 5b41147 | 2012-08-15 20:58:19 +0200 | [diff] [blame] | 19 | static struct cpuidle_driver shmobile_cpuidle_default_driver = { |
Robert Lee | ee807dd | 2012-03-20 15:22:48 -0500 | [diff] [blame] | 20 | .name = "shmobile_cpuidle", |
| 21 | .owner = THIS_MODULE, |
Robert Lee | ee807dd | 2012-03-20 15:22:48 -0500 | [diff] [blame] | 22 | .states[0] = ARM_CPUIDLE_WFI_STATE, |
| 23 | .safe_state_index = 0, /* C1 */ |
| 24 | .state_count = 1, |
Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 25 | }; |
| 26 | |
Rafael J. Wysocki | 5b41147 | 2012-08-15 20:58:19 +0200 | [diff] [blame] | 27 | static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver; |
| 28 | |
Daniel Lezcano | d504709 | 2013-04-03 12:15:15 +0000 | [diff] [blame] | 29 | void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv) |
Rafael J. Wysocki | 5b41147 | 2012-08-15 20:58:19 +0200 | [diff] [blame] | 30 | { |
| 31 | cpuidle_drv = drv; |
| 32 | } |
Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 33 | |
Daniel Lezcano | d504709 | 2013-04-03 12:15:15 +0000 | [diff] [blame] | 34 | int __init shmobile_cpuidle_init(void) |
Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 35 | { |
Daniel Lezcano | 3cf4bc3 | 2013-04-23 08:54:38 +0000 | [diff] [blame] | 36 | return cpuidle_register(cpuidle_drv, NULL); |
Magnus Damm | 0af4817 | 2011-04-29 02:36:07 +0900 | [diff] [blame] | 37 | } |