@@ -235,6 +235,26 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
return ret;
}
+/**
+ * dev_pm_opp_get_np() - Get the device tree node corresponding to an opp
+ * @opp: opp for which the node should be returned for
+ *
+ * If applicable return the device tree node for the corresponding opp so that
+ * the client can decode "custom" target specific properties.
+ *
+ * Return: A pointer to the device tree or NULL if it doesn't exist
+ */
+struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp)
+{
+ if (IS_ERR_OR_NULL(opp)) {
+ pr_err("%s: Invalid parameters\n", __func__);
+ return NULL;
+ }
+
+ return opp->np;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_get_np);
+
/**
* dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
* entries
@@ -308,6 +308,7 @@ 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);
+struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp);
#else
static inline int dev_pm_opp_of_add_table(struct device *dev)
{
@@ -336,6 +337,11 @@ static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device
{
return NULL;
}
+
+static inline struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp)
+{
+ return NULL;
+}
#endif
#endif /* __LINUX_OPP_H__ */
Add a function to return the device node associated with a specific opp which will facilitate detailing with custom properties in client drivers. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> --- drivers/opp/of.c | 20 ++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 26 insertions(+)