From patchwork Wed Mar 23 18:49:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: omar ramirez X-Patchwork-Id: 656701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2NJ1KP9014692 for ; Wed, 23 Mar 2011 19:01:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932679Ab1CWTBS (ORCPT ); Wed, 23 Mar 2011 15:01:18 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:60766 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932562Ab1CWTBM (ORCPT ); Wed, 23 Mar 2011 15:01:12 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p2NJ1AKH030191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Mar 2011 14:01:10 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id p2NJ1AJN011656; Wed, 23 Mar 2011 14:01:10 -0500 (CDT) Received: from localhost (bacab.am.dhcp.ti.com [128.247.77.143]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id p2NJ1Af09249; Wed, 23 Mar 2011 14:01:10 -0500 (CDT) From: Omar Ramirez Luna To: l-o Cc: Omar Ramirez Luna , Fernando Guzman Lugo , Armando Uribe , Felipe Contreras Subject: [PATCH 3/8] staging: tidspbridge: remove msleep for dsp transition wait Date: Wed, 23 Mar 2011 12:49:48 -0600 Message-Id: <1300906193-1732-4-git-send-email-omar.ramirez@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1300906193-1732-1-git-send-email-omar.ramirez@ti.com> References: <1300906193-1732-1-git-send-email-omar.ramirez@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Mar 2011 19:01:20 +0000 (UTC) diff --git a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c index 69cc2c4..9595abc 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c +++ b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c @@ -81,7 +81,8 @@ int handle_hibernation_from_dsp(struct bridge_dev_context *dev_context) { int status = 0; #ifdef CONFIG_PM - u16 timeout = PWRSTST_TIMEOUT / 10; + u8 t; + unsigned long v; u32 pwr_state; #ifdef CONFIG_TIDSPBRIDGE_DVFS u32 opplevel; @@ -90,18 +91,17 @@ int handle_hibernation_from_dsp(struct bridge_dev_context *dev_context) struct omap_dsp_platform_data *pdata = omap_dspbridge_dev->dev.platform_data; - pwr_state = (*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST) & - OMAP_POWERSTATEST_MASK; /* Wait for DSP to move into OFF state */ - while ((pwr_state != PWRDM_POWER_OFF) && --timeout) { - if (msleep_interruptible(10)) { - pr_err("Waiting for DSP OFF mode interrupted\n"); - return -EPERM; - } + v = msecs_to_jiffies(PWRSTST_TIMEOUT) + jiffies; + do { + t = time_is_after_jiffies(v); pwr_state = (*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST) & OMAP_POWERSTATEST_MASK; - } - if (timeout == 0) { + if (pwr_state == PWRDM_POWER_OFF) + break; + } while (t); + + if (!t) { pr_err("%s: Timed out waiting for DSP off mode\n", __func__); status = -ETIMEDOUT; return status; @@ -154,7 +154,8 @@ int sleep_dsp(struct bridge_dev_context *dev_context, u32 dw_cmd, #ifdef CONFIG_TIDSPBRIDGE_NTFY_PWRERR struct deh_mgr *hdeh_mgr; #endif /* CONFIG_TIDSPBRIDGE_NTFY_PWRERR */ - u16 timeout = PWRSTST_TIMEOUT / 10; + u8 t; + unsigned long v; u32 pwr_state, target_pwr_state; struct omap_dsp_platform_data *pdata = omap_dspbridge_dev->dev.platform_data; @@ -198,21 +199,17 @@ int sleep_dsp(struct bridge_dev_context *dev_context, u32 dw_cmd, return -EPERM; } - /* Get the PRCM DSP power domain status */ - pwr_state = (*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST) & - OMAP_POWERSTATEST_MASK; - /* Wait for DSP to move into target power state */ - while ((pwr_state != target_pwr_state) && --timeout) { - if (msleep_interruptible(10)) { - pr_err("Waiting for DSP to Suspend interrupted\n"); - return -EPERM; - } + v = msecs_to_jiffies(PWRSTST_TIMEOUT) + jiffies; + do { + t = time_is_after_jiffies(v); pwr_state = (*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST) & OMAP_POWERSTATEST_MASK; - } + if (pwr_state == target_pwr_state) + break; + } while (t); - if (!timeout) { + if (!t) { pr_err("%s: Timed out waiting for DSP off mode, state %x\n", __func__, pwr_state); #ifdef CONFIG_TIDSPBRIDGE_NTFY_PWRERR