Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-imx / cpuidle-imx7ulp.c
blobca86c967d19e984462b5899f1f71552a5df73b65
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (C) 2016 Freescale Semiconductor, Inc.
4 * Copyright 2017-2018 NXP
5 * Anson Huang <Anson.Huang@nxp.com>
6 */
8 #include <linux/cpuidle.h>
9 #include <linux/module.h>
10 #include <asm/cpuidle.h>
12 #include "common.h"
13 #include "cpuidle.h"
15 static int imx7ulp_enter_wait(struct cpuidle_device *dev,
16 struct cpuidle_driver *drv, int index)
18 if (index == 1)
19 imx7ulp_set_lpm(ULP_PM_WAIT);
20 else
21 imx7ulp_set_lpm(ULP_PM_STOP);
23 cpu_do_idle();
25 imx7ulp_set_lpm(ULP_PM_RUN);
27 return index;
30 static struct cpuidle_driver imx7ulp_cpuidle_driver = {
31 .name = "imx7ulp_cpuidle",
32 .owner = THIS_MODULE,
33 .states = {
34 /* WFI */
35 ARM_CPUIDLE_WFI_STATE,
36 /* WAIT */
38 .exit_latency = 50,
39 .target_residency = 75,
40 .enter = imx7ulp_enter_wait,
41 .name = "WAIT",
42 .desc = "PSTOP2",
44 /* STOP */
46 .exit_latency = 100,
47 .target_residency = 150,
48 .enter = imx7ulp_enter_wait,
49 .name = "STOP",
50 .desc = "PSTOP1",
53 .state_count = 3,
54 .safe_state_index = 0,
57 int __init imx7ulp_cpuidle_init(void)
59 return cpuidle_register(&imx7ulp_cpuidle_driver, NULL);