Linux Power Management development
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Dikshita Agarwal <quic_dikshita@quicinc.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <quic_kdybcio@quicinc.com>,
	Nikunj Kela <nkela@quicinc.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Mikko Perttunen <mperttunen@nvidia.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	Ilia Lin <ilia.lin@kernel.org>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] OPP: Add helper to retrieve the OF node for an OPP table
Date: Tue,  3 Sep 2024 00:48:14 +0200	[thread overview]
Message-ID: <20240902224815.78220-2-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20240902224815.78220-1-ulf.hansson@linaro.org>

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@linaro.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


  reply	other threads:[~2024-09-02 22:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 22:48 [PATCH 0/2] OPP/pmdomain: Assign the correct required-dev Ulf Hansson
2024-09-02 22:48 ` Ulf Hansson [this message]
2024-09-02 22:48 ` [PATCH 2/2] OPP/pmdomain: Fix the assignment of the required-devs Ulf Hansson
2024-09-03  7:16   ` Viresh Kumar
2024-09-03  9:54     ` Ulf Hansson
2024-09-03 10:53       ` Viresh Kumar
2024-09-03 11:43         ` Ulf Hansson
2024-09-04  6:40           ` Viresh Kumar
2024-09-04 12:57             ` Ulf Hansson
2024-09-06  6:14               ` Viresh Kumar
2024-09-06  8:49                 ` Ulf Hansson
2024-09-11  6:02                   ` Viresh Kumar
2024-09-11 14:15                     ` Ulf Hansson
2024-09-12 10:13                       ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240902224815.78220-2-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=ilia.lin@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=nkela@quicinc.com \
    --cc=nm@ti.com \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_kdybcio@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=sboyd@kernel.org \
    --cc=stanimir.k.varbanov@gmail.com \
    --cc=stephan@gerhold.net \
    --cc=thierry.reding@gmail.com \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox