aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/domain.c27
-rw-r--r--include/linux/pm_domain.h43
2 files changed, 57 insertions, 13 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 5f4606f13be6..ac06d0280b42 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1465,6 +1465,33 @@ int __pm_genpd_of_add_device(struct device_node *genpd_node, struct device *dev,
1465 return __pm_genpd_add_device(genpd, dev, td); 1465 return __pm_genpd_add_device(genpd, dev, td);
1466} 1466}
1467 1467
1468
1469/**
1470 * __pm_genpd_name_add_device - Find I/O PM domain and add a device to it.
1471 * @domain_name: Name of the PM domain to add the device to.
1472 * @dev: Device to be added.
1473 * @td: Set of PM QoS timing parameters to attach to the device.
1474 */
1475int __pm_genpd_name_add_device(const char *domain_name, struct device *dev,
1476 struct gpd_timing_data *td)
1477{
1478 struct generic_pm_domain *genpd = NULL, *gpd;
1479
1480 if (IS_ERR_OR_NULL(domain_name) || IS_ERR_OR_NULL(dev))
1481 return -EINVAL;
1482
1483 mutex_lock(&gpd_list_lock);
1484 list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
1485 if (!strcmp(gpd->name, domain_name)) {
1486 genpd = gpd;
1487 break;
1488 }
1489 }
1490 mutex_unlock(&gpd_list_lock);
1491
1492 return __pm_genpd_add_device(genpd, dev, td);
1493}
1494
1468/** 1495/**
1469 * pm_genpd_remove_device - Remove a device from an I/O PM domain. 1496 * pm_genpd_remove_device - Remove a device from an I/O PM domain.
1470 * @genpd: PM domain to remove the device from. 1497 * @genpd: PM domain to remove the device from.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 08adf8e5a80e..1991a92b0567 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -138,17 +138,9 @@ extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
138 struct device *dev, 138 struct device *dev,
139 struct gpd_timing_data *td); 139 struct gpd_timing_data *td);
140 140
141static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 141extern int __pm_genpd_name_add_device(const char *domain_name,
142 struct device *dev) 142 struct device *dev,
143{ 143 struct gpd_timing_data *td);
144 return __pm_genpd_add_device(genpd, dev, NULL);
145}
146
147static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
148 struct device *dev)
149{
150 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
151}
152 144
153extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 145extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
154 struct device *dev); 146 struct device *dev);
@@ -187,8 +179,15 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
187{ 179{
188 return -ENOSYS; 180 return -ENOSYS;
189} 181}
190static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 182static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
191 struct device *dev) 183 struct device *dev,
184 struct gpd_timing_data *td)
185{
186 return -ENOSYS;
187}
188static inline int __pm_genpd_name_add_device(const char *domain_name,
189 struct device *dev,
190 struct gpd_timing_data *td)
192{ 191{
193 return -ENOSYS; 192 return -ENOSYS;
194} 193}
@@ -242,6 +241,24 @@ static inline bool default_stop_ok(struct device *dev)
242#define pm_domain_always_on_gov NULL 241#define pm_domain_always_on_gov NULL
243#endif 242#endif
244 243
244static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
245 struct device *dev)
246{
247 return __pm_genpd_add_device(genpd, dev, NULL);
248}
249
250static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
251 struct device *dev)
252{
253 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
254}
255
256static inline int pm_genpd_name_add_device(const char *domain_name,
257 struct device *dev)
258{
259 return __pm_genpd_name_add_device(domain_name, dev, NULL);
260}
261
245static inline int pm_genpd_remove_callbacks(struct device *dev) 262static inline int pm_genpd_remove_callbacks(struct device *dev)
246{ 263{
247 return __pm_genpd_remove_callbacks(dev, true); 264 return __pm_genpd_remove_callbacks(dev, true);