From patchwork Mon Feb 19 15:44:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Purski X-Patchwork-Id: 10228167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB3B760467 for ; Mon, 19 Feb 2018 15:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB43E2873F for ; Mon, 19 Feb 2018 15:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FB7128A30; Mon, 19 Feb 2018 15:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F54228A5C for ; Mon, 19 Feb 2018 15:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753154AbeBSPrY (ORCPT ); Mon, 19 Feb 2018 10:47:24 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:57002 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753010AbeBSPpG (ORCPT ); Mon, 19 Feb 2018 10:45:06 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180219154504euoutp012720e71d1f9aa9ee36fb560ea2648f14~UxJGgtwJU0897708977euoutp01e; Mon, 19 Feb 2018 15:45:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180219154504euoutp012720e71d1f9aa9ee36fb560ea2648f14~UxJGgtwJU0897708977euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519055104; bh=Gk3Mw6sv2UJWVxEV/vQICttirtB+gyYm2s3C2eLmsgI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=JG491dMsNCkEhYondoCo2hqIODE/3sJ4fx6RZwvPpyTgKNlazY1JSsiwH1x4i5Ho1 YzaOROuayDgyVzgk3O6qDJo8TZrTKhNb/qFaCSlUCPGnzfiqqiJZLpAru2BjG3mqaz x5qCyqjmvGGf6MSCq/6/6WB5m03+dyUjRg8FIVTQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180219154501eucas1p12ff2846c24184a8ed8e23600e0fe9da5~UxJEbwc2U0552405524eucas1p1Q; Mon, 19 Feb 2018 15:45:01 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F6.C8.05700.CF0FA8A5; Mon, 19 Feb 2018 15:45:00 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180219154458eucas1p1b4e728757e78f3d5dde5c9aa565a5d20~UxJBGzTfe1792217922eucas1p1d; Mon, 19 Feb 2018 15:44:58 +0000 (GMT) X-AuditID: cbfec7f2-5ffe19c000011644-4b-5a8af0fcb8d6 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 94.1D.04183.AF0FA8A5; Mon, 19 Feb 2018 15:44:58 +0000 (GMT) Received: from AMDC2075.DIGITAL.local ([106.120.51.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P4E00C9VMEN0Z00@eusync4.samsung.com>; Mon, 19 Feb 2018 15:44:58 +0000 (GMT) From: Maciej Purski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , Krzysztof Kozlowski , Mauro Carvalho Chehab , Andrzej Pietrasiewicz , Jacek Anaszewski , Kamil Debski , Jeongtae Park , Andrzej Hajda , Russell King , Sylwester Nawrocki , Thibault Saunier , Javier Martinez Canillas , Hans Verkuil , Hoegeun Kwon , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Maciej Purski Subject: [PATCH 3/8] drm/exynos/decon: Use clk bulk API Date: Mon, 19 Feb 2018 16:44:01 +0100 Message-id: <1519055046-2399-4-git-send-email-m.purski@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1519055046-2399-1-git-send-email-m.purski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTYRjG+8591uIwo32Z+ccgMiFrEPRBF7Iyzh8SJUSxrqc8aeRW7Khl SU5JzVmps9LsZhZapqVzLi+si60spcnUtCwvuCCX1qylmJm1Ofvv4Xl+3/O+L3wMLrOSAcxh TZyg1fCxCsqPML/81bpsckSvWqErl6DuBzYSnbe9xlChM4NAVQUPSdQx6qLQSO4VgFylegoZ +nII9KGmkkDDX8sxZK14i6HBXjuBrrzKIFG2YwhHra2VNHqTOkwjo6OTRN/P9ZKovf4ahc5V 1pCooPUxhhovWQAqcnYTqMLaQ6MS4ySG7M3h6Pmwp2Sqs4pABXlOCrmfGvD1QVx7px3nXO/S aO7i7yqSqyvsoTljWSbFPRrrJ7m+rCaMq76TzJmyPf4FUxng3MYgrsOaQm+do/JbEyXEHk4Q tMvX7feLcUwOgmOOwBPVXUodaJHrgYSB7EpYXNpFebWMvQtgXjWuB34e7QbQZhm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HCCqADQkJC1gGqsMCM+QwJmY9Q24NKHSAInAyn nhcpfZkAsh9Q81+e7GZ4pIdPlWozfOxPnqT6uir5PkbJg1TDMyvwsZiMpTo9Wt7eWCg1PVK8 ywLyHDXX2YXvbcVSFuc4Xg5EtcCvEQSw2ZwqUcUdi+QYFZetToy8kq4yAe9hr/q3W18D3Y94 MyAJIBWJSYdOIcGYHC5XZQYUwZMGiOOmvJI4gcnNYzXpSk12GsuZQQiBSgPFlqhchYRMZLLY VJbNYDX/XYQQBGtBlprNG+2rCnFQowbhQNipsyvy0W8iy0LmzxiZX1tcxL68S2eU9+2H41n2 tm1+hT3wtiOlJHozwn/SIghb/6qf6KDlw6cdW91W48R1Y9NCee3V9ijB08fvpzPrY1KCJLJh +ZrEmXoIRy602Mr0y1M9c/rv7sHwG39PMA+D6F9SlEtiZOE8Dcf8A+1cCC6sAgAA X-CMS-MailID: 20180219154458eucas1p1b4e728757e78f3d5dde5c9aa565a5d20 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180219154458eucas1p1b4e728757e78f3d5dde5c9aa565a5d20 X-RootMTR: 20180219154458eucas1p1b4e728757e78f3d5dde5c9aa565a5d20 References: <1519055046-2399-1-git-send-email-m.purski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using bulk clk functions simplifies the driver's code. Use devm_clk_bulk functions instead of iterating over an array of clks. Signed-off-by: Maciej Purski --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 50 ++++++++------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 1c330f2..1760fcb 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -55,7 +55,7 @@ struct decon_context { struct exynos_drm_plane_config configs[WINDOWS_NR]; void __iomem *addr; struct regmap *sysreg; - struct clk *clks[ARRAY_SIZE(decon_clks_name)]; + struct clk_bulk_data *clks; unsigned int irq; unsigned int irq_vsync; unsigned int irq_lcd_sys; @@ -485,15 +485,13 @@ static irqreturn_t decon_te_irq_handler(int irq, void *dev_id) static void decon_clear_channels(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx; - int win, i, ret; + int win, ret; DRM_DEBUG_KMS("%s\n", __FILE__); - for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { - ret = clk_prepare_enable(ctx->clks[i]); - if (ret < 0) - goto err; - } + ret = clk_bulk_prepare_enable(ARRAY_SIZE(decon_clks_name), ctx->clks); + if (ret < 0) + return; decon_shadow_protect(ctx, true); for (win = 0; win < WINDOWS_NR; win++) @@ -504,10 +502,6 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc) /* TODO: wait for possible vsync */ msleep(50); - -err: - while (--i >= 0) - clk_disable_unprepare(ctx->clks[i]); } static enum drm_mode_status decon_mode_valid(struct exynos_drm_crtc *crtc, @@ -638,10 +632,8 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id) static int exynos5433_decon_suspend(struct device *dev) { struct decon_context *ctx = dev_get_drvdata(dev); - int i = ARRAY_SIZE(decon_clks_name); - while (--i >= 0) - clk_disable_unprepare(ctx->clks[i]); + clk_bulk_disable_unprepare(ARRAY_SIZE(decon_clks_name), ctx->clks); return 0; } @@ -649,19 +641,9 @@ static int exynos5433_decon_suspend(struct device *dev) static int exynos5433_decon_resume(struct device *dev) { struct decon_context *ctx = dev_get_drvdata(dev); - int i, ret; - - for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { - ret = clk_prepare_enable(ctx->clks[i]); - if (ret < 0) - goto err; - } - - return 0; + int ret; -err: - while (--i >= 0) - clk_disable_unprepare(ctx->clks[i]); + ret = clk_bulk_prepare_enable(ARRAY_SIZE(decon_clks_name), ctx->clks); return ret; } @@ -719,7 +701,6 @@ static int exynos5433_decon_probe(struct platform_device *pdev) struct decon_context *ctx; struct resource *res; int ret; - int i; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) @@ -732,15 +713,14 @@ static int exynos5433_decon_probe(struct platform_device *pdev) if (ctx->out_type & IFTYPE_HDMI) ctx->first_win = 1; - for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { - struct clk *clk; - - clk = devm_clk_get(ctx->dev, decon_clks_name[i]); - if (IS_ERR(clk)) - return PTR_ERR(clk); + ctx->clks = devm_clk_bulk_alloc(dev, ARRAY_SIZE(decon_clks_name), + decon_clks_name); + if (IS_ERR(ctx->clks)) + return PTR_ERR(ctx->clks); - ctx->clks[i] = clk; - } + ret = devm_clk_bulk_get(dev, ARRAY_SIZE(decon_clks_name), ctx->clks); + if (ret < 0) + return ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctx->addr = devm_ioremap_resource(dev, res);