Skip to content

Commit 2f5f3fb

Browse files
vireshkAlex Shi
authored andcommitted
PM / OPP: Introduce dev_pm_opp_get_max_transition_latency()
In few use cases (like: cpufreq), it is desired to get the maximum latency for changing OPPs. Add support for that. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 2174344765f472895c076d703c9cdc58215e1393) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 525680c commit 2f5f3fb

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/base/power/opp/core.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,23 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
289289
}
290290
EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_volt_latency);
291291

292+
/**
293+
* dev_pm_opp_get_max_transition_latency() - Get max transition latency in
294+
* nanoseconds
295+
* @dev: device for which we do this operation
296+
*
297+
* Return: This function returns the max transition latency, in nanoseconds, to
298+
* switch from one OPP to other.
299+
*
300+
* Locking: This function takes rcu_read_lock().
301+
*/
302+
unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev)
303+
{
304+
return dev_pm_opp_get_max_volt_latency(dev) +
305+
dev_pm_opp_get_max_clock_latency(dev);
306+
}
307+
EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_transition_latency);
308+
292309
/**
293310
* dev_pm_opp_get_suspend_opp() - Get suspend opp
294311
* @dev: device for which we do this operation

include/linux/pm_opp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
3535
int dev_pm_opp_get_opp_count(struct device *dev);
3636
unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
3737
unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev);
38+
unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev);
3839
struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev);
3940

4041
struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
@@ -94,6 +95,11 @@ static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
9495
return 0;
9596
}
9697

98+
static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev)
99+
{
100+
return 0;
101+
}
102+
97103
static inline struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
98104
{
99105
return NULL;

0 commit comments

Comments
 (0)