[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240902224815.78220-2-ulf.hansson@linaro.org>
Date: Tue, 3 Sep 2024 00:48:14 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Viresh Kumar <vireshk@...nel.org>,
Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>,
Dikshita Agarwal <quic_dikshita@...cinc.com>
Cc: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <quic_kdybcio@...cinc.com>,
Nikunj Kela <nkela@...cinc.com>,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Thierry Reding <thierry.reding@...il.com>,
Mikko Perttunen <mperttunen@...dia.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Stephan Gerhold <stephan@...hold.net>,
Ilia Lin <ilia.lin@...nel.org>,
Stanimir Varbanov <stanimir.k.varbanov@...il.com>,
Vikash Garodia <quic_vgarodia@...cinc.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] OPP: Add helper to retrieve the OF node for an OPP table
As being shown from a subsequent change it can be useful for a OPP consumer
to retrieve the corresponding OF node for an OPP table. Therefore, let's
add an OPP helper for it.
Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
---
drivers/opp/of.c | 12 ++++++++++++
include/linux/pm_opp.h | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index fd5ed2858258..f0950339da55 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -1461,6 +1461,18 @@ struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp)
}
EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node);
+/**
+ * dev_pm_opp_table_to_of_node() - Finds the node for an OPP table
+ * @opp_table: The opp_table to return the node for
+ *
+ * Return: The DT node corresponding to the @opp_table.
+ */
+struct device_node *dev_pm_opp_table_to_of_node(struct opp_table *opp_table)
+{
+ return opp_table->np;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_table_to_of_node);
+
/*
* Callback function provided to the Energy Model framework upon registration.
* It provides the power used by @dev at @kHz if it is the frequency of an
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 451a7465a605..7894e631cded 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -469,6 +469,7 @@ 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_of_node(struct dev_pm_opp *opp);
+struct device_node *dev_pm_opp_table_to_of_node(struct opp_table *table);
int of_get_required_opp_performance_state(struct device_node *np, int index);
bool dev_pm_opp_of_has_required_opp(struct device *dev);
int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table);
@@ -528,6 +529,11 @@ static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp)
return NULL;
}
+static inline struct device_node *dev_pm_opp_table_to_of_node(struct opp_table *table)
+{
+ return NULL;
+}
+
static inline int dev_pm_opp_of_register_em(struct device *dev,
struct cpumask *cpus)
{
--
2.34.1
Powered by blists - more mailing lists