From patchwork Wed Apr 23 16:46:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 4043051 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 E2685BFF02 for ; Wed, 23 Apr 2014 16:50:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E995E201E7 for ; Wed, 23 Apr 2014 16:50:07 +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 F38BD2011D for ; Wed, 23 Apr 2014 16:50:06 +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 1Wd0LI-00077F-0t; Wed, 23 Apr 2014 16:48:16 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wd0Ku-0006ld-MH for linux-arm-kernel@lists.infradead.org; Wed, 23 Apr 2014 16:47:53 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4H00A5CTB1EE10@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 23 Apr 2014 17:47:25 +0100 (BST) X-AuditID: cbfec7f4-b7fb36d000006ff7-08-5357ee9fc603 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id AD.12.28663.F9EE7535; Wed, 23 Apr 2014 17:47:27 +0100 (BST) Received: from AMDC1227.digital.local ([106.116.147.199]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4H00IDXTAW8080@eusync4.samsung.com>; Wed, 23 Apr 2014 17:47:27 +0100 (BST) From: Tomasz Figa To: linux-pm@vger.kernel.org Subject: [PATCH v3 3/3] ARM: exynos: Move to generic power domain bindings Date: Wed, 23 Apr 2014 18:46:58 +0200 Message-id: <1398271618-28932-4-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1398271618-28932-1-git-send-email-t.figa@samsung.com> References: <1398271618-28932-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42I5/e/4Nd3578KDDabsNbLYOGM9q8XUh0/Y LOYfOcdq0f9mIatF8+L1bBbnXq1ktOhdcJXN4uvhFYwWs6bsZbLY9Pgaq8XlXXPYLD73HmG0 mHF+H5PF7cu8Fm9+v2C3WHvkLrvF0usXmSzunjrKZjFh+loWi63zzjFanDl9idWide8Rdosf Z7pZLF4dbGOxWD/jNYvFql1/GC2Orw13kPZYM28No0dLcw+bx+W+XiaPnbPusnusXP6FzWPx npdMHptWdbJ53Lm2h81j/9w17B6bl9R7bLnazuLRt2UVo8eK1d/ZPT5vkvPYODc0gD+KyyYl NSezLLVI3y6BK+PQdv+CI2oVU89dYmxg3CbfxcjJISFgIrF372Z2CFtM4sK99WxdjFwcQgJL GSVennnIDuH0MUmcPbSFFaSKTUBN4nPDIzYQW0RARmLqlf2sIEXMAr/YJR78fcMEkhAW8JLo n/2EpYuRg4NFQFVi4xpbkDCvgJPEtzWPoLbJSfx/uQKsnFPAWeJG/3mwuBBQzfzJy5kmMPIu YGRYxSiaWppcUJyUnmuoV5yYW1yal66XnJ+7iRESeV92MC4+ZnWIUYCDUYmHV+FWeLAQa2JZ cWXuIUYJDmYlEd4li4BCvCmJlVWpRfnxRaU5qcWHGJk4OKUaGMP2ukxx/MxvaZyoFvc3svWg hP3NAN4m00mzTxsGdiUH1pv6+BswPLlpKHvkge0Ra7GDWfcuTtDZmyXw6cT1KaaGxwvE+z+u OtO79966ON/tGg1JR3wkdsh/OHPxx2mBBqWOlljLtDsLjs9edDFlk4t82VeZC0td51ir5DhM LLw7Nzj+v5bQZCWW4oxEQy3mouJEAG9+87GaAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140423_094752_899853_92D63E31 X-CRM114-Status: GOOD ( 17.01 ) X-Spam-Score: -5.7 (-----) Cc: Mark Rutland , Ulf Hansson , Philipp Zabel , Stephen Warren , Len Brown , Stephen Boyd , Tomasz Figa , Tomasz Figa , Pavel Machek , Kukjin Kim , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, Russell King , Bartlomiej Zolnierkiewicz , Lorenzo Pieralisi , devicetree@vger.kernel.org, Kevin Hilman , Pawel Moll , Ian Campbell , Mark Brown , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Rob Herring , Kumar Gala X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.5 required=5.0 tests=BAYES_00,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 moves Exynos power domain code to use the new generic power domain look-up framework introduced by previous patch, allowing the new code to be compiled with CONFIG_ARCH_EXYNOS selected as well. Signed-off-by: Tomasz Figa Reviewed-by: Ulf Hansson --- .../bindings/arm/exynos/power_domain.txt | 12 ++-- arch/arm/mach-exynos/pm_domains.c | 81 +--------------------- kernel/power/Kconfig | 2 +- 3 files changed, 7 insertions(+), 88 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt index 5216b41..60f26a8 100644 --- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt +++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt @@ -8,6 +8,8 @@ Required Properties: * samsung,exynos4210-pd - for exynos4210 type power domain. - reg: physical base address of the controller and length of memory mapped region. +- #power-domain-cells: number of cells in power domain specifier; + must be 0. Node of a device using power domains must have a samsung,power-domain property defined with a phandle to respective power domain. @@ -17,12 +19,8 @@ Example: lcd0: power-domain-lcd0 { compatible = "samsung,exynos4210-pd"; reg = <0x10023C00 0x10>; + #power-domain-cells = <0>; }; -Example of the node using power domain: - - node { - /* ... */ - samsung,power-domain = <&lcd0>; - /* ... */ - }; +See Documentation/devicetree/bindings/power/power_domain.txt for description +of consumer-side bindings. diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index fe6570e..9cad3c6 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -73,89 +73,14 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) return exynos_pd_power(domain, false); } -static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, - struct device *dev) -{ - int ret; - - dev_dbg(dev, "adding to power domain %s\n", pd->pd.name); - - while (1) { - ret = pm_genpd_add_device(&pd->pd, dev); - if (ret != -EAGAIN) - break; - cond_resched(); - } - - pm_genpd_dev_need_restore(dev, true); -} - -static void exynos_remove_device_from_domain(struct device *dev) -{ - struct generic_pm_domain *genpd = dev_to_genpd(dev); - int ret; - - dev_dbg(dev, "removing from power domain %s\n", genpd->name); - - while (1) { - ret = pm_genpd_remove_device(genpd, dev); - if (ret != -EAGAIN) - break; - cond_resched(); - } -} - -static void exynos_read_domain_from_dt(struct device *dev) -{ - struct platform_device *pd_pdev; - struct exynos_pm_domain *pd; - struct device_node *node; - - node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0); - if (!node) - return; - pd_pdev = of_find_device_by_node(node); - if (!pd_pdev) - return; - pd = platform_get_drvdata(pd_pdev); - exynos_add_device_to_domain(pd, dev); -} - -static int exynos_pm_notifier_call(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct device *dev = data; - - switch (event) { - case BUS_NOTIFY_BIND_DRIVER: - if (dev->of_node) - exynos_read_domain_from_dt(dev); - - break; - - case BUS_NOTIFY_UNBOUND_DRIVER: - exynos_remove_device_from_domain(dev); - - break; - } - return NOTIFY_DONE; -} - -static struct notifier_block platform_nb = { - .notifier_call = exynos_pm_notifier_call, -}; - static __init int exynos4_pm_init_power_domain(void) { - struct platform_device *pdev; struct device_node *np; for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { struct exynos_pm_domain *pd; int on; - pdev = of_find_device_by_node(np); - pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) { pr_err("%s: failed to allocate memory for domain\n", @@ -168,17 +93,13 @@ static __init int exynos4_pm_init_power_domain(void) pd->base = of_iomap(np, 0); pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; - pd->pd.of_node = np; - - platform_set_drvdata(pdev, pd); on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; pm_genpd_init(&pd->pd, NULL, !on); + of_genpd_add_provider(np, of_genpd_xlate_simple, &pd->pd); } - bus_register_notifier(&platform_bus_type, &platform_nb); - return 0; } arch_initcall(exynos4_pm_init_power_domain); diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 45aa98e..b17588c 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -308,7 +308,7 @@ config PM_GENERIC_DOMAINS_RUNTIME config PM_GENERIC_DOMAINS_OF def_bool y - depends on PM_GENERIC_DOMAINS && OF && !ARCH_EXYNOS + depends on PM_GENERIC_DOMAINS && OF config CPU_PM bool