Skip to content

Commit

Permalink
PM / OPP: Expose _of_get_opp_desc_node as dev_pm_opp API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Gerlach authored and Rafael J. Wysocki committed Feb 9, 2017
1 parent 6ac4239 commit 0764c60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/base/power/opp/of.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void dev_pm_opp_of_remove_table(struct device *dev)
EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);

/* Returns opp descriptor node for a device, caller must do of_node_put() */
static struct device_node *_of_get_opp_desc_node(struct device *dev)
struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
{
/*
* There should be only ONE phandle present in "operating-points-v2"
Expand All @@ -252,6 +252,7 @@ static struct device_node *_of_get_opp_desc_node(struct device *dev)

return of_parse_phandle(dev->of_node, "operating-points-v2", 0);
}
EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);

/**
* _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
Expand Down Expand Up @@ -478,7 +479,7 @@ int dev_pm_opp_of_add_table(struct device *dev)
* OPPs have two version of bindings now. The older one is deprecated,
* try for the new binding first.
*/
opp_np = _of_get_opp_desc_node(dev);
opp_np = dev_pm_opp_of_get_opp_desc_node(dev);
if (!opp_np) {
/*
* Try old-deprecated bindings for backward compatibility with
Expand Down Expand Up @@ -570,7 +571,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev,
int cpu, ret = 0;

/* Get OPP descriptor node */
np = _of_get_opp_desc_node(cpu_dev);
np = dev_pm_opp_of_get_opp_desc_node(cpu_dev);
if (!np) {
dev_dbg(cpu_dev, "%s: Couldn't find opp node.\n", __func__);
return -ENOENT;
Expand All @@ -595,7 +596,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev,
}

/* Get OPP descriptor node */
tmp_np = _of_get_opp_desc_node(tcpu_dev);
tmp_np = dev_pm_opp_of_get_opp_desc_node(tcpu_dev);
if (!tmp_np) {
dev_err(tcpu_dev, "%s: Couldn't find opp node.\n",
__func__);
Expand Down
6 changes: 6 additions & 0 deletions include/linux/pm_opp.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ void dev_pm_opp_of_remove_table(struct device *dev);
int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev);
#else
static inline int dev_pm_opp_of_add_table(struct device *dev)
{
Expand All @@ -311,6 +312,11 @@ static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct
{
return -ENOTSUPP;
}

static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
{
return NULL;
}
#endif

#endif /* __LINUX_OPP_H__ */

0 comments on commit 0764c60

Please sign in to comment.