From patchwork Wed Aug 9 10:35:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9890295 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 8A54360363 for ; Wed, 9 Aug 2017 10:37:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DD5328A2E for ; Wed, 9 Aug 2017 10:37:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91E2C28A51; Wed, 9 Aug 2017 10:37:12 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D17E528A2E for ; Wed, 9 Aug 2017 10:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6Q/dwTELCjC/z88uWaBEoAjyEJ5Tw1N8U7lOfaKm83E=; b=pYwL/F8QHwafoTbPEVghpZiEih pl8oWM1h9UDt9J9Nu+TsS35vQ6mAJN7Qd17YOaK9SrQyRfBikSBS+tX2AbHW5hc3GNYVaYMX1+rNQ 4q7B4t3AoJR6+GtWm1MUI0f4y3NITTwJ28h89cH9PcM7LAZZi7bsgyQu1n0DidfwKicXZnWfvGZ61 U/pcj9agJkVV1mcWAdGZVdoH9UCH2CeIJbGkoD3be8yc5ukLC1xBg8eLL93Hd1vhvs62/M98r7Ipn ZXQdDjHKhYmV+UAlQepC/KHkIZntXj+hKaSC0f0yJ8rLG1U+6lbj0QgCf+ZJxVyoPaO+TaRydP00s o1aqoKOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfOMN-0001AN-3s; Wed, 09 Aug 2017 10:37:07 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dfOLZ-0000W7-Ac for linux-arm-kernel@bombadil.infradead.org; Wed, 09 Aug 2017 10:36:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-reply-to:Message-id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ci6yVz4R+LvedGHjiSGZ6I2P6B37oaEGtzq/QlYHwoU=; b=Hj/bjBWbf3ysKf3XeVXq05aHQ W07ywXhgJq7VMYMweBsxh/XdVuBy+I+Jg0uQcewnwBpUCv2XdPhiMZdkikEkCGzaLr9Yemb/7WwIV R9BrcHHyGrfO4lz9KLGBR0JK9+QhaMZHiSNdKrbFGXkcAgwGVDa78wxabvVkOQFY04xbHDNwbLQQ6 5IQ91+Zfo25anB5iId0NDEfsIsM3dvnOENR6VOty2eTuqCUoz50QrW4qebkBF7dyfOJAmWDGc9zZs mjMboqtUlsdeIWyPB+pFsifXF+DLLeM5ssa7nf04FvoTOiADNfrMTwzYLWfpMbdAXL/EsFccoe77B MZXdhU6cQ==; Received: from mailout2.w1.samsung.com ([210.118.77.12]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dfOLV-0006Ly-2T for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2017 10:36:16 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170809103515euoutp023ba34d20e4b56326c6e5f003edfd0766~ZJxNqhffe1734317343euoutp02e; Wed, 9 Aug 2017 10:35:15 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170809103514eucas1p255a391d96947dcbec65adcb2133d1553~ZJxM5tucp2191321913eucas1p2L; Wed, 9 Aug 2017 10:35:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id EC.66.12867.165EA895; Wed, 9 Aug 2017 11:35:13 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170809103513eucas1p25e142aac911838847e70a036c5d93131~ZJxMOTeQk2450724507eucas1p28; Wed, 9 Aug 2017 10:35:13 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-3f-598ae5613c36 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id BD.75.20118.165EA895; Wed, 9 Aug 2017 11:35:13 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OUE00IH6YQKHB00@eusync2.samsung.com>; Wed, 09 Aug 2017 11:35:13 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 2/5] clk: samsung: Add support for runtime PM Date: Wed, 09 Aug 2017 12:35:04 +0200 Message-id: <1502274907-11931-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1502274907-11931-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNIsWRmVeSWpSXmKPExsWy7djP87qJT7siDT7/srLYOGM9q8X1L89Z LSbdn8Bicf78BnaLTY+vsVp87LnHavG59wijxYzz+5gs1h65y25x8ZSrxeE37awWP850s1gc XxvuwOvx/kYru8flvl4mj02rOtk87lzbw+axeUm9R9+WVYwenzfJBbBHcdmkpOZklqUW6dsl cGUc3TeLpWC1YsWrr2oNjN+kuxg5OCQETCTufXPpYuQEMsUkLtxbz9bFyMUhJLCUUWLHkdWs EM5nRolPOz8yQVSZSCza9pgdxBYSWMYocXppAkRRA5PEvP0XwBJsAoYSXW+7wEaJCDQxSkzc sB5sFLNAE7PEtH0TwUYJCzhIzP15ig3EZhFQlZi8fDYziM0r4CHx/EcrI8Q6OYmTxyazgtic Ap4S6+fcYoaIr2KX+La4FuIHWYlNB6DCLhIXp56FahWWeHV8CzuELSNxeXI3C4TdzyjR1KoN Yc9glDj3lhfCtpY4fPwi2CpmAT6JSdumM0OM55XoaBOCKPGQ+HpzLhtE2FGieWIdxO9zGCUu rX7BOIFRZgEjwypGkdTS4tz01GJjveLE3OLSvHS95PzcTYzAJHD63/FPOxi/nrA6xCjAwajE w9u4qzNSiDWxrLgy9xCjBAezkgjv88ddkUK8KYmVValF+fFFpTmpxYcYpTlYlMR5baPaIoUE 0hNLUrNTUwtSi2CyTBycUg2MYccT8oRWPY70LLz4dsYuhduPt/+ueNikvjpNr+dlU82yVcs2 J24o/H1WY6fzlqAjm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eucas1p25e142aac911838847e70a036c5d93131 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170809103513eucas1p25e142aac911838847e70a036c5d93131 X-RootMTR: 20170809103513eucas1p25e142aac911838847e70a036c5d93131 References: <1502274907-11931-1-git-send-email-m.szyprowski@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170809_113613_124342_33E82DCE X-CRM114-Status: GOOD ( 14.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Bartlomiej Zolnierkiewicz , Michael Turquette , Stephen Boyd , Krzysztof Kozlowski , Inki Dae , Chanwoo Choi , Sylwester Nawrocki , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds struct device pointer to samsung_clk_provider and forwarding it to clk_register_* functions, so drivers can register clocks, which use runtime pm feature. Signed-off-by: Marek Szyprowski Reviewed-by: Ulf Hansson Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clk/samsung/clk-pll.c | 2 +- drivers/clk/samsung/clk.c | 12 ++++++------ drivers/clk/samsung/clk.h | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 037c61484098..41ebb94d2855 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c @@ -1388,7 +1388,7 @@ static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx, pll->lock_reg = base + pll_clk->lock_offset; pll->con_reg = base + pll_clk->con_offset; - ret = clk_hw_register(NULL, &pll->hw); + ret = clk_hw_register(ctx->dev, &pll->hw); if (ret) { pr_err("%s: failed to register pll clock %s : %d\n", __func__, pll_clk->name, ret); diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 7ce0fa86c5ff..aef97b091b50 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -134,7 +134,7 @@ void __init samsung_clk_register_fixed_rate(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk_hw = clk_hw_register_fixed_rate(NULL, list->name, + clk_hw = clk_hw_register_fixed_rate(ctx->dev, list->name, list->parent_name, list->flags, list->fixed_rate); if (IS_ERR(clk_hw)) { pr_err("%s: failed to register clock %s\n", __func__, @@ -163,7 +163,7 @@ void __init samsung_clk_register_fixed_factor(struct samsung_clk_provider *ctx, unsigned int idx; for (idx = 0; idx < nr_clk; idx++, list++) { - clk_hw = clk_hw_register_fixed_factor(NULL, list->name, + clk_hw = clk_hw_register_fixed_factor(ctx->dev, list->name, list->parent_name, list->flags, list->mult, list->div); if (IS_ERR(clk_hw)) { pr_err("%s: failed to register clock %s\n", __func__, @@ -184,7 +184,7 @@ void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk_hw = clk_hw_register_mux(NULL, list->name, + clk_hw = clk_hw_register_mux(ctx->dev, list->name, list->parent_names, list->num_parents, list->flags, ctx->reg_base + list->offset, list->shift, list->width, list->mux_flags, &ctx->lock); @@ -217,13 +217,13 @@ void __init samsung_clk_register_div(struct samsung_clk_provider *ctx, for (idx = 0; idx < nr_clk; idx++, list++) { if (list->table) - clk_hw = clk_hw_register_divider_table(NULL, + clk_hw = clk_hw_register_divider_table(ctx->dev, list->name, list->parent_name, list->flags, ctx->reg_base + list->offset, list->shift, list->width, list->div_flags, list->table, &ctx->lock); else - clk_hw = clk_hw_register_divider(NULL, list->name, + clk_hw = clk_hw_register_divider(ctx->dev, list->name, list->parent_name, list->flags, ctx->reg_base + list->offset, list->shift, list->width, list->div_flags, &ctx->lock); @@ -255,7 +255,7 @@ void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk_hw = clk_hw_register_gate(NULL, list->name, list->parent_name, + clk_hw = clk_hw_register_gate(ctx->dev, list->name, list->parent_name, list->flags, ctx->reg_base + list->offset, list->bit_idx, list->gate_flags, &ctx->lock); if (IS_ERR(clk_hw)) { diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index b8ca0dd3a38b..f0acae4f5d1b 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -24,6 +24,7 @@ */ struct samsung_clk_provider { void __iomem *reg_base; + struct device *dev; spinlock_t lock; /* clk_data must be the last entry due to variable lenght 'hws' array */ struct clk_hw_onecell_data clk_data;