@@ -26,6 +26,7 @@ Optional Properties:
are supported currently.
- pd-power-conf: This optional parameter provides the local power configuration
value for the power domain.
+- parent: phandle of parent power domain.
Node of a device using power domains must have a samsung,power-domain property
defined with a phandle to respective power domain.
@@ -51,6 +52,7 @@ Example:
compatible = "samsung,exynos4210-pd", "samsung,exynos7-pd-mfc";
pd-offset = <0x4060>;
pd-power-conf = <0xf>;
+ parent = <&pd_top>;
#power-domain-cells = <0>;
};
@@ -26,7 +26,7 @@
#define INT_LOCAL_PWR_EN 0x7
#define MAX_CLK_PER_DOMAIN 4
-
+#define MAX_PARENT_POWER_DOMAIN 10
/*
* Exynos specific wrapper around the generic power domain
*/
@@ -179,7 +179,47 @@ no_clk:
pm_genpd_init(&pd->pd, NULL, !on);
of_genpd_add_provider_simple(np, &pd->pd);
}
+ /* Assign the child power domains to their parents */
+ for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
+ struct device_node *parent_np;
+ int i;
+ struct generic_pm_domain *child_domain, *parent_domain;
+ const char *name;
+
+ if (of_property_read_string_index(np, "compatible", 1,
+ &name)) {
+ /* Second entry not found, use the node name*/
+ name = np->name;
+ }
+ child_domain = pm_genpd_lookup_name(name);
+ if (!child_domain)
+ continue;
+ /* search parents in device tree */
+ for (i = 0; i < MAX_PARENT_POWER_DOMAIN; i++) {
+ parent_np = of_parse_phandle(np, "parent", i);
+ if (!parent_np)
+ break;
+
+ if (of_property_read_string_index(parent_np,
+ "compatible", 1, &name)) {
+ /* Second entry not found, use the node name*/
+ name = parent_np->name;
+ }
+
+ parent_domain = pm_genpd_lookup_name(name);
+ if (!parent_domain)
+ break;
+ if (pm_genpd_add_subdomain(parent_domain, child_domain))
+ pr_err("%s failed to add subdomain: %s\n",
+ parent_domain->name,
+ child_domain->name);
+ else
+ pr_info("%s has as child subdomain: %s.\n",
+ parent_domain->name,
+ child_domain->name);
+ }
+ }
return 0;
}