diff mbox series

[v4,07/12] OPP: Add and export helper to get icc path count

Message ID 20200504202243.5476-8-sibis@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series DDR/L3 Scaling support on SDM845 and SC7180 SoCs | expand

Commit Message

Sibi Sankar May 4, 2020, 8:22 p.m. UTC
Add and export 'dev_pm_opp_get_path_count' to get the icc path count
associated with the device.

Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
---
 drivers/opp/core.c     | 20 ++++++++++++++++++++
 include/linux/pm_opp.h |  6 ++++++
 2 files changed, 26 insertions(+)

Comments

Saravana Kannan May 4, 2020, 10:03 p.m. UTC | #1
On Mon, May 4, 2020 at 1:24 PM Sibi Sankar <sibis@codeaurora.org> wrote:
>
> Add and export 'dev_pm_opp_get_path_count' to get the icc path count
> associated with the device.

This is not related to OPP. You should add this helper function to ICC
framework?

-Saravana
Sibi Sankar May 5, 2020, 7:36 a.m. UTC | #2
On 2020-05-05 03:33, Saravana Kannan wrote:
> On Mon, May 4, 2020 at 1:24 PM Sibi Sankar <sibis@codeaurora.org> 
> wrote:
>> 
>> Add and export 'dev_pm_opp_get_path_count' to get the icc path count
>> associated with the device.
> 
> This is not related to OPP. You should add this helper function to ICC
> framework?

yes it should be, I'll work with
Georgi so that it gets re-used in
his series as well.


> 
> -Saravana
diff mbox series

Patch

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index f157e2d768d76..6106146a582d5 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -343,6 +343,26 @@  int dev_pm_opp_get_opp_count(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count);
 
+int dev_pm_opp_get_path_count(struct device *dev)
+{
+	struct opp_table *opp_table;
+	int count;
+
+	opp_table = _find_opp_table(dev);
+	if (IS_ERR(opp_table)) {
+		count = PTR_ERR(opp_table);
+		dev_dbg(dev, "%s: OPP table not found (%d)\n",
+			__func__, count);
+		return count;
+	}
+
+	count = opp_table->path_count;
+	dev_pm_opp_put_opp_table(opp_table);
+
+	return count;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_get_path_count);
+
 /**
  * dev_pm_opp_find_freq_exact() - search for an exact frequency
  * @dev:		device for which we do this operation
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 87ba295080a2b..ffd075c8da0ca 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -101,6 +101,7 @@  unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp);
 bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
 
 int dev_pm_opp_get_opp_count(struct device *dev);
+int dev_pm_opp_get_path_count(struct device *dev);
 unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
 unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev);
 unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev);
@@ -197,6 +198,11 @@  static inline int dev_pm_opp_get_opp_count(struct device *dev)
 	return 0;
 }
 
+static inline int dev_pm_opp_get_path_count(struct device *dev)
+{
+	return 0;
+}
+
 static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
 {
 	return 0;