From patchwork Mon Jul 11 11:21:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tarun Kanti DebBarma X-Patchwork-Id: 964332 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6BCmmoo005101 for ; Mon, 11 Jul 2011 12:48:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756001Ab1GKMss (ORCPT ); Mon, 11 Jul 2011 08:48:48 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:44234 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604Ab1GKMsp (ORCPT ); Mon, 11 Jul 2011 08:48:45 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p6BCmYj7014487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Jul 2011 07:48:36 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p6BCmXrN013111; Mon, 11 Jul 2011 18:18:33 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Mon, 11 Jul 2011 16:51:58 +0530 Received: from localhost.localdomain ([172.24.190.106]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p6BBLap6020454; Mon, 11 Jul 2011 16:51:55 +0530 (IST) From: Tarun Kanti DebBarma To: CC: khilman@ti.com, santosh.shilimkar@ti.com, tony@atomide.com, linux-arm-kernel@lists.infradead.org, Tarun Kanti DebBarma , Partha Basak Subject: [PATCH v14 07/12] OMAP: dmtimer: pm_runtime support Date: Mon, 11 Jul 2011 16:51:31 +0530 Message-ID: <1310383296-18956-8-git-send-email-tarun.kanti@ti.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1310383296-18956-1-git-send-email-tarun.kanti@ti.com> References: <1310383296-18956-1-git-send-email-tarun.kanti@ti.com> MIME-Version: 1.0 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 (demeter2.kernel.org [140.211.167.43]); Mon, 11 Jul 2011 12:48:49 +0000 (UTC) Add pm_runtime feature to dmtimer whereby _get_sync() is called within omap_dm_timer_enable(), _put_sync() is called in omap_dm_timer_disable(). Signed-off-by: Tarun Kanti DebBarma [p-basak2@ti.com: added pm_runtime logic in probe()] Signed-off-by: Partha Basak Reviewed-by: Varadarajan, Charulatha Acked-by: Cousson, Benoit --- arch/arm/plat-omap/dmtimer.c | 31 +++++++--------------------- arch/arm/plat-omap/include/plat/dmtimer.h | 1 - 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index d46efb4..f7ab92c 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -193,33 +194,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free); void omap_dm_timer_enable(struct omap_dm_timer *timer) { - struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; - - if (timer->enabled) - return; - - if (!pdata->needs_manual_reset) { - clk_enable(timer->fclk); - clk_enable(timer->iclk); - } - - timer->enabled = 1; + pm_runtime_get_sync(&timer->pdev->dev); } EXPORT_SYMBOL_GPL(omap_dm_timer_enable); void omap_dm_timer_disable(struct omap_dm_timer *timer) { - struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; - - if (!timer->enabled) - return; - - if (!pdata->needs_manual_reset) { - clk_disable(timer->iclk); - clk_disable(timer->fclk); - } - - timer->enabled = 0; + pm_runtime_put_sync(&timer->pdev->dev); } EXPORT_SYMBOL_GPL(omap_dm_timer_disable); @@ -461,7 +442,7 @@ int omap_dm_timers_active(void) struct omap_dm_timer *timer; list_for_each_entry(timer, &omap_timer_list, node) { - if (!timer->enabled) + if (!timer->reserved) continue; if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) & @@ -543,6 +524,10 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->pdev = pdev; timer->reserved = 0; + /* Skip pm_runtime_enable for OMAP1 */ + if (!pdata->needs_manual_reset) + pm_runtime_enable(&pdev->dev); + /* add the timer element to the list */ spin_lock_irqsave(&dm_timer_lock, flags); list_add_tail(&timer->node, &omap_timer_list); diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index 90a504a..53d5da6 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h @@ -238,7 +238,6 @@ struct omap_dm_timer { void __iomem *io_base; unsigned long rate; unsigned reserved:1; - unsigned enabled:1; unsigned posted:1; u8 func_offset; u8 intr_offset;