File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -831,6 +831,37 @@ static int _set_required_opps(struct device *dev,
831
831
return ret ;
832
832
}
833
833
834
+ /**
835
+ * dev_pm_opp_set_bw() - sets bandwidth levels corresponding to an opp
836
+ * @dev: device for which we do this operation
837
+ * @opp: opp based on which the bandwidth levels are to be configured
838
+ *
839
+ * This configures the bandwidth to the levels specified by the OPP. However
840
+ * if the OPP specified is NULL the bandwidth levels are cleared out.
841
+ *
842
+ * Return: 0 on success or a negative error value.
843
+ */
844
+ int dev_pm_opp_set_bw (struct device * dev , struct dev_pm_opp * opp )
845
+ {
846
+ struct opp_table * opp_table ;
847
+ int ret ;
848
+
849
+ opp_table = _find_opp_table (dev );
850
+ if (IS_ERR (opp_table )) {
851
+ dev_err (dev , "%s: device opp table doesn't exist\n" , __func__ );
852
+ return PTR_ERR (opp_table );
853
+ }
854
+
855
+ if (opp )
856
+ ret = _set_opp_bw (opp_table , opp , dev , false);
857
+ else
858
+ ret = _set_opp_bw (opp_table , NULL , dev , true);
859
+
860
+ dev_pm_opp_put_opp_table (opp_table );
861
+ return ret ;
862
+ }
863
+ EXPORT_SYMBOL_GPL (dev_pm_opp_set_bw );
864
+
834
865
/**
835
866
* dev_pm_opp_set_rate() - Configure new OPP based on frequency
836
867
* @dev: device for which we do this operation
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names
151
151
void dev_pm_opp_detach_genpd (struct opp_table * opp_table );
152
152
int dev_pm_opp_xlate_performance_state (struct opp_table * src_table , struct opp_table * dst_table , unsigned int pstate );
153
153
int dev_pm_opp_set_rate (struct device * dev , unsigned long target_freq );
154
+ int dev_pm_opp_set_bw (struct device * dev , struct dev_pm_opp * opp );
154
155
int dev_pm_opp_set_sharing_cpus (struct device * cpu_dev , const struct cpumask * cpumask );
155
156
int dev_pm_opp_get_sharing_cpus (struct device * cpu_dev , struct cpumask * cpumask );
156
157
void dev_pm_opp_remove_table (struct device * dev );
@@ -342,6 +343,11 @@ static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_f
342
343
return - ENOTSUPP ;
343
344
}
344
345
346
+ static inline int dev_pm_opp_set_bw (struct device * dev , struct dev_pm_opp * opp )
347
+ {
348
+ return - EOPNOTSUPP ;
349
+ }
350
+
345
351
static inline int dev_pm_opp_set_sharing_cpus (struct device * cpu_dev , const struct cpumask * cpumask )
346
352
{
347
353
return - ENOTSUPP ;
You can’t perform that action at this time.
0 commit comments