devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Kevin Hilman <khilman@linaro.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	devicetree@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	Ben Dooks <ben-linux@fluff.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Philipp Zabel <philipp.zabel@gmail.com>,
	Mark Brown <broonie@kernel.org>, Tomasz Figa <t.figa@samsung.com>
Subject: [PATCH 03/24] ARM: exynos: Move to generic power domain bindings
Date: Tue, 10 Jun 2014 12:51:16 +0200	[thread overview]
Message-ID: <1402397497-26737-4-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1402397497-26737-1-git-send-email-ulf.hansson@linaro.org>

From: Tomasz Figa <t.figa@samsung.com>

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 <t.figa@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
---
 .../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 03b1551..ed6187e 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -307,7 +307,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
-- 
1.7.9.5


  parent reply	other threads:[~2014-06-10 10:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 10:51 [PATCH 00/24] PM / Domains: Generic OF-based support and cleanups Ulf Hansson
2014-06-10 10:51 ` [PATCH 01/24] base: power: Add generic OF-based power domain look-up Ulf Hansson
2014-06-10 10:51 ` [PATCH 02/24] drivercore: Bind/unbind power domain on probe/remove Ulf Hansson
2014-06-10 12:11   ` Rafael J. Wysocki
2014-06-10 12:53     ` Ulf Hansson
2014-06-10 21:27       ` Rafael J. Wysocki
2014-06-10 21:27         ` Greg Kroah-Hartman
2014-06-10 21:42           ` Tomasz Figa
2014-06-10 22:15             ` Ulf Hansson
2014-06-11  0:18             ` Rafael J. Wysocki
2014-06-12 16:39               ` Mark Brown
2014-06-12 19:33                 ` Rafael Wysocki
2014-06-11 18:16             ` Kevin Hilman
2014-06-11 18:19               ` Tomasz Figa
2014-06-10 10:51 ` Ulf Hansson [this message]
2014-06-10 10:51 ` [PATCH 04/24] PM / Domains: Ignore callbacks for subsys generic_pm_domain_data Ulf Hansson
2014-06-10 10:51 ` [PATCH 05/24] PM / Domains: Remove the pm_genpd_add|remove_callbacks APIs Ulf Hansson
2014-06-10 10:51 ` [PATCH 06/24] PM / Domains: Remove system PM callbacks from gpd_dev_ops Ulf Hansson
2014-06-10 10:51 ` [PATCH 07/24] ARM: shmobile: Drop dev_irq_safe from r8a7779 genpd config Ulf Hansson
2014-06-11 18:13   ` Kevin Hilman
2014-06-11 20:34     ` Ulf Hansson
2014-06-10 10:51 ` [PATCH 08/24] ARM: shmobile: Drop dev_irq_safe from R-mobile " Ulf Hansson
2014-06-10 10:51 ` [PATCH 09/24] PM / Domains: Remove dev_irq_safe from " Ulf Hansson
2014-06-10 10:51 ` [PATCH 10/24] PM / Domains: Remove redundant check for CONFIG_PM Ulf Hansson
2014-06-10 10:51 ` [PATCH 11/24] PM / Domains: Remove legacy API for adding devices through DT Ulf Hansson
2014-06-10 10:51 ` [PATCH 12/24] PM / Domains: Remove pm_genpd_syscore_switch() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 13/24] PM / Domains: Remove genpd_queue_power_off_work() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 14/24] PM / Domains: Add late_initcall to disable unused domains Ulf Hansson
2014-06-10 10:51 ` [PATCH 15/24] ARM: exynos: Leave disabling of unused pm domains to genpd Ulf Hansson
2014-06-10 10:51 ` [PATCH 16/24] ARM: s3c64xx: " Ulf Hansson
2014-06-10 10:51 ` [PATCH 18/24] PM / Domains: Remove default_stop_ok() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 19/24] dt: bindings: ux500: Add documentation for power domains Ulf Hansson
2014-06-11 18:20   ` Kevin Hilman
2014-06-12 10:26     ` Pavel Machek
2014-06-10 10:51 ` [PATCH 20/24] dt: bindings: ux500: Add header for power domains specifiers Ulf Hansson
2014-06-11 18:19   ` Kevin Hilman
     [not found] ` <1402397497-26737-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-10 10:51   ` [PATCH 17/24] drivers: sh: Leave disabling of unused pm domains to genpd Ulf Hansson
2014-06-10 10:51   ` [PATCH 21/24] ARM: ux500: Initial support for power domains Ulf Hansson
2014-06-10 10:51 ` [PATCH 22/24] ARM: ux500: Enable Kconfig for the generic power domain Ulf Hansson
2014-06-10 10:51 ` [PATCH 23/24] ARM: ux500: Add DT node for ux500 power domains Ulf Hansson
2014-06-10 10:51 ` [PATCH 24/24] ARM: ux500: Add sdi[n] devices to VAPE power domain Ulf Hansson
2014-06-11 18:23 ` [PATCH 00/24] PM / Domains: Generic OF-based support and cleanups Kevin Hilman
2014-06-11 18:32   ` Rafael J. Wysocki
2014-06-11 20:21     ` Ulf Hansson
2014-08-22 12:15 ` Geert Uytterhoeven
2014-08-22 15:56   ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402397497-26737-4-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=ben-linux@fluff.org \
    --cc=broonie@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@verge.net.au \
    --cc=kgene.kim@samsung.com \
    --cc=khilman@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=philipp.zabel@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=stern@rowland.harvard.edu \
    --cc=t.figa@samsung.com \
    --cc=tomasz.figa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).