diff options
author | Dave Gerlach <d-gerlach@ti.com> | 2017-02-03 12:29:26 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-02-09 16:52:17 -0500 |
commit | 0764c604c8128f17fd740ff8b1701d0a1301eb7e (patch) | |
tree | 80fbc48bb1727baecb8e982eb94af133f9f0cbf5 | |
parent | 6ac423973397d17684528e89fbbca49b2ff7bb43 (diff) |
PM / OPP: Expose _of_get_opp_desc_node as dev_pm_opp API
Rename _of_get_opp_desc_node to dev_pm_opp_of_get_opp_desc_node and add it
to include/linux/pm_opp.h to allow other drivers, such as platform OPP
and cpufreq drivers, to make use of it.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/opp/of.c | 9 | ||||
-rw-r--r-- | include/linux/pm_opp.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c index 083b79fa0c62..779428676f63 100644 --- a/drivers/base/power/opp/of.c +++ b/drivers/base/power/opp/of.c | |||
@@ -243,7 +243,7 @@ void dev_pm_opp_of_remove_table(struct device *dev) | |||
243 | EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); | 243 | EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); |
244 | 244 | ||
245 | /* Returns opp descriptor node for a device, caller must do of_node_put() */ | 245 | /* Returns opp descriptor node for a device, caller must do of_node_put() */ |
246 | static struct device_node *_of_get_opp_desc_node(struct device *dev) | 246 | struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) |
247 | { | 247 | { |
248 | /* | 248 | /* |
249 | * There should be only ONE phandle present in "operating-points-v2" | 249 | * There should be only ONE phandle present in "operating-points-v2" |
@@ -252,6 +252,7 @@ static struct device_node *_of_get_opp_desc_node(struct device *dev) | |||
252 | 252 | ||
253 | return of_parse_phandle(dev->of_node, "operating-points-v2", 0); | 253 | return of_parse_phandle(dev->of_node, "operating-points-v2", 0); |
254 | } | 254 | } |
255 | EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node); | ||
255 | 256 | ||
256 | /** | 257 | /** |
257 | * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) | 258 | * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) |
@@ -478,7 +479,7 @@ int dev_pm_opp_of_add_table(struct device *dev) | |||
478 | * OPPs have two version of bindings now. The older one is deprecated, | 479 | * OPPs have two version of bindings now. The older one is deprecated, |
479 | * try for the new binding first. | 480 | * try for the new binding first. |
480 | */ | 481 | */ |
481 | opp_np = _of_get_opp_desc_node(dev); | 482 | opp_np = dev_pm_opp_of_get_opp_desc_node(dev); |
482 | if (!opp_np) { | 483 | if (!opp_np) { |
483 | /* | 484 | /* |
484 | * Try old-deprecated bindings for backward compatibility with | 485 | * Try old-deprecated bindings for backward compatibility with |
@@ -570,7 +571,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, | |||
570 | int cpu, ret = 0; | 571 | int cpu, ret = 0; |
571 | 572 | ||
572 | /* Get OPP descriptor node */ | 573 | /* Get OPP descriptor node */ |
573 | np = _of_get_opp_desc_node(cpu_dev); | 574 | np = dev_pm_opp_of_get_opp_desc_node(cpu_dev); |
574 | if (!np) { | 575 | if (!np) { |
575 | dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__); | 576 | dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__); |
576 | return -ENOENT; | 577 | return -ENOENT; |
@@ -595,7 +596,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, | |||
595 | } | 596 | } |
596 | 597 | ||
597 | /* Get OPP descriptor node */ | 598 | /* Get OPP descriptor node */ |
598 | tmp_np = _of_get_opp_desc_node(tcpu_dev); | 599 | tmp_np = dev_pm_opp_of_get_opp_desc_node(tcpu_dev); |
599 | if (!tmp_np) { | 600 | if (!tmp_np) { |
600 | dev_err(tcpu_dev, "%s: Couldn't find opp node.\n", | 601 | dev_err(tcpu_dev, "%s: Couldn't find opp node.\n", |
601 | __func__); | 602 | __func__); |
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 731d548657aa..a6685b3dde26 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h | |||
@@ -288,6 +288,7 @@ void dev_pm_opp_of_remove_table(struct device *dev); | |||
288 | int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); | 288 | int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); |
289 | void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); | 289 | void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); |
290 | int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); | 290 | int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); |
291 | struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); | ||
291 | #else | 292 | #else |
292 | static inline int dev_pm_opp_of_add_table(struct device *dev) | 293 | static inline int dev_pm_opp_of_add_table(struct device *dev) |
293 | { | 294 | { |
@@ -311,6 +312,11 @@ static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct | |||
311 | { | 312 | { |
312 | return -ENOTSUPP; | 313 | return -ENOTSUPP; |
313 | } | 314 | } |
315 | |||
316 | static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) | ||
317 | { | ||
318 | return NULL; | ||
319 | } | ||
314 | #endif | 320 | #endif |
315 | 321 | ||
316 | #endif /* __LINUX_OPP_H__ */ | 322 | #endif /* __LINUX_OPP_H__ */ |