From patchwork Tue Sep 21 08:55:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tarun Kanti DebBarma X-Patchwork-Id: 195892 X-Patchwork-Delegate: khilman@deeprootsystems.com 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 o8KLstCr010518 for ; Mon, 20 Sep 2010 21:54:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932183Ab0ITVyy (ORCPT ); Mon, 20 Sep 2010 17:54:54 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:43132 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932123Ab0ITVyy (ORCPT ); Mon, 20 Sep 2010 17:54:54 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o8KLsn2r024605 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 16:54:51 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o8KLskQf017973; Tue, 21 Sep 2010 03:24:46 +0530 (IST) From: Tarun Kanti DebBarma To: linux-omap@vger.kernel.org Cc: Partha Basak , Tarun Kanti DebBarma , "Cousson, Benoit" , Paul Walmsley , Kevin Hilman , Tony Lindgren Subject: [PATCHv3 14/17] dmtimer pm_runtime support Date: Tue, 21 Sep 2010 14:25:47 +0530 Message-Id: <1285059347-26643-1-git-send-email-tarun.kanti@ti.com> X-Mailer: git-send-email 1.6.0.4 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.3 (demeter1.kernel.org [140.211.167.41]); Mon, 20 Sep 2010 21:54:55 +0000 (UTC) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 360a751..9da527f 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -351,18 +351,28 @@ 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; struct clk *timer_clk; if (timer->enabled) return; - timer_clk = clk_get(&timer->pdev->dev, "fck"); - if (IS_ERR(timer_clk)) { - dev_err(&timer->pdev->dev, - "ERROR: no clk pointer to enable\n"); - return; - } else - clk_enable(timer_clk); + if (unlikely(pdata->is_early_init)) { + timer_clk = clk_get(&timer->pdev->dev, "fck"); + if (IS_ERR(timer_clk)) { + dev_err(&timer->pdev->dev, + "ERROR: no clk pointer to enable\n"); + return; + } else + clk_enable(timer_clk); + } else { + if (pm_runtime_get_sync(&timer->pdev->dev)) { + dev_warn(&timer->pdev->dev, + "%s: pm_runtime_get_sync FAILED\n", + __func__); + return; + } + } timer->enabled = 1; } @@ -370,18 +380,28 @@ 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; struct clk *timer_clk; if (!timer->enabled) return; - timer_clk = clk_get(&timer->pdev->dev, "fck"); - if (IS_ERR(timer_clk)) { - dev_err(&timer->pdev->dev, - "ERROR: no clk pointer to disable\n"); - return; - } else - clk_disable(timer_clk); + if (unlikely(pdata->is_early_init)) { + timer_clk = clk_get(&timer->pdev->dev, "fck"); + if (IS_ERR(timer_clk)) { + dev_err(&timer->pdev->dev, + "ERROR: no clk pointer to disable\n"); + return; + } else + clk_disable(timer_clk); + } else { + if (pm_runtime_put_sync(&timer->pdev->dev)) { + dev_warn(&timer->pdev->dev, + "%s: pm_runtime_put_sync FAILED\n", + __func__); + return; + } + } timer->enabled = 0; } @@ -503,13 +523,20 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) if (source < 0 || source >= NR_CLK_SOURCES) return -EINVAL; - timer_clk = clk_get(&timer->pdev->dev, "fck"); - if (IS_ERR(timer_clk)) { - dev_err(&timer->pdev->dev, - "ERROR: no clk pointer to disable\n"); - return -EINVAL; - } else - clk_disable(timer_clk); /* enabled in hwmod */ + if (unlikely(pdata->is_early_init)) { + timer_clk = clk_get(&timer->pdev->dev, "fck"); + if (IS_ERR(timer_clk)) { + dev_err(&timer->pdev->dev, + "ERROR: no clk pointer to disable\n"); + return -EINVAL; + } else + clk_disable(timer_clk); /* enabled in hwmod */ + } else { + if (pm_runtime_put_sync(&timer->pdev->dev)) + dev_warn(&timer->pdev->dev, + "%s: pm_runtime_put_sync FAILED\n", + __func__); + } /* * change the timer clock source and