From patchwork Mon Sep 19 10:55:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 76527 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp895261qgf; Mon, 19 Sep 2016 03:55:58 -0700 (PDT) X-Received: by 10.66.84.163 with SMTP id a3mr46441975paz.101.1474282558825; Mon, 19 Sep 2016 03:55:58 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ys7si26048246pac.59.2016.09.19.03.55.58; Mon, 19 Sep 2016 03:55:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755018AbcISKz5 (ORCPT + 4 others); Mon, 19 Sep 2016 06:55:57 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:57881 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754463AbcISKzy (ORCPT ); Mon, 19 Sep 2016 06:55:54 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ODQ00EO2ZP2G690@mailout1.w1.samsung.com>; Mon, 19 Sep 2016 11:55:51 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20160919105550eucas1p18e3c47680851f9cdca6f0bfed8360469~1tCsup9Ir1229212292eucas1p1d; Mon, 19 Sep 2016 10:55:50 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 34.53.02283.634CFD75; Mon, 19 Sep 2016 11:55:50 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20160919105549eucas1p1a2df94dc0ff48c7623949adbc5453bca~1tCsBHvJb3185531855eucas1p1N; Mon, 19 Sep 2016 10:55:49 +0000 (GMT) X-AuditID: cbfec7f1-f79f46d0000008eb-0a-57dfc436bfd6 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D0.87.10494.704CFD75; Mon, 19 Sep 2016 11:55:03 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ODQ00LJ5ZOPIK20@eusync1.samsung.com>; Mon, 19 Sep 2016 11:55:49 +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 Cc: Marek Szyprowski , Stephen Boyd , Michael Turquette , Ulf Hansson , Sylwester Nawrocki , Chanwoo Choi , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 2/5] clock: samsung: add support for runtime pm Date: Mon, 19 Sep 2016 12:55:22 +0200 Message-id: <1474282525-30441-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1474282525-30441-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djPc7pmR+6HG6xfJWKxccZ6VovrX56z Wky6P4HF4vULQ4tNj6+xWnzsucdq8bn3CKPFjPP7mCzWHrnLbnHxlKvF4TftrBY/znSzWBxf G+7A6/H+Riu7x+W+XiaP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W BsYnil2MnBwSAiYSTT/6mCFsMYkL99azdTFycQgJLGGU2Hh6NSuE08Qk8XLpVRaQKjYBQ4mu t11gVSICTYwST/qmsYM4zAJ9zBKt06azg1QJCzhJTPkzFWwui4CqxLEb/4G6OTh4BTwkfi1P gFgnJ3Hy2GRWEJtTwFNi9sS/YAuEgErebN3MOoGRdwEjwypGkdTS4tz03GIjveLE3OLSvHS9 5PzcTYzAaNh27OeWHYxd74IPMQpwMCrx8DIE3A8XYk0sK67MPcQowcGsJML7dA9QiDclsbIq tSg/vqg0J7X4EKMp0E0TmaVEk/OBkZpXEm9oYmhuaWhkbGFhbmSkJM479cOVcCGB9MSS1OzU 1ILUIpg+Jg5OqQZGRx2WTQaph1vXsv/ZUmxhbcBTprCBdUek2PMXpns/xqtecjoae/TWxSNv 8xfKfV9dld83OY7tz8y9n+8XVh//sfbWbb23/tHt8qF3jFWbNS5zG92Ivtcd2iOW8PDKZIuw Gib1O4FObxR/NG6xv526gmOJ78FvaUZ+Z5gvnVQsT0zRbLE6ndquxFKckWioxVxUnAgAR1SJ zZwCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20160919105549eucas1p1a2df94dc0ff48c7623949adbc5453bca 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-HopCount: 7 X-CMS-RootMailID: 20160919105549eucas1p1a2df94dc0ff48c7623949adbc5453bca X-RootMTR: 20160919105549eucas1p1a2df94dc0ff48c7623949adbc5453bca References: <1474282525-30441-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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. It also adds CLK_RUNTIME_PM flag to all clocks for which such device have been provided. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-pll.c | 4 ++-- drivers/clk/samsung/clk.c | 36 ++++++++++++++++++++++++------------ drivers/clk/samsung/clk.h | 1 + 3 files changed, 27 insertions(+), 14 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 48139bd510f1..fa929ddf3551 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c @@ -1174,7 +1174,7 @@ static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx, } init.name = pll_clk->name; - init.flags = pll_clk->flags; + init.flags = pll_clk->flags | (ctx->dev ? CLK_RUNTIME_PM : 0); init.parent_names = &pll_clk->parent_name; init.num_parents = 1; @@ -1285,7 +1285,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; - clk = clk_register(NULL, &pll->hw); + clk = clk_register(ctx->dev, &pll->hw); if (IS_ERR(clk)) { pr_err("%s: failed to register pll clock %s : %ld\n", __func__, pll_clk->name, PTR_ERR(clk)); diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index b7d87d6db9dc..762019893383 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -143,8 +143,11 @@ 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 = clk_register_fixed_rate(NULL, list->name, - list->parent_name, list->flags, list->fixed_rate); + unsigned int pm_flags = ctx->dev ? CLK_RUNTIME_PM : 0; + + clk = clk_register_fixed_rate(ctx->dev, list->name, + list->parent_name, list->flags | pm_flags, + list->fixed_rate); if (IS_ERR(clk)) { pr_err("%s: failed to register clock %s\n", __func__, list->name); @@ -172,8 +175,11 @@ void __init samsung_clk_register_fixed_factor(struct samsung_clk_provider *ctx, unsigned int idx; for (idx = 0; idx < nr_clk; idx++, list++) { - clk = clk_register_fixed_factor(NULL, list->name, - list->parent_name, list->flags, list->mult, list->div); + unsigned int pm_flags = ctx->dev ? CLK_RUNTIME_PM : 0; + + clk = clk_register_fixed_factor(ctx->dev, list->name, + list->parent_name, list->flags | pm_flags, list->mult, + list->div); if (IS_ERR(clk)) { pr_err("%s: failed to register clock %s\n", __func__, list->name); @@ -193,8 +199,10 @@ void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk = clk_register_mux(NULL, list->name, list->parent_names, - list->num_parents, list->flags, + unsigned int pm_flags = ctx->dev ? CLK_RUNTIME_PM : 0; + + clk = clk_register_mux(ctx->dev, list->name, list->parent_names, + list->num_parents, list->flags | pm_flags, ctx->reg_base + list->offset, list->shift, list->width, list->mux_flags, &ctx->lock); if (IS_ERR(clk)) { @@ -225,15 +233,17 @@ void __init samsung_clk_register_div(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { + unsigned int pm_flags = ctx->dev ? CLK_RUNTIME_PM : 0; + if (list->table) - clk = clk_register_divider_table(NULL, list->name, - list->parent_name, list->flags, + clk = clk_register_divider_table(ctx->dev, list->name, + list->parent_name, list->flags | pm_flags, ctx->reg_base + list->offset, list->shift, list->width, list->div_flags, list->table, &ctx->lock); else - clk = clk_register_divider(NULL, list->name, - list->parent_name, list->flags, + clk = clk_register_divider(ctx->dev, list->name, + list->parent_name, list->flags | pm_flags, ctx->reg_base + list->offset, list->shift, list->width, list->div_flags, &ctx->lock); if (IS_ERR(clk)) { @@ -264,8 +274,10 @@ void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk = clk_register_gate(NULL, list->name, list->parent_name, - list->flags, ctx->reg_base + list->offset, + unsigned int pm_flags = ctx->dev ? CLK_RUNTIME_PM : 0; + + clk = clk_register_gate(ctx->dev, list->name, list->parent_name, + list->flags | pm_flags, ctx->reg_base + list->offset, list->bit_idx, list->gate_flags, &ctx->lock); if (IS_ERR(clk)) { pr_err("%s: failed to register clock %s\n", __func__, diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index da3bdebabf1e..9263d8a27c6b 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -26,6 +26,7 @@ struct clk; */ struct samsung_clk_provider { void __iomem *reg_base; + struct device *dev; struct clk_onecell_data clk_data; spinlock_t lock; };