aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-09-25 12:28:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-25 16:08:41 -0400
commitd79b6fe17aa279c7015a9c4ee88809dad4be9959 (patch)
tree243cdfa1fc71557e944e99e023993961cdb778e8
parent2bd5306a8764d9496f3e3d90c4e608c247fcfd31 (diff)
PM / Domains: Add genpd attach/detach callbacks
While a PM domain can enable PM runtime management of its devices' module clocks by setting genpd->dev_ops.stop = pm_clk_suspend; genpd->dev_ops.start = pm_clk_resume; this also requires registering the clocks with the pm_clk subsystem. In the legacy case, this is handled by the platform code, after attaching the device to its PM domain. When the devices are instantiated from DT, devices are attached to their PM domains by generic code, leaving no method for the platform-specific PM domain code to register their clocks. Add two callbacks, allowing a PM domain to perform platform-specific tasks when a device is attached to or detached from a PM domain. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/base/power/domain.c6
-rw-r--r--include/linux/pm_domain.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index cd400575ee0e..2a9f4c5025e3 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1436,6 +1436,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
1436 1436
1437 spin_unlock_irq(&dev->power.lock); 1437 spin_unlock_irq(&dev->power.lock);
1438 1438
1439 if (genpd->attach_dev)
1440 genpd->attach_dev(dev);
1441
1439 mutex_lock(&gpd_data->lock); 1442 mutex_lock(&gpd_data->lock);
1440 gpd_data->base.dev = dev; 1443 gpd_data->base.dev = dev;
1441 list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); 1444 list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
@@ -1528,6 +1531,9 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
1528 genpd->device_count--; 1531 genpd->device_count--;
1529 genpd->max_off_time_changed = true; 1532 genpd->max_off_time_changed = true;
1530 1533
1534 if (genpd->detach_dev)
1535 genpd->detach_dev(dev);
1536
1531 spin_lock_irq(&dev->power.lock); 1537 spin_lock_irq(&dev->power.lock);
1532 1538
1533 dev->pm_domain = NULL; 1539 dev->pm_domain = NULL;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 292079d8da6b..9a93e622bdea 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -73,6 +73,8 @@ struct generic_pm_domain {
73 bool cached_power_down_ok; 73 bool cached_power_down_ok;
74 struct device_node *of_node; /* Node in device tree */ 74 struct device_node *of_node; /* Node in device tree */
75 struct gpd_cpu_data *cpu_data; 75 struct gpd_cpu_data *cpu_data;
76 void (*attach_dev)(struct device *dev);
77 void (*detach_dev)(struct device *dev);
76}; 78};
77 79
78static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 80static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)