diff mbox

omap3: Add cpuidle parameters table for omap3430

Message ID 1455559328-19783-1-git-send-email-pali.rohar@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pali Rohár Feb. 15, 2016, 6:02 p.m. UTC
Based on CPU type choose generic omap3 or omap3430 specific cpuidle
parameters. Parameters for omap3430 were measured on Nokia N900 device and
added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
remove rx51 cpuidle parameters table") due to huge code complexity.

This patch brings cpuidle parameters for omap3430 devices again, but uses
simple condition based on CPU type.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Fixes: 231900afba52d6faddfb480cde4132d4edc089bc
---
 arch/arm/mach-omap2/cpuidle34xx.c |   69 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

Comments

Daniel Lezcano Feb. 16, 2016, 10:01 a.m. UTC | #1
On 02/15/2016 07:02 PM, Pali Rohár wrote:
> Based on CPU type choose generic omap3 or omap3430 specific cpuidle
> parameters. Parameters for omap3430 were measured on Nokia N900 device and
> added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
> which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
> remove rx51 cpuidle parameters table") due to huge code complexity.
>
> This patch brings cpuidle parameters for omap3430 devices again, but uses
> simple condition based on CPU type.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Fixes: 231900afba52d6faddfb480cde4132d4edc089bc
> ---

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Pali Rohár Feb. 16, 2016, 10:07 a.m. UTC | #2
On Tuesday 16 February 2016 11:01:43 Daniel Lezcano wrote:
> On 02/15/2016 07:02 PM, Pali Rohár wrote:
> >Based on CPU type choose generic omap3 or omap3430 specific cpuidle
> >parameters. Parameters for omap3430 were measured on Nokia N900 device and
> >added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
> >which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
> >remove rx51 cpuidle parameters table") due to huge code complexity.
> >
> >This patch brings cpuidle parameters for omap3430 devices again, but uses
> >simple condition based on CPU type.
> >
> >Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> >Fixes: 231900afba52d6faddfb480cde4132d4edc089bc
> >---
> 
> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Tony, Nishanth (or somebody else...) can you test this patch on more
omap3 devices to check if it does not break existing cpuidle code?
Tony Lindgren Feb. 16, 2016, 4:08 p.m. UTC | #3
* Pali Rohár <pali.rohar@gmail.com> [160216 02:09]:
> On Tuesday 16 February 2016 11:01:43 Daniel Lezcano wrote:
> > On 02/15/2016 07:02 PM, Pali Rohár wrote:
> > >Based on CPU type choose generic omap3 or omap3430 specific cpuidle
> > >parameters. Parameters for omap3430 were measured on Nokia N900 device and
> > >added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
> > >which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
> > >remove rx51 cpuidle parameters table") due to huge code complexity.
> > >
> > >This patch brings cpuidle parameters for omap3430 devices again, but uses
> > >simple condition based on CPU type.
> > >
> > >Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > >Fixes: 231900afba52d6faddfb480cde4132d4edc089bc
> > >---
> > 
> > Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> Tony, Nishanth (or somebody else...) can you test this patch on more
> omap3 devices to check if it does not break existing cpuidle code?

Seems to work for me on a ldp, which is GP 3430 ES3.0.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Feb. 19, 2016, 6:36 p.m. UTC | #4
* Tony Lindgren <tony@atomide.com> [160216 08:11]:
> * Pali Rohár <pali.rohar@gmail.com> [160216 02:09]:
> > On Tuesday 16 February 2016 11:01:43 Daniel Lezcano wrote:
> > > On 02/15/2016 07:02 PM, Pali Rohár wrote:
> > > >Based on CPU type choose generic omap3 or omap3430 specific cpuidle
> > > >parameters. Parameters for omap3430 were measured on Nokia N900 device and
> > > >added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
> > > >which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
> > > >remove rx51 cpuidle parameters table") due to huge code complexity.
> > > >
> > > >This patch brings cpuidle parameters for omap3430 devices again, but uses
> > > >simple condition based on CPU type.
> > > >
> > > >Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > >Fixes: 231900afba52d6faddfb480cde4132d4edc089bc
> > > >---
> > > 
> > > Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > 
> > Tony, Nishanth (or somebody else...) can you test this patch on more
> > omap3 devices to check if it does not break existing cpuidle code?
> 
> Seems to work for me on a ldp, which is GP 3430 ES3.0.

OK applying this into omap-for-v4.6/fixes-not-urgent considering
we've already lived with it for years.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index aa7b379..2a3db0b 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -34,6 +34,7 @@ 
 #include "pm.h"
 #include "control.h"
 #include "common.h"
+#include "soc.h"
 
 /* Mach specific information to be recorded in the C-state driver_data */
 struct omap3_idle_statedata {
@@ -315,6 +316,69 @@  static struct cpuidle_driver omap3_idle_driver = {
 	.safe_state_index = 0,
 };
 
+/*
+ * Numbers based on measurements made in October 2009 for PM optimized kernel
+ * with CPU freq enabled on device Nokia N900. Assumes OPP2 (main idle OPP,
+ * and worst case latencies).
+ */
+static struct cpuidle_driver omap3430_idle_driver = {
+	.name             = "omap3430_idle",
+	.owner            = THIS_MODULE,
+	.states = {
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 110 + 162,
+			.target_residency = 5,
+			.name		  = "C1",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 106 + 180,
+			.target_residency = 309,
+			.name		  = "C2",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 107 + 410,
+			.target_residency = 46057,
+			.name		  = "C3",
+			.desc		  = "MPU RET + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 121 + 3374,
+			.target_residency = 46057,
+			.name		  = "C4",
+			.desc		  = "MPU OFF + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 855 + 1146,
+			.target_residency = 46057,
+			.name		  = "C5",
+			.desc		  = "MPU RET + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7580 + 4134,
+			.target_residency = 484329,
+			.name		  = "C6",
+			.desc		  = "MPU OFF + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7505 + 15274,
+			.target_residency = 484329,
+			.name		  = "C7",
+			.desc		  = "MPU OFF + CORE OFF",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap3_idle_data),
+	.safe_state_index = 0,
+};
+
 /* Public functions */
 
 /**
@@ -333,5 +397,8 @@  int __init omap3_idle_init(void)
 	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
 		return -ENODEV;
 
-	return cpuidle_register(&omap3_idle_driver, NULL);
+	if (cpu_is_omap3430())
+		return cpuidle_register(&omap3430_idle_driver, NULL);
+	else
+		return cpuidle_register(&omap3_idle_driver, NULL);
 }