From patchwork Fri Jul 24 07:01:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 37087 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6O70txY023429 for ; Fri, 24 Jul 2009 07:01:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbZGXHBr (ORCPT ); Fri, 24 Jul 2009 03:01:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751894AbZGXHBr (ORCPT ); Fri, 24 Jul 2009 03:01:47 -0400 Received: from smtp.nokia.com ([192.100.105.134]:58569 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbZGXHBq (ORCPT ); Fri, 24 Jul 2009 03:01:46 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6O715kJ015514; Fri, 24 Jul 2009 02:01:34 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Jul 2009 10:01:39 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Jul 2009 10:01:24 +0300 Received: from localhost.localdomain (esdhcp04032.research.nokia.com [172.21.40.32]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6O71Glt015240; Fri, 24 Jul 2009 10:01:17 +0300 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: hiroshi.doyu@nokia.com, omar.ramirez@ti.com, x0095840@ti.com Subject: [PATCH 1/2] DSPBRIDGE: Cleanup SleepDSP Date: Fri, 24 Jul 2009 10:01:20 +0300 Message-Id: <1248418882-28164-1-git-send-email-ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1248272767-29223-1-git-send-email-ameya.palande@nokia.com> References: <1248272767-29223-1-git-send-email-ameya.palande@nokia.com> X-OriginalArrivalTime: 24 Jul 2009 07:01:24.0649 (UTC) FILETIME=[8EBF8190:01CA0C2C] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Signed-off-by: Ameya Palande Acked-by: Omar Ramirez Luna --- drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 33 ++++++++++++++++++------------ 1 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c index b81df8c..7aa58d1 100644 --- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c +++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c @@ -204,20 +204,21 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd, struct CFG_HOSTRES resources; struct DEH_MGR *hDehMgr; u16 usCount = TIHELEN_ACKTIMEOUT; - enum HW_PwrState_t pwrState; - enum HW_PwrState_t targetPwrState; + enum HW_PwrState_t pwrState, targetPwrState; - status = CFG_GetHostResources( - (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources); - if (DSP_FAILED(status)) - return status; DBG_Trace(DBG_LEVEL7, "SleepDSP- Enter function \n"); - /* next, check if sleep code is valid... */ + /* Check if sleep code is valid */ if ((dwCmd != PWR_DEEPSLEEP) && (dwCmd != PWR_EMERGENCYDEEPSLEEP)) { DBG_Trace(DBG_LEVEL7, "SleepDSP- Illegal sleep command\n"); return DSP_EINVALIDARG; } + + status = CFG_GetHostResources( + (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources); + if (DSP_FAILED(status)) + return status; + switch (pDevContext->dwBrdState) { case BRD_RUNNING: status = HW_MBOX_saveSettings(resources.dwMboxBase); @@ -245,7 +246,6 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd, break; case BRD_HIBERNATION: case BRD_DSP_HIBERNATION: - status = HW_MBOX_saveSettings(resources.dwMboxBase); /* Already in Hibernation, so just return */ DBG_Trace(DBG_LEVEL7, "SleepDSP- DSP already in " "hibernation\n"); @@ -259,17 +259,22 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd, "SleepDSP- Bridge in Illegal state\n"); return DSP_EFAIL; } + /* Get the PRCM DSP power domain status */ HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP, - &pwrState); - /* Wait for DSP to move into Standby state, how much time - * should we wait?*/ + &pwrState); + + /* + * Wait for DSP to move into Standby state, how much time + * should we wait? + */ while ((pwrState != targetPwrState) && --usCount) { udelay(500); HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP, &pwrState); } - if (usCount == 0) { + + if (!usCount) { DBG_Trace(DBG_LEVEL7, "SleepDSP: Timed out Waiting for DSP" " STANDBY %x \n", pwrState); DEV_GetDehMgr(pDevContext->hDevObject, &hDehMgr); @@ -278,17 +283,19 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd, } else { DBG_Trace(DBG_LEVEL7, "SleepDSP: DSP STANDBY Pwr state %x \n", pwrState); + /* Update the Bridger Driver state */ if (enable_off_mode) pDevContext->dwBrdState = BRD_HIBERNATION; else pDevContext->dwBrdState = BRD_RETENTION; + /* Turn off DSP Peripheral clocks */ status = DSP_PeripheralClocks_Disable(pDevContext, NULL); if (DSP_FAILED(status)) DBG_Trace(DBG_LEVEL7, "SleepDSP- FAILED\n"); } -#endif +#endif /* CONFIG_PM */ return status; }