From patchwork Mon Nov 24 13:04:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 5366011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D669C11AD for ; Mon, 24 Nov 2014 13:14:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F27A203EB for ; Mon, 24 Nov 2014 13:14:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4192C203E1 for ; Mon, 24 Nov 2014 13:14:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XstR3-0007wq-GN; Mon, 24 Nov 2014 13:12:09 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XstQz-0007qd-1b for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 13:12:06 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFJ0039XONIAV00@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 22:11:42 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id B7.8B.19034.E8E23745; Mon, 24 Nov 2014 22:11:42 +0900 (KST) X-AuditID: cbfee691-f79b86d000004a5a-8a-54732e8e615e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C9.15.09430.E8E23745; Mon, 24 Nov 2014 22:11:42 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NFJ00EZLOLG6V60@mmp2.samsung.com>; Mon, 24 Nov 2014 22:11:42 +0900 (KST) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH RFC v2 01/12] arm: exynos: Add platform driver support for power domain driver Date: Mon, 24 Nov 2014 18:34:05 +0530 Message-id: <1416834256-11225-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416833572-6880-1-git-send-email-amit.daniel@samsung.com> References: <1416833572-6880-1-git-send-email-amit.daniel@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsWyRsSkWrdPrzjE4HefhkXD1RCL+UfOsVo8 u7WXyaJ3wVU2i6ebHzNZbHp8jdXi8q45bBafe48wWsw4v4/JYtHWL+wWZ05fYrU4/Kad1eL4 2nAHXo9NqzrZPO5c28PmcehwB6PH5iX1HluutrN49G1ZxejxeZNcAHsUl01Kak5mWWqRvl0C V8bbXetYCrZKVFw4K9TA+E+4i5GDQ0LARKLpXkIXIyeQKSZx4d56ti5GLg4hgaWMEvevrmSH SJhI7D85ASoxnVHi4+LJUM4EJonbd48wglSxCRhL/Ny5nx1kqoiAt8Tya4ogNcwCq5kktrZ/ YAKpERZIkJh8rwFsKouAqkTrk4dgvbwC7hIvzrczQ1ykIDFnkg1ImBMofObVEhaQsJCAm8Ti JjWQkRIC59glJvVfZoYYIyDxbfIhFohWWYlNB5ghbpaUOLjiBssERuEFjAyrGE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7NTUgtQimD4mDk6pBkYnV+0zKyZv Onatx2P/tr2W1ruS74mqlhq2yb6yEF7clKFo/d/w7wz1y8VX4vLtbpd2Wh3fVO9U6i15dX/b 59zeDYFaiXmztd41PT2e+tF00s2N0Y6aprOMT7gK+FUnCaxLSi692cd3oidYpo6lLval/rHH ra2abKt/GVo1ZHt7SRgtmfXiohJLcUaioRZzUXEiAILoyr3bAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141124_051205_294381_01856843 X-CRM114-Status: GOOD ( 12.18 ) X-Spam-Score: -5.0 (-----) Cc: devicetree@vger.kernel.org, ulf.hansson@linaro.org, kgene.kim@samsung.com, khilman@kernel.org, pankaj.dubey@samsung.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Amit Daniel Kachhap , geert@linux-m68k.org, s.nawrocki@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 This patch modifies Exynos Power Domain driver initialization implementation in following way: - Added platform driver support and probe function where Exynos PM Domain driver will finally register itself as MFD PMU client driver. In this way,all the Exynos power domains are probed once and registered with the power domain subsystem. - Existing DT bindings are used. Cc: Kukjin Kim Signed-off-by: Amit Daniel Kachhap --- arch/arm/mach-exynos/pm_domains.c | 40 +++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 20f2671..5cb5440 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -105,25 +105,17 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) return exynos_pd_power(domain, false); } -static __init int exynos4_pm_init_power_domain(void) +static int exynos_power_domain_probe(struct platform_device *pdev) { - struct platform_device *pdev; struct device_node *np; for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { struct exynos_pm_domain *pd; int on, i; - struct device *dev; - pdev = of_find_device_by_node(np); - dev = &pdev->dev; - - pd = kzalloc(sizeof(*pd), GFP_KERNEL); - if (!pd) { - pr_err("%s: failed to allocate memory for domain\n", - __func__); + pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL); + if (!pd) return -ENOMEM; - } pd->pd.name = kstrdup(np->name, GFP_KERNEL); pd->name = pd->pd.name; @@ -131,7 +123,7 @@ static __init int exynos4_pm_init_power_domain(void) pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; - pd->oscclk = clk_get(dev, "oscclk"); + pd->oscclk = of_clk_get_by_name(np, "oscclk"); if (IS_ERR(pd->oscclk)) goto no_clk; @@ -139,11 +131,11 @@ static __init int exynos4_pm_init_power_domain(void) char clk_name[8]; snprintf(clk_name, sizeof(clk_name), "clk%d", i); - pd->clk[i] = clk_get(dev, clk_name); + pd->clk[i] = of_clk_get_by_name(np, clk_name); if (IS_ERR(pd->clk[i])) break; snprintf(clk_name, sizeof(clk_name), "pclk%d", i); - pd->pclk[i] = clk_get(dev, clk_name); + pd->pclk[i] = of_clk_get_by_name(np, clk_name); if (IS_ERR(pd->pclk[i])) { clk_put(pd->clk[i]); pd->clk[i] = ERR_PTR(-EINVAL); @@ -163,4 +155,22 @@ no_clk: return 0; } -arch_initcall(exynos4_pm_init_power_domain); + +static const struct platform_device_id exynos_power_domain_id[] = { + { "exynos-pmu-pd"}, + { }, +}; + +static struct platform_driver exynos_power_domain_driver = { + .driver = { + .name = "exynos-pd", + }, + .probe = exynos_power_domain_probe, + .id_table = exynos_power_domain_id, +}; + +static int __init exynos_power_domain_init(void) +{ + return platform_driver_register(&exynos_power_domain_driver); +} +postcore_initcall(exynos_power_domain_init);