[V2,3/3] opp: Add dev_pm_opp_of_add_table_noclk()

Message ID a251d7a7245a2ded97b282b8dfda95359698bf22.1611817096.git.viresh.kumar@linaro.org
State Accepted
Commit 559fef0dfd91145b59b7c61061504f344ecf9ad8
Headers show
Series
  • [V2,1/3] opp: Create _of_add_table_indexed() to reduce code duplication
Related show

Commit Message

Viresh Kumar Jan. 28, 2021, 7 a.m.
A few drivers have device's clk but they don't want the OPP core to
handle that. Add a new helper for them, dev_pm_opp_of_add_table_noclk().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
V2:
- Split this into a separate patch.

 drivers/opp/of.c       | 18 ++++++++++++++++++
 include/linux/pm_opp.h |  6 ++++++
 2 files changed, 24 insertions(+)

-- 
2.25.0.rc1.19.g042ed3e048af

Comments

Dmitry Osipenko Feb. 1, 2021, 8 p.m. | #1
28.01.2021 10:00, Viresh Kumar пишет:
> A few drivers have device's clk but they don't want the OPP core to

> handle that. Add a new helper for them, dev_pm_opp_of_add_table_noclk().

> 

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> ---

> V2:

> - Split this into a separate patch.

> 

>  drivers/opp/of.c       | 18 ++++++++++++++++++

>  include/linux/pm_opp.h |  6 ++++++

>  2 files changed, 24 insertions(+)


For the all current/latest OPP patches:

Tested-by: Dmitry Osipenko <digetx@gmail.com>
Viresh Kumar Feb. 2, 2021, 5:02 a.m. | #2
On 01-02-21, 23:00, Dmitry Osipenko wrote:
> 28.01.2021 10:00, Viresh Kumar пишет:

> > A few drivers have device's clk but they don't want the OPP core to

> > handle that. Add a new helper for them, dev_pm_opp_of_add_table_noclk().

> > 

> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> > ---

> > V2:

> > - Split this into a separate patch.

> > 

> >  drivers/opp/of.c       | 18 ++++++++++++++++++

> >  include/linux/pm_opp.h |  6 ++++++

> >  2 files changed, 24 insertions(+)

> 

> For the all current/latest OPP patches:

> 

> Tested-by: Dmitry Osipenko <digetx@gmail.com>


Hmm, I have now added your Tested-by to all the patches that we worked
together on.. 

Thanks.

-- 
viresh
Dmitry Osipenko Feb. 2, 2021, 6:04 p.m. | #3
02.02.2021 08:02, Viresh Kumar пишет:
> On 01-02-21, 23:00, Dmitry Osipenko wrote:

>> 28.01.2021 10:00, Viresh Kumar пишет:

>>> A few drivers have device's clk but they don't want the OPP core to

>>> handle that. Add a new helper for them, dev_pm_opp_of_add_table_noclk().

>>>

>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

>>> ---

>>> V2:

>>> - Split this into a separate patch.

>>>

>>>  drivers/opp/of.c       | 18 ++++++++++++++++++

>>>  include/linux/pm_opp.h |  6 ++++++

>>>  2 files changed, 24 insertions(+)

>>

>> For the all current/latest OPP patches:

>>

>> Tested-by: Dmitry Osipenko <digetx@gmail.com>

> 

> Hmm, I have now added your Tested-by to all the patches that we worked

> together on.. 

> 

> Thanks.

> 


That's exactly what I meant, thank you.

Patch

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index d4b51b2e384f..a905497c75f8 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -1030,6 +1030,24 @@  int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed);
 
+/**
+ * dev_pm_opp_of_add_table_noclk() - Initialize indexed opp table from device
+ *		tree without getting clk for device.
+ * @dev:	device pointer used to lookup OPP table.
+ * @index:	Index number.
+ *
+ * Register the initial OPP table with the OPP library for given device only
+ * using the "operating-points-v2" property. Do not try to get the clk for the
+ * device.
+ *
+ * Return: Refer to dev_pm_opp_of_add_table() for return values.
+ */
+int dev_pm_opp_of_add_table_noclk(struct device *dev, int index)
+{
+	return _of_add_table_indexed(dev, index, false);
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_noclk);
+
 /* CPU device specific helpers */
 
 /**
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 979b208bc4a8..158158620dde 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -395,6 +395,7 @@  static inline int dev_pm_opp_sync_regulators(struct device *dev)
 #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
 int dev_pm_opp_of_add_table(struct device *dev);
 int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
+int dev_pm_opp_of_add_table_noclk(struct device *dev, int index);
 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);
@@ -419,6 +420,11 @@  static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
 	return -ENOTSUPP;
 }
 
+static inline int dev_pm_opp_of_add_table_noclk(struct device *dev, int index)
+{
+	return -ENOTSUPP;
+}
+
 static inline void dev_pm_opp_of_remove_table(struct device *dev)
 {
 }