aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/opp/cpu.c59
1 files changed, 58 insertions, 1 deletions
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index b7411a3cdcb1..b151401d1513 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -119,7 +119,22 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev,
119EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); 119EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table);
120#endif /* CONFIG_CPU_FREQ */ 120#endif /* CONFIG_CPU_FREQ */
121 121
122/* Required only for V1 bindings, as v2 can manage it from DT itself */ 122/**
123 * dev_pm_opp_set_sharing_cpus() - Mark OPP table as shared by few CPUs
124 * @cpu_dev: CPU device for which we do this operation
125 * @cpumask: cpumask of the CPUs which share the OPP table with @cpu_dev
126 *
127 * This marks OPP table of the @cpu_dev as shared by the CPUs present in
128 * @cpumask.
129 *
130 * Returns -ENODEV if OPP table isn't already present.
131 *
132 * Locking: The internal opp_table and opp structures are RCU protected.
133 * Hence this function internally uses RCU updater strategy with mutex locks
134 * to keep the integrity of the internal data structures. Callers should ensure
135 * that this function is *NOT* called under RCU protection or in contexts where
136 * mutex cannot be locked.
137 */
123int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 138int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask)
124{ 139{
125 struct opp_device *opp_dev; 140 struct opp_device *opp_dev;
@@ -161,6 +176,18 @@ unlock:
161EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus); 176EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);
162 177
163#ifdef CONFIG_OF 178#ifdef CONFIG_OF
179/**
180 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
181 * @cpumask: cpumask for which OPP table needs to be removed
182 *
183 * This removes the OPP tables for CPUs present in the @cpumask.
184 *
185 * Locking: The internal opp_table and opp structures are RCU protected.
186 * Hence this function internally uses RCU updater strategy with mutex locks
187 * to keep the integrity of the internal data structures. Callers should ensure
188 * that this function is *NOT* called under RCU protection or in contexts where
189 * mutex cannot be locked.
190 */
164void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask) 191void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
165{ 192{
166 struct device *cpu_dev; 193 struct device *cpu_dev;
@@ -181,6 +208,18 @@ void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
181} 208}
182EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); 209EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
183 210
211/**
212 * dev_pm_opp_of_cpumask_add_table() - Adds OPP table for @cpumask
213 * @cpumask: cpumask for which OPP table needs to be added.
214 *
215 * This adds the OPP tables for CPUs present in the @cpumask.
216 *
217 * Locking: The internal opp_table and opp structures are RCU protected.
218 * Hence this function internally uses RCU updater strategy with mutex locks
219 * to keep the integrity of the internal data structures. Callers should ensure
220 * that this function is *NOT* called under RCU protection or in contexts where
221 * mutex cannot be locked.
222 */
184int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpumask) 223int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpumask)
185{ 224{
186 struct device *cpu_dev; 225 struct device *cpu_dev;
@@ -216,6 +255,24 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table);
216 * 255 *
217 * Returns -ENOENT if operating-points-v2 bindings aren't supported. 256 * Returns -ENOENT if operating-points-v2 bindings aren't supported.
218 */ 257 */
258/**
259 * dev_pm_opp_of_get_sharing_cpus() - Get cpumask of CPUs sharing OPPs with
260 * @cpu_dev using operating-points-v2
261 * bindings.
262 *
263 * @cpu_dev: CPU device for which we do this operation
264 * @cpumask: cpumask to update with information of sharing CPUs
265 *
266 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev.
267 *
268 * Returns -ENOENT if operating-points-v2 isn't present for @cpu_dev.
269 *
270 * Locking: The internal opp_table and opp structures are RCU protected.
271 * Hence this function internally uses RCU updater strategy with mutex locks
272 * to keep the integrity of the internal data structures. Callers should ensure
273 * that this function is *NOT* called under RCU protection or in contexts where
274 * mutex cannot be locked.
275 */
219int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 276int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask)
220{ 277{
221 struct device_node *np, *tmp_np; 278 struct device_node *np, *tmp_np;