From patchwork Tue Jul 23 18:39:34 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: 2832160 Return-Path: X-Original-To: patchwork-linux-media@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 6922B9F4D4 for ; Tue, 23 Jul 2013 18:41:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C73B2018C for ; Tue, 23 Jul 2013 18:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D9BC201F7 for ; Tue, 23 Jul 2013 18:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933843Ab3GWSl2 (ORCPT ); Tue, 23 Jul 2013 14:41:28 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:30698 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933577Ab3GWSl1 (ORCPT ); Tue, 23 Jul 2013 14:41:27 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MQE00269JX2BZF0@mailout2.samsung.com>; Wed, 24 Jul 2013 03:41:26 +0900 (KST) X-AuditID: cbfee61a-b7f196d000007dfa-46-51eece56ed83 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A7.A0.32250.65ECEE15; Wed, 24 Jul 2013 03:41:26 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MQE0040KJU55Q10@mmp2.samsung.com>; Wed, 24 Jul 2013 03:41:26 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, arun.kk@samsung.com, Sylwester Nawrocki Subject: [REVIEW PATCH 3/6] exynos4-is: Simplify sclk_cam clocks handling Date: Tue, 23 Jul 2013 20:39:34 +0200 Message-id: <1374604777-15523-4-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1374604777-15523-1-git-send-email-s.nawrocki@samsung.com> References: <1374604777-15523-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t9jQd2wc+8CDV6+k7T4eOo2q8XZpjfs Fj0btrJazDi/j8ni8Jt2VgdWj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mr4teEia8F1wYpF sxYzNTBu4+ti5OCQEDCRaL5a0cXICWSKSVy4t56ti5GLQ0hgOqPEy6Od7BBOB5PEya63rCBV bAKGEr1H+xhBbBEBeYknvTfAOpgFWhgltv95ww6SEBbwlFhztIcJxGYRUJWYv/I1C4jNK+Am 8annPBvEZgWJOZNsQMKcAu4Se9ZOAZspBFTS/raVeQIj7wJGhlWMoqkFyQXFSem5hnrFibnF pXnpesn5uZsYwSHyTGoH48oGi0OMAhyMSjy8BbPeBQqxJpYVV+YeYpTgYFYS4V0qBRTiTUms rEotyo8vKs1JLT7EKM3BoiTOe6DVOlBIID2xJDU7NbUgtQgmy8TBKdXAGL7do796f+jtOV3t MjbbNTo/nbkSF7w6bfHnzvSod7q5St0Fkrxb07zPvTN+4aF1Jomz9W+QqIeeitSeVMHS6PPT D3xcaThRctW6KVz+H+6Vn9k4Q3Pm/jcekcU3zLXcYhT3tXy9LpWXuGPPcpXNAqu0yrmPnWtf EeT84d4U27n+56/8CN67VYmlOCPRUIu5qDgRAC2r44INAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 91f21e2..41366fe 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); }