1 // SPDX-License-Identifier: GPL-2.0-only
3 * based on arch/arm/mach-kirkwood/cpuidle.c
5 * CPU idle support for AT91 SoC
7 * The cpu idle uses wait-for-interrupt and RAM self refresh in order
8 * to implement two idle states -
9 * #1 wait-for-interrupt
10 * #2 wait-for-interrupt and RAM self refresh
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/cpuidle.h>
18 #include <linux/export.h>
19 #include <asm/cpuidle.h>
21 #define AT91_MAX_STATES 2
23 static void (*at91_standby
)(void);
25 /* Actual code that puts the SoC in different idle states */
26 static int at91_enter_idle(struct cpuidle_device
*dev
,
27 struct cpuidle_driver
*drv
,
34 static struct cpuidle_driver at91_idle_driver
= {
37 .states
[0] = ARM_CPUIDLE_WFI_STATE
,
39 .enter
= at91_enter_idle
,
41 .target_residency
= 10000,
43 .desc
= "WFI and DDR Self Refresh",
45 .state_count
= AT91_MAX_STATES
,
48 /* Initialize CPU idle by registering the idle states */
49 static int at91_cpuidle_probe(struct platform_device
*dev
)
51 at91_standby
= (void *)(dev
->dev
.platform_data
);
53 return cpuidle_register(&at91_idle_driver
, NULL
);
56 static struct platform_driver at91_cpuidle_driver
= {
58 .name
= "cpuidle-at91",
60 .probe
= at91_cpuidle_probe
,
62 builtin_platform_driver(at91_cpuidle_driver
);