Commit a4a8c2c4 authored by Tomasz Figa's avatar Tomasz Figa Committed by Rafael J. Wysocki

ARM: exynos: Move to generic PM domain DT bindings

This patch moves Exynos PM domain code to use the new generic PM domain
look-up framework introduced in previous patches, thus also allowing
the new code to be compiled with CONFIG_ARCH_EXYNOS.

This patch was originally submitted by Tomasz Figa when he was employed
by Samsung.

Link: http://marc.info/?l=linux-pm&m=139955336002083&w=2Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Reviewed-by: default avatarKevin Hilman <khilman@linaro.org>
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 207f1a2d
...@@ -8,6 +8,8 @@ Required Properties: ...@@ -8,6 +8,8 @@ Required Properties:
* samsung,exynos4210-pd - for exynos4210 type power domain. * samsung,exynos4210-pd - for exynos4210 type power domain.
- reg: physical base address of the controller and length of memory mapped - reg: physical base address of the controller and length of memory mapped
region. region.
- #power-domain-cells: number of cells in power domain specifier;
must be 0.
Optional Properties: Optional Properties:
- clocks: List of clock handles. The parent clocks of the input clocks to the - clocks: List of clock handles. The parent clocks of the input clocks to the
...@@ -29,6 +31,7 @@ Example: ...@@ -29,6 +31,7 @@ Example:
lcd0: power-domain-lcd0 { lcd0: power-domain-lcd0 {
compatible = "samsung,exynos4210-pd"; compatible = "samsung,exynos4210-pd";
reg = <0x10023C00 0x10>; reg = <0x10023C00 0x10>;
#power-domain-cells = <0>;
}; };
mfc_pd: power-domain@10044060 { mfc_pd: power-domain@10044060 {
...@@ -37,12 +40,8 @@ Example: ...@@ -37,12 +40,8 @@ Example:
clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_SW_ACLK333>, clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_SW_ACLK333>,
<&clock CLK_MOUT_USER_ACLK333>; <&clock CLK_MOUT_USER_ACLK333>;
clock-names = "oscclk", "pclk0", "clk0"; clock-names = "oscclk", "pclk0", "clk0";
#power-domain-cells = <0>;
}; };
Example of the node using power domain: See Documentation/devicetree/bindings/power/power_domain.txt for description
of consumer-side bindings.
node {
/* ... */
samsung,power-domain = <&lcd0>;
/* ... */
};
...@@ -105,78 +105,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) ...@@ -105,78 +105,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain)
return exynos_pd_power(domain, false); 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) static __init int exynos4_pm_init_power_domain(void)
{ {
struct platform_device *pdev; struct platform_device *pdev;
...@@ -202,7 +130,6 @@ static __init int exynos4_pm_init_power_domain(void) ...@@ -202,7 +130,6 @@ static __init int exynos4_pm_init_power_domain(void)
pd->base = of_iomap(np, 0); pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off; pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on; pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
pd->oscclk = clk_get(dev, "oscclk"); pd->oscclk = clk_get(dev, "oscclk");
if (IS_ERR(pd->oscclk)) if (IS_ERR(pd->oscclk))
...@@ -228,15 +155,12 @@ static __init int exynos4_pm_init_power_domain(void) ...@@ -228,15 +155,12 @@ static __init int exynos4_pm_init_power_domain(void)
clk_put(pd->oscclk); clk_put(pd->oscclk);
no_clk: no_clk:
platform_set_drvdata(pdev, pd);
on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN; on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN;
pm_genpd_init(&pd->pd, NULL, !on); pm_genpd_init(&pd->pd, NULL, !on);
of_genpd_add_provider_simple(np, &pd->pd);
} }
bus_register_notifier(&platform_bus_type, &platform_nb);
return 0; return 0;
} }
arch_initcall(exynos4_pm_init_power_domain); arch_initcall(exynos4_pm_init_power_domain);
...@@ -304,7 +304,7 @@ config PM_GENERIC_DOMAINS_RUNTIME ...@@ -304,7 +304,7 @@ config PM_GENERIC_DOMAINS_RUNTIME
config PM_GENERIC_DOMAINS_OF config PM_GENERIC_DOMAINS_OF
def_bool y def_bool y
depends on PM_GENERIC_DOMAINS && OF && !ARCH_EXYNOS depends on PM_GENERIC_DOMAINS && OF
config CPU_PM config CPU_PM
bool bool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment