From: rob.lee@linaro.org (Robert Lee)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 6/7] ARM: imx: Add imx5 cpuidle
Date: Tue, 15 May 2012 21:33:35 -0500 [thread overview]
Message-ID: <1337135616-8988-7-git-send-email-rob.lee@linaro.org> (raw)
In-Reply-To: <1337135616-8988-1-git-send-email-rob.lee@linaro.org>
Add cpuidle driver for imx5 platform.
Signed-off-by: Robert Lee <rob.lee@linaro.org>
---
arch/arm/mach-imx/pm-imx5.c | 44 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 41 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 6e62d79..966c71b 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -12,10 +12,12 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/err.h>
+#include <linux/export.h>
#include <asm/cacheflush.h>
#include <asm/system_misc.h>
#include <asm/tlbflush.h>
#include <mach/common.h>
+#include <mach/cpuidle.h>
#include <mach/hardware.h>
#include "crm-regs-imx5.h"
@@ -134,12 +136,48 @@ static const struct platform_suspend_ops mx5_suspend_ops = {
.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();
+
+ 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,
+};
+
int __init imx5_pm_init(void)
{
int ret;
@@ -160,5 +198,5 @@ int __init imx5_pm_init(void)
/* Set the registers to the default cpu idle state. */
mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
- return 0;
+ return imx_cpuidle_init(&imx5_cpuidle_driver);
}
--
1.7.10
next prev parent reply other threads:[~2012-05-16 2:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 2:33 [PATCH v4 0/7] cleanup imx5 idle, add imx5/6 cpuidle Robert Lee
2012-05-16 2:33 ` [PATCH v4 1/7] ARM: imx: Modify IMX_IO_P2V macro Robert Lee
2012-05-16 2:33 ` [PATCH v4 2/7] ARM: imx: Add comments to tzic_enable_waker() Robert Lee
2012-05-16 2:33 ` [PATCH v4 3/7] ARM: imx: clean and consolidate imx5 suspend and idle code Robert Lee
2012-05-16 17:38 ` Sascha Hauer
2012-05-17 14:34 ` Rob Lee
2012-05-17 17:14 ` Sascha Hauer
2012-05-16 2:33 ` [PATCH v4 4/7] ARM: imx: Enable imx53 low power idle Robert Lee
2012-05-16 17:47 ` Sascha Hauer
2012-05-17 14:46 ` Rob Lee
2012-05-17 16:44 ` Sascha Hauer
2012-05-16 2:33 ` [PATCH v4 5/7] ARM: imx: Add common imx cpuidle init functionality Robert Lee
2012-05-16 17:55 ` Sascha Hauer
2012-05-17 14:47 ` Rob Lee
2012-05-16 2:33 ` Robert Lee [this message]
2012-05-16 2:33 ` [PATCH v4 7/7] ARM: imx: Add imx6q cpuidle driver Robert Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337135616-8988-7-git-send-email-rob.lee@linaro.org \
--to=rob.lee@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).