From patchwork Fri Aug 9 19:24:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2842094 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A2F2C9F271 for ; Fri, 9 Aug 2013 19:26:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 984942028D for ; Fri, 9 Aug 2013 19:25:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E72020284 for ; Fri, 9 Aug 2013 19:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030814Ab3HITZp (ORCPT ); Fri, 9 Aug 2013 15:25:45 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:38522 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030789Ab3HITZm (ORCPT ); Fri, 9 Aug 2013 15:25:42 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MRA000AN3AJ6DI0@mailout1.samsung.com>; Sat, 10 Aug 2013 04:25:41 +0900 (KST) X-AuditID: cbfee61b-b7efe6d000007b11-86-52054235d3fa Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5C.5C.31505.53245025; Sat, 10 Aug 2013 04:25:41 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MRA006PU38GMW10@mmp1.samsung.com>; Sat, 10 Aug 2013 04:25:41 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: a.hajda@samsung.com, arun.kk@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , Kyungmin Park Subject: [PATCH 07/10] exynos4-is: Simplify sclk_cam clocks handling Date: Fri, 09 Aug 2013 21:24:09 +0200 Message-id: <1376076252-30150-7-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1376076252-30150-1-git-send-email-s.nawrocki@samsung.com> References: <1376076122-29963-1-git-send-email-s.nawrocki@samsung.com> <1376076252-30150-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgluLIzCtJLcpLzFFi42I5/e+xgK6pE2uQQd9CY4tb686xWnw8dZvV 4mzTG3aLng1bWS1mnN/HZHH4TTurA5tH35ZVjB6fN8kFMEVx2aSk5mSWpRbp2yVwZcw42chY cF2wYsLC02wNjNv4uhg5OSQETCQmb77OBGGLSVy4t56ti5GLQ0hgEaPEjcbLzBBOB5PEstaF rCBVbAKGEr1H+xhBbBEBeYknvTfAOpgF1jJKLP76hA0kISzgInH1exvYWBYBVYmvL76DNfMK uEl8fLEIyOYAWqcgMWeSDUiYU8BdYtKj2WCtQgLNjBJvPihPYORdwMiwilE0tSC5oDgpPddI rzgxt7g0L10vOT93EyM4XJ5J72Bc1WBxiFGAg1GJh3fCL5YgIdbEsuLK3EOMEhzMSiK8r7lY g4R4UxIrq1KL8uOLSnNSiw8xSnOwKInzHmy1DhQSSE8sSc1OTS1ILYLJMnFwSjUwrmyM/3ng p/Si3HLe2m/RLNsWuTXs3JJrP6P/m7rRjq3KXF8MMrbF+7OVva07YNy96+zDSSd2SH0MuHDe +nvzynMbjvZ/s038VR72am3LLGmVfTOWNpSJMzmy/p2VcWj9OpOotZd0jtR3ybA2RXE/nN7x 6cWKV2/LzQ/Lfn37/5DrC+276cp+k5RYijMSDbWYi4oTAVHOL7sTAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use clk_prepare_enable()/clk_disable_unprepare() instead of separately prearing/unparing the clk_cam clocks. This simplifies the code that is now mostly not going to be used, function __fimc_md_set_camclk() is only left for S5PV210 platform which is not yet converted to Device Tree. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/exynos4-is/media-dev.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 0446ab3..e327f45 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1150,7 +1150,6 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) while (--i >= 0) { if (IS_ERR(fmd->camclk[i].clock)) continue; - clk_unprepare(fmd->camclk[i].clock); clk_put(fmd->camclk[i].clock); fmd->camclk[i].clock = ERR_PTR(-EINVAL); } @@ -1169,7 +1168,7 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) struct device *dev = NULL; char clk_name[32]; struct clk *clock; - int ret, i; + int i, ret = 0; for (i = 0; i < FIMC_MAX_CAMCLKS; i++) fmd->camclk[i].clock = ERR_PTR(-EINVAL); @@ -1187,12 +1186,6 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) ret = PTR_ERR(clock); break; } - ret = clk_prepare(clock); - if (ret < 0) { - clk_put(clock); - fmd->camclk[i].clock = ERR_PTR(-EINVAL); - break; - } fmd->camclk[i].clock = clock; } if (ret) @@ -1249,7 +1242,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ret = pm_runtime_get_sync(fmd->pmf); if (ret < 0) return ret; - ret = clk_enable(camclk->clock); + ret = clk_prepare_enable(camclk->clock); dbg("Enabled camclk %d: f: %lu", si->clk_id, clk_get_rate(camclk->clock)); } @@ -1260,7 +1253,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, return 0; if (--camclk->use_count == 0) { - clk_disable(camclk->clock); + clk_disable_unprepare(camclk->clock); pm_runtime_put(fmd->pmf); dbg("Disabled camclk %d", si->clk_id); }