Blame view
drivers/cpuidle/cpuidle-at91.c
1.61 KB
1ea60cf70 ARM: 5778/1: AT91... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/* * based on arch/arm/mach-kirkwood/cpuidle.c * * CPU idle support for AT91 SoC * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. * * The cpu idle uses wait-for-interrupt and RAM self refresh in order * to implement two idle states - * #1 wait-for-interrupt * #2 wait-for-interrupt and RAM self refresh */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/cpuidle.h> |
1ea60cf70 ARM: 5778/1: AT91... |
20 |
#include <linux/io.h> |
dc28094b9 arm: Add export.h... |
21 |
#include <linux/export.h> |
7e348b901 ARM: at91: Consol... |
22 |
#include <asm/cpuidle.h> |
1ea60cf70 ARM: 5778/1: AT91... |
23 24 |
#define AT91_MAX_STATES 2 |
5ad945ea5 ARM: at91: cpuidl... |
25 |
static void (*at91_standby)(void); |
1ea60cf70 ARM: 5778/1: AT91... |
26 27 |
/* Actual code that puts the SoC in different idle states */ static int at91_enter_idle(struct cpuidle_device *dev, |
46bcfad7a cpuidle: Single/G... |
28 |
struct cpuidle_driver *drv, |
e978aa7d7 cpuidle: Move dev... |
29 |
int index) |
1ea60cf70 ARM: 5778/1: AT91... |
30 |
{ |
5ad945ea5 ARM: at91: cpuidl... |
31 |
at91_standby(); |
e978aa7d7 cpuidle: Move dev... |
32 |
return index; |
1ea60cf70 ARM: 5778/1: AT91... |
33 |
} |
7e348b901 ARM: at91: Consol... |
34 35 36 |
static struct cpuidle_driver at91_idle_driver = { .name = "at91_idle", .owner = THIS_MODULE, |
7e348b901 ARM: at91: Consol... |
37 38 39 40 |
.states[0] = ARM_CPUIDLE_WFI_STATE, .states[1] = { .enter = at91_enter_idle, .exit_latency = 10, |
a008dad70 ARM: at91: cpuidl... |
41 |
.target_residency = 10000, |
7e348b901 ARM: at91: Consol... |
42 43 44 45 46 |
.name = "RAM_SR", .desc = "WFI and DDR Self Refresh", }, .state_count = AT91_MAX_STATES, }; |
1ea60cf70 ARM: 5778/1: AT91... |
47 |
/* Initialize CPU idle by registering the idle states */ |
5ad945ea5 ARM: at91: cpuidl... |
48 |
static int at91_cpuidle_probe(struct platform_device *dev) |
1ea60cf70 ARM: 5778/1: AT91... |
49 |
{ |
5ad945ea5 ARM: at91: cpuidl... |
50 51 |
at91_standby = (void *)(dev->dev.platform_data); |
22f5d1fa0 ARM: at91: cpuidl... |
52 |
return cpuidle_register(&at91_idle_driver, NULL); |
1ea60cf70 ARM: 5778/1: AT91... |
53 |
} |
5ad945ea5 ARM: at91: cpuidl... |
54 55 56 |
static struct platform_driver at91_cpuidle_driver = { .driver = { .name = "cpuidle-at91", |
5ad945ea5 ARM: at91: cpuidl... |
57 58 59 |
}, .probe = at91_cpuidle_probe, }; |
090d1cf10 drivers/cpuidle: ... |
60 |
builtin_platform_driver(at91_cpuidle_driver); |