Skip to content

Commit a4a8c2c

Browse files
tom3qrafaeljw
authored andcommitted
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=2 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Kevin Hilman <khilman@linaro.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 207f1a2 commit a4a8c2c

3 files changed

Lines changed: 8 additions & 85 deletions

File tree

‎Documentation/devicetree/bindings/arm/exynos/power_domain.txt‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Required Properties:
88
* samsung,exynos4210-pd - for exynos4210 type power domain.
99
- reg: physical base address of the controller and length of memory mapped
1010
region.
11+
- #power-domain-cells: number of cells in power domain specifier;
12+
must be 0.
1113

1214
Optional Properties:
1315
- clocks: List of clock handles. The parent clocks of the input clocks to the
@@ -29,6 +31,7 @@ Example:
2931
lcd0: power-domain-lcd0 {
3032
compatible = "samsung,exynos4210-pd";
3133
reg = <0x10023C00 0x10>;
34+
#power-domain-cells = <0>;
3235
};
3336

3437
mfc_pd: power-domain@10044060 {
@@ -37,12 +40,8 @@ Example:
3740
clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_SW_ACLK333>,
3841
<&clock CLK_MOUT_USER_ACLK333>;
3942
clock-names = "oscclk", "pclk0", "clk0";
43+
#power-domain-cells = <0>;
4044
};
4145

42-
Example of the node using power domain:
43-
44-
node {
45-
/* ... */
46-
samsung,power-domain = <&lcd0>;
47-
/* ... */
48-
};
46+
See Documentation/devicetree/bindings/power/power_domain.txt for description
47+
of consumer-side bindings.

‎arch/arm/mach-exynos/pm_domains.c‎

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -105,78 +105,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain)
105105
return exynos_pd_power(domain, false);
106106
}
107107

108-
static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
109-
struct device *dev)
110-
{
111-
int ret;
112-
113-
dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
114-
115-
while (1) {
116-
ret = pm_genpd_add_device(&pd->pd, dev);
117-
if (ret != -EAGAIN)
118-
break;
119-
cond_resched();
120-
}
121-
122-
pm_genpd_dev_need_restore(dev, true);
123-
}
124-
125-
static void exynos_remove_device_from_domain(struct device *dev)
126-
{
127-
struct generic_pm_domain *genpd = dev_to_genpd(dev);
128-
int ret;
129-
130-
dev_dbg(dev, "removing from power domain %s\n", genpd->name);
131-
132-
while (1) {
133-
ret = pm_genpd_remove_device(genpd, dev);
134-
if (ret != -EAGAIN)
135-
break;
136-
cond_resched();
137-
}
138-
}
139-
140-
static void exynos_read_domain_from_dt(struct device *dev)
141-
{
142-
struct platform_device *pd_pdev;
143-
struct exynos_pm_domain *pd;
144-
struct device_node *node;
145-
146-
node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0);
147-
if (!node)
148-
return;
149-
pd_pdev = of_find_device_by_node(node);
150-
if (!pd_pdev)
151-
return;
152-
pd = platform_get_drvdata(pd_pdev);
153-
exynos_add_device_to_domain(pd, dev);
154-
}
155-
156-
static int exynos_pm_notifier_call(struct notifier_block *nb,
157-
unsigned long event, void *data)
158-
{
159-
struct device *dev = data;
160-
161-
switch (event) {
162-
case BUS_NOTIFY_BIND_DRIVER:
163-
if (dev->of_node)
164-
exynos_read_domain_from_dt(dev);
165-
166-
break;
167-
168-
case BUS_NOTIFY_UNBOUND_DRIVER:
169-
exynos_remove_device_from_domain(dev);
170-
171-
break;
172-
}
173-
return NOTIFY_DONE;
174-
}
175-
176-
static struct notifier_block platform_nb = {
177-
.notifier_call = exynos_pm_notifier_call,
178-
};
179-
180108
static __init int exynos4_pm_init_power_domain(void)
181109
{
182110
struct platform_device *pdev;
@@ -202,7 +130,6 @@ static __init int exynos4_pm_init_power_domain(void)
202130
pd->base = of_iomap(np, 0);
203131
pd->pd.power_off = exynos_pd_power_off;
204132
pd->pd.power_on = exynos_pd_power_on;
205-
pd->pd.of_node = np;
206133

207134
pd->oscclk = clk_get(dev, "oscclk");
208135
if (IS_ERR(pd->oscclk))
@@ -228,15 +155,12 @@ static __init int exynos4_pm_init_power_domain(void)
228155
clk_put(pd->oscclk);
229156

230157
no_clk:
231-
platform_set_drvdata(pdev, pd);
232-
233158
on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN;
234159

235160
pm_genpd_init(&pd->pd, NULL, !on);
161+
of_genpd_add_provider_simple(np, &pd->pd);
236162
}
237163

238-
bus_register_notifier(&platform_bus_type, &platform_nb);
239-
240164
return 0;
241165
}
242166
arch_initcall(exynos4_pm_init_power_domain);

‎kernel/power/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ config PM_GENERIC_DOMAINS_RUNTIME
304304

305305
config PM_GENERIC_DOMAINS_OF
306306
def_bool y
307-
depends on PM_GENERIC_DOMAINS && OF && !ARCH_EXYNOS
307+
depends on PM_GENERIC_DOMAINS && OF
308308

309309
config CPU_PM
310310
bool

0 commit comments

Comments
 (0)