aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-08-15 14:32:59 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-09-03 19:36:53 -0400
commit74a2799ab51acec9410f467fef8678ebb1125d7d (patch)
treed26ffff8d487e5412c5b18c00bfda61623f2c4df
parent40114447a7f89860b46a64e5504f313656cb5f27 (diff)
PM / Domains: Operations related to cpuidle using domain names
Make it possible to use domain names in operations connecting cpuidle to and disconnecting it from a PM domain. This is useful on platforms where PM domain objects are organized in such a way that the names of the domains are easier to use than the addresses of those objects. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--drivers/base/power/domain.c19
-rw-r--r--include/linux/pm_domain.h10
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index e44e1a8e8376..12ad070c244f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1888,6 +1888,16 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
1888} 1888}
1889 1889
1890/** 1890/**
1891 * pm_genpd_name_attach_cpuidle - Find PM domain and connect cpuidle to it.
1892 * @name: Name of the domain to connect to cpuidle.
1893 * @state: cpuidle state this domain can manipulate.
1894 */
1895int pm_genpd_name_attach_cpuidle(const char *name, int state)
1896{
1897 return pm_genpd_attach_cpuidle(pm_genpd_lookup_name(name), state);
1898}
1899
1900/**
1891 * pm_genpd_detach_cpuidle - Remove the cpuidle connection from a PM domain. 1901 * pm_genpd_detach_cpuidle - Remove the cpuidle connection from a PM domain.
1892 * @genpd: PM domain to remove the cpuidle connection from. 1902 * @genpd: PM domain to remove the cpuidle connection from.
1893 * 1903 *
@@ -1925,6 +1935,15 @@ int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
1925 return ret; 1935 return ret;
1926} 1936}
1927 1937
1938/**
1939 * pm_genpd_name_detach_cpuidle - Find PM domain and disconnect cpuidle from it.
1940 * @name: Name of the domain to disconnect cpuidle from.
1941 */
1942int pm_genpd_name_detach_cpuidle(const char *name)
1943{
1944 return pm_genpd_detach_cpuidle(pm_genpd_lookup_name(name));
1945}
1946
1928/* Default device callbacks for generic PM domains. */ 1947/* Default device callbacks for generic PM domains. */
1929 1948
1930/** 1949/**
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index f2a633a913e7..7c1d252b20c0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -156,7 +156,9 @@ extern int pm_genpd_add_callbacks(struct device *dev,
156 struct gpd_timing_data *td); 156 struct gpd_timing_data *td);
157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td); 157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state); 158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
159extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
159extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); 160extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
161extern int pm_genpd_name_detach_cpuidle(const char *name);
160extern void pm_genpd_init(struct generic_pm_domain *genpd, 162extern void pm_genpd_init(struct generic_pm_domain *genpd,
161 struct dev_power_governor *gov, bool is_off); 163 struct dev_power_governor *gov, bool is_off);
162 164
@@ -229,10 +231,18 @@ static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int s
229{ 231{
230 return -ENOSYS; 232 return -ENOSYS;
231} 233}
234static inline int pm_genpd_name_attach_cpuidle(const char *name, int state)
235{
236 return -ENOSYS;
237}
232static inline int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd) 238static inline int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
233{ 239{
234 return -ENOSYS; 240 return -ENOSYS;
235} 241}
242static inline int pm_genpd_name_detach_cpuidle(const char *name)
243{
244 return -ENOSYS;
245}
236static inline void pm_genpd_init(struct generic_pm_domain *genpd, 246static inline void pm_genpd_init(struct generic_pm_domain *genpd,
237 struct dev_power_governor *gov, bool is_off) 247 struct dev_power_governor *gov, bool is_off)
238{ 248{