aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-03-20 10:55:12 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-03-22 17:15:11 -0400
commit632f7ce3f9b65039ac6c4f14ef91a0a1f3bdff59 (patch)
tree3b22a31cb051851f3e5f0acc550e6ea74fd3beb0 /drivers/base
parente90d5532773e2bcccc538dd346b9fc3482cd700c (diff)
PM / Domains: Sync runtime PM status with genpd after probe
Buses which currently supports attaching devices to their PM domains, will invoke the dev_pm_domain_attach() API from their ->probe() callbacks. During the attach procedure, genpd power up the PM domain. In those scenarios where the bus/driver don't need to access its device during probe, it may leave it in runtime PM suspended state since that's also the default state. In that way, no notifications through the runtime PM callbacks will reach the PM domain during probe. For genpd, the consequence from the above scenario means the PM domain will remain powered. Therefore, implement the struct dev_pm_domain's ->sync() callback, which is invoked from driver core after the bus/driver has probed the device. It allows genpd to power off the PM domain if it's unused. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> [ Ulf: Updated patch according to updates in driver core ] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/domain.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 45937f88e77c..295ff7189504 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2130,6 +2130,17 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
2130 genpd_queue_power_off_work(pd); 2130 genpd_queue_power_off_work(pd);
2131} 2131}
2132 2132
2133static void genpd_dev_pm_sync(struct device *dev)
2134{
2135 struct generic_pm_domain *pd;
2136
2137 pd = dev_to_genpd(dev);
2138 if (IS_ERR(pd))
2139 return;
2140
2141 genpd_queue_power_off_work(pd);
2142}
2143
2133/** 2144/**
2134 * genpd_dev_pm_attach - Attach a device to its PM domain using DT. 2145 * genpd_dev_pm_attach - Attach a device to its PM domain using DT.
2135 * @dev: Device to attach. 2146 * @dev: Device to attach.
@@ -2196,6 +2207,7 @@ int genpd_dev_pm_attach(struct device *dev)
2196 } 2207 }
2197 2208
2198 dev->pm_domain->detach = genpd_dev_pm_detach; 2209 dev->pm_domain->detach = genpd_dev_pm_detach;
2210 dev->pm_domain->sync = genpd_dev_pm_sync;
2199 pm_genpd_poweron(pd); 2211 pm_genpd_poweron(pd);
2200 2212
2201 return 0; 2213 return 0;