1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2014 Freescale Semiconductor, Inc.
6 #include <linux/clk/imx.h>
7 #include <linux/cpuidle.h>
8 #include <linux/module.h>
9 #include <asm/cpuidle.h>
14 static int imx6sl_enter_wait(struct cpuidle_device *dev,
15 struct cpuidle_driver *drv, int index)
17 imx6_set_lpm(WAIT_UNCLOCKED);
19 * Software workaround for ERR005311, see function
20 * description for details.
22 imx6sl_set_wait_clk(true);
24 imx6sl_set_wait_clk(false);
25 imx6_set_lpm(WAIT_CLOCKED);
30 static struct cpuidle_driver imx6sl_cpuidle_driver = {
31 .name = "imx6sl_cpuidle",
35 ARM_CPUIDLE_WFI_STATE,
39 .target_residency = 75,
40 .flags = CPUIDLE_FLAG_TIMER_STOP,
41 .enter = imx6sl_enter_wait,
47 .safe_state_index = 0,
50 int __init imx6sl_cpuidle_init(void)
52 return cpuidle_register(&imx6sl_cpuidle_driver, NULL);