From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
Ameya Palande <ameya.palande@nokia.com>,
Felipe Contreras <felipe.contreras@nokia.com>,
Fernando Guzman <x0095840@ti.com>, Ernesto Ramos <ernesto@ti.com>,
Omar Ramirez Luna <omar.ramirez@ti.com>
Subject: [PATCH 06/17] DSPBRIDGE: Remove long busy-wait loops on PWRST transitions
Date: Tue, 15 Dec 2009 00:19:47 -0600 [thread overview]
Message-ID: <1260857998-19349-7-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1260857998-19349-1-git-send-email-omar.ramirez@ti.com>
Remove busy waiting on suspend and self hibernation paths by
removing udelays.
Decrease the total timer waiting on power transitions to be less
than 3 seconds, defined to wait for power transition approx. 200 msecs
Change required for:
http://android.git.kernel.org/?p=kernel/omap.git;a=commit;h=c8853459b739e5f43da0badc1605a0a0c0c8195d
Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
drivers/dsp/bridge/wmd/_tiomap_util.h | 6 ++++++
drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 24 +++++++++++++-----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/dsp/bridge/wmd/_tiomap_util.h b/drivers/dsp/bridge/wmd/_tiomap_util.h
index 47e1e5d..bd1b571 100644
--- a/drivers/dsp/bridge/wmd/_tiomap_util.h
+++ b/drivers/dsp/bridge/wmd/_tiomap_util.h
@@ -31,6 +31,12 @@
/* Time out Values in uSeconds*/
#define TIHELEN_ACKTIMEOUT 10000
+/*
+ * Time out for power state transition (in msecs), due to system
+ * latencies and HZ resolution this timer can vary.
+ */
+#define PWRSTST_TIMEOUT 200
+
/* Time delay for HOM->SAM transition. */
#define WAIT_SAM 1000000 /* in usec (1000 millisec) */
diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
index 2d7be1c..da59e4b 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
@@ -110,7 +110,7 @@ DSP_STATUS handle_hibernation_fromDSP(struct WMD_DEV_CONTEXT *pDevContext)
{
DSP_STATUS status = DSP_SOK;
#ifdef CONFIG_PM
- u16 usCount = TIHELEN_ACKTIMEOUT;
+ u16 usCount = PWRSTST_TIMEOUT / 10;
struct CFG_HOSTRES resources;
enum HW_PwrState_t pwrState;
#ifdef CONFIG_BRIDGE_DVFS
@@ -127,10 +127,12 @@ DSP_STATUS handle_hibernation_fromDSP(struct WMD_DEV_CONTEXT *pDevContext)
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
&pwrState);
- /* Wait for DSP to move into Off state, how much time should
- * we wait? */
+ /* Wait for DSP to move into OFF state */
while ((pwrState != HW_PWR_STATE_OFF) && --usCount) {
- udelay(500);
+ if (msleep_interruptible(10)) {
+ pr_err("Waiting for DSP OFF mode interrupted\n");
+ return DSP_EFAIL;
+ }
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
&pwrState);
}
@@ -195,7 +197,7 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd,
#ifdef CONFIG_BRIDGE_NTFY_PWRERR
struct DEH_MGR *hDehMgr;
#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
- u16 usCount = TIHELEN_ACKTIMEOUT;
+ u16 usCount = PWRSTST_TIMEOUT / 10;
enum HW_PwrState_t pwrState, targetPwrState;
DBG_Trace(DBG_LEVEL7, "SleepDSP- Enter function \n");
@@ -256,12 +258,12 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd,
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
&pwrState);
- /*
- * Wait for DSP to move into Standby state, how much time
- * should we wait?
- */
- while ((pwrState != targetPwrState) && --usCount) {
- udelay(500);
+ /* Wait for DSP to move into target power state */
+ while ((pwrState != targetPwrState) && usCount--) {
+ if (msleep_interruptible(10)) {
+ pr_err("Waiting for DSP to Suspend interrupted\n");
+ return DSP_EFAIL;
+ }
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
&pwrState);
}
--
1.6.2.4
next prev parent reply other threads:[~2009-12-15 6:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 6:19 [PATCH 00/17] First set of unreviewed patches Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 01/17] DSPBRIDGE: Remove preproessor condition that could never work Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 02/17] DSPBRIDGE: Implemented Trampoline support for dynamic loader Omar Ramirez Luna
2009-12-15 18:24 ` Felipe Contreras
2009-12-15 22:14 ` Ramirez Luna, Omar
2009-12-15 6:19 ` [PATCH 03/17] DSPBRIDGE: Enable/Disable MCBSP_CLOCKS for MCBSP2 Omar Ramirez Luna
2009-12-15 18:26 ` Felipe Contreras
2009-12-15 6:19 ` [PATCH 04/17] DSPBRIDGE: set PWRERROR notifications as an option Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 05/17] DSPBRIDGE: Enable peripheral clocks on wake up Omar Ramirez Luna
2009-12-15 6:19 ` Omar Ramirez Luna [this message]
2009-12-15 6:19 ` [PATCH 07/17] DSPBRIDGE: Rename usCount to timeout Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 08/17] DSPBRIDGE: Trivial cleanup on DBDCD Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 09/17] DSPBRIDGE: Do not panic on bad page count Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 10/17] DSPBRIDGE: support loading 4 dependent DLL Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 11/17] DSPBRIDGE: Memory leak in Node Register Notify Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 12/17] DSPBRIDGE: check pointer before calling Proc_Detach Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 13/17] DSPBRIDGE: check the status of DMM_GetHandle Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 14/17] DSPBRIDGE: KFILE_Seek & KFILE_Tell, u32 replaced with loff_t Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 15/17] DSPBRIDGE: Delete unused files Omar Ramirez Luna
2009-12-15 6:19 ` [PATCH 16/17] DSPBRIDGE: Avoid REGistry if pDevContext is available Omar Ramirez Luna
2009-12-15 18:21 ` Felipe Contreras
2009-12-15 19:03 ` Ramirez Luna, Omar
2009-12-15 6:19 ` [PATCH 17/17] DSPBRIDGE: Compilation fixes 2.6.31 Omar Ramirez Luna
2009-12-15 18:28 ` [PATCH 00/17] First set of unreviewed patches Felipe Contreras
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=1260857998-19349-7-git-send-email-omar.ramirez@ti.com \
--to=omar.ramirez@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=ernesto@ti.com \
--cc=felipe.contreras@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=x0095840@ti.com \
/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