summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2019-07-08 01:54:56 -0400
committerViresh Kumar <viresh.kumar@linaro.org>2019-07-26 03:53:31 -0400
commit17a8f868ae3e85a173843b1ac65e744e8585bc5a (patch)
tree366428704840f67d53e5109a755c05fe628f5baa
parentbaea35e4db17a72145c84a401f70d496c8ebf833 (diff)
opp: Return genpd virtual devices from dev_pm_opp_attach_genpd()
The cpufreq drivers don't need to do runtime PM operations on the virtual devices returned by dev_pm_domain_attach_by_name() and so the virtual devices weren't shared with the callers of dev_pm_opp_attach_genpd() earlier. But the IO device drivers would want to do that. This patch updates the prototype of dev_pm_opp_attach_genpd() to accept another argument to return the pointer to the array of genpd virtual devices. Reported-by: Rajendra Nayak <rnayak@codeaurora.org> Tested-by: Rajendra Nayak <rnayak@codeaurora.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r--drivers/opp/core.c6
-rw-r--r--include/linux/pm_opp.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 08b830f84d8c..bdb435822401 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1771,6 +1771,7 @@ static void _opp_detach_genpd(struct opp_table *opp_table)
1771 * dev_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtual device pointer 1771 * dev_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtual device pointer
1772 * @dev: Consumer device for which the genpd is getting attached. 1772 * @dev: Consumer device for which the genpd is getting attached.
1773 * @names: Null terminated array of pointers containing names of genpd to attach. 1773 * @names: Null terminated array of pointers containing names of genpd to attach.
1774 * @virt_devs: Pointer to return the array of virtual devices.
1774 * 1775 *
1775 * Multiple generic power domains for a device are supported with the help of 1776 * Multiple generic power domains for a device are supported with the help of
1776 * virtual genpd devices, which are created for each consumer device - genpd 1777 * virtual genpd devices, which are created for each consumer device - genpd
@@ -1788,7 +1789,8 @@ static void _opp_detach_genpd(struct opp_table *opp_table)
1788 * The order of entries in the names array must match the order in which 1789 * The order of entries in the names array must match the order in which
1789 * "required-opps" are added in DT. 1790 * "required-opps" are added in DT.
1790 */ 1791 */
1791struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names) 1792struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,
1793 const char **names, struct device ***virt_devs)
1792{ 1794{
1793 struct opp_table *opp_table; 1795 struct opp_table *opp_table;
1794 struct device *virt_dev; 1796 struct device *virt_dev;
@@ -1842,6 +1844,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names
1842 name++; 1844 name++;
1843 } 1845 }
1844 1846
1847 if (virt_devs)
1848 *virt_devs = opp_table->genpd_virt_devs;
1845 mutex_unlock(&opp_table->genpd_virt_dev_lock); 1849 mutex_unlock(&opp_table->genpd_virt_dev_lock);
1846 1850
1847 return opp_table; 1851 return opp_table;
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index af5021f27cb7..5bdceca5125d 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -128,7 +128,7 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name);
128void dev_pm_opp_put_clkname(struct opp_table *opp_table); 128void dev_pm_opp_put_clkname(struct opp_table *opp_table);
129struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); 129struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data));
130void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); 130void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table);
131struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names); 131struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs);
132void dev_pm_opp_detach_genpd(struct opp_table *opp_table); 132void dev_pm_opp_detach_genpd(struct opp_table *opp_table);
133int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); 133int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate);
134int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); 134int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq);
@@ -292,7 +292,7 @@ static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const
292 292
293static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} 293static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {}
294 294
295static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names) 295static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs)
296{ 296{
297 return ERR_PTR(-ENOTSUPP); 297 return ERR_PTR(-ENOTSUPP);
298} 298}