All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sanjeev Premi <premi@ti.com>
To: linux-omap@vger.kernel.org
Cc: Sanjeev Premi <premi@ti.com>
Subject: [PATCHv2] PM : cpuidle - Update statistics for correct state
Date: Sun,  8 Mar 2009 01:15:49 +0530	[thread overview]
Message-ID: <1236455149-17017-1-git-send-email-premi@ti.com> (raw)

When 'enable_off_mode' is 0, and (mpu_state < PWRDM_POWER_RET)
the local variables mpu_state and core_state are modified; but
the usage count for the original state selected by the governor
are updated.

This patch updates the 'last_state' in the cpuidle driver to ensure
that statistics for the correct state are updated.

Signed-off-by: Sanjeev Premi <premi@ti.com>
---
 arch/arm/mach-omap2/cpuidle34xx.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 62fbb2e..b138abd 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
 {
 	struct omap3_processor_cx *cx = cpuidle_get_statedata(state);
 	struct timespec ts_preidle, ts_postidle, ts_idle;
-	u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
-
-	current_cx_state = *cx;
+	u32 mpu_state, core_state;
 
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
-	local_irq_disable();
-	local_fiq_disable();
-
+	/*
+	 * Adjust the idle state (if required).
+	 * Also, ensure that usage statistics of correct state are updated.
+	 */
 	if (!enable_off_mode) {
-		if (mpu_state < PWRDM_POWER_RET)
-			mpu_state = PWRDM_POWER_RET;
-		if (core_state < PWRDM_POWER_RET)
-			core_state = PWRDM_POWER_RET;
+		if (cx->type > OMAP3_STATE_C4) {
+			state = &(dev->states[OMAP3_STATE_C4 - 1]);
+			dev->last_state = state ;
+
+			cx = cpuidle_get_statedata(state);
+		}
 	}
 
+	current_cx_state = *cx;
+
+	mpu_state = cx->mpu_state;
+	core_state = cx->core_state;
+
+	local_irq_disable();
+	local_fiq_disable();
+
 	pwrdm_set_next_pwrst(mpu_pd, mpu_state);
 	pwrdm_set_next_pwrst(core_pd, core_state);
 
-- 
1.5.6


             reply	other threads:[~2009-03-07 19:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-07 19:45 Sanjeev Premi [this message]
2009-03-09 10:08 ` [PATCHv2] PM : cpuidle - Update statistics for correct state Högander Jouni
2009-03-09 10:22   ` Premi, Sanjeev
2009-03-09 10:37     ` Högander Jouni
2009-03-09 10:46       ` Premi, Sanjeev
2009-03-09 18:00         ` Kevin Hilman
2009-03-11 14:34           ` Premi, Sanjeev
2009-03-12  0:00             ` Kevin Hilman
2009-03-12  6:43               ` Premi, Sanjeev

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=1236455149-17017-1-git-send-email-premi@ti.com \
    --to=premi@ti.com \
    --cc=linux-omap@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.