Commit ccc12b32 authored by Robert Lee's avatar Robert Lee Committed by Sascha Hauer

ARM: imx: Add imx5 cpuidle

Add cpuidle driver for imx5 platform.
Signed-off-by: default avatarRobert Lee <rob.lee@linaro.org>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 2da50e62
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/export.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/system_misc.h> #include <asm/system_misc.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <mach/common.h> #include <mach/common.h>
#include <mach/cpuidle.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include "crm-regs-imx5.h" #include "crm-regs-imx5.h"
...@@ -134,12 +136,48 @@ static const struct platform_suspend_ops mx5_suspend_ops = { ...@@ -134,12 +136,48 @@ static const struct platform_suspend_ops mx5_suspend_ops = {
.enter = mx5_suspend_enter, .enter = mx5_suspend_enter,
}; };
static void imx5_pm_idle(void) static inline int imx5_cpu_do_idle(void)
{ {
if (likely(!tzic_enable_wake())) int ret = tzic_enable_wake();
if (likely(!ret))
cpu_do_idle(); cpu_do_idle();
return ret;
}
static void imx5_pm_idle(void)
{
imx5_cpu_do_idle();
}
static int imx5_cpuidle_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int idx)
{
int ret;
ret = imx5_cpu_do_idle();
if (ret < 0)
return ret;
return idx;
} }
static struct cpuidle_driver imx5_cpuidle_driver = {
.name = "imx5_cpuidle",
.owner = THIS_MODULE,
.en_core_tk_irqen = 1,
.states[0] = {
.enter = imx5_cpuidle_enter,
.exit_latency = 2,
.target_residency = 1,
.flags = CPUIDLE_FLAG_TIME_VALID,
.name = "IMX5 SRPG",
.desc = "CPU state retained,powered off",
},
.state_count = 1,
};
static int __init imx5_pm_common_init(void) static int __init imx5_pm_common_init(void)
{ {
int ret; int ret;
...@@ -157,6 +195,7 @@ static int __init imx5_pm_common_init(void) ...@@ -157,6 +195,7 @@ static int __init imx5_pm_common_init(void)
/* Set the registers to the default cpu idle state. */ /* Set the registers to the default cpu idle state. */
mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
imx_cpuidle_init(&imx5_cpuidle_driver);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment