diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2016-11-08 20:28:58 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 2cff1a75e54c95eb41a7a91795f582ebd3cf0ba2 (patch) | |
tree | d5a069c9b76a1e2b5aa66eddbfaf1b6e46727190 /arch/arm/mach-imx/cpuidle-imx7ulp.c | |
parent | b0dbd9bf5d58e19660d6b96c33b33817255fa05e (diff) |
MLK-13441-17 ARM: imx: add cpuidle support for i.mx7ulp
Add i.MX7ULP cpuidle support, 3 levels idle as below:
1. patial stop mode 3;
2. patial stop mode 2;
3. patial stop mode 1.
PSTOP1 - Partial Stop with system and bus clock disabled
PSTOP2 - Partial Stop with system clock disabled and bus clock enabled
PSTOP3 - Partial Stop with system clock enabled and bus clock enabled
All drivers has DMA function need to add pm_qos
API to prevent cpuidle from entering PSTOP 1/2.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx/cpuidle-imx7ulp.c')
-rw-r--r-- | arch/arm/mach-imx/cpuidle-imx7ulp.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/cpuidle-imx7ulp.c b/arch/arm/mach-imx/cpuidle-imx7ulp.c new file mode 100644 index 000000000000..924a19c16321 --- /dev/null +++ b/arch/arm/mach-imx/cpuidle-imx7ulp.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/cpuidle.h> +#include <linux/module.h> +#include <asm/cpuidle.h> + +#include "common.h" +#include "cpuidle.h" +#include "hardware.h" + +static int imx7ulp_enter_wait(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + if (index == 1) + imx7ulp_set_lpm(WAIT); + else + imx7ulp_set_lpm(STOP); + + cpu_do_idle(); + + imx7ulp_set_lpm(RUN); + + return index; +} + +static struct cpuidle_driver imx7ulp_cpuidle_driver = { + .name = "imx7ulp_cpuidle", + .owner = THIS_MODULE, + .states = { + /* WFI */ + ARM_CPUIDLE_WFI_STATE, + /* WAIT */ + { + .exit_latency = 50, + .target_residency = 75, + .enter = imx7ulp_enter_wait, + .name = "WAIT", + .desc = "PSTOP2", + }, + /* STOP */ + { + .exit_latency = 100, + .target_residency = 150, + .enter = imx7ulp_enter_wait, + .name = "STOP", + .desc = "PSTOP1", + }, + }, + .state_count = 3, + .safe_state_index = 0, +}; + +int __init imx7ulp_cpuidle_init(void) +{ + return cpuidle_register(&imx7ulp_cpuidle_driver, NULL); +} |