Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / arm / mach-imx / cpuidle-imx6sl.c
blob4521e5352bf64825043254da51664e1d8970351e
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2014 Freescale Semiconductor, Inc.
4 */
6 #include <linux/cpuidle.h>
7 #include <linux/module.h>
8 #include <asm/cpuidle.h>
10 #include "common.h"
11 #include "cpuidle.h"
13 static int imx6sl_enter_wait(struct cpuidle_device *dev,
14 struct cpuidle_driver *drv, int index)
16 imx6_set_lpm(WAIT_UNCLOCKED);
18 * Software workaround for ERR005311, see function
19 * description for details.
21 imx6sl_set_wait_clk(true);
22 cpu_do_idle();
23 imx6sl_set_wait_clk(false);
24 imx6_set_lpm(WAIT_CLOCKED);
26 return index;
29 static struct cpuidle_driver imx6sl_cpuidle_driver = {
30 .name = "imx6sl_cpuidle",
31 .owner = THIS_MODULE,
32 .states = {
33 /* WFI */
34 ARM_CPUIDLE_WFI_STATE,
35 /* WAIT */
37 .exit_latency = 50,
38 .target_residency = 75,
39 .flags = CPUIDLE_FLAG_TIMER_STOP,
40 .enter = imx6sl_enter_wait,
41 .name = "WAIT",
42 .desc = "Clock off",
45 .state_count = 2,
46 .safe_state_index = 0,
49 int __init imx6sl_cpuidle_init(void)
51 return cpuidle_register(&imx6sl_cpuidle_driver, NULL);