Skip to content

Commit ad2a910

Browse files
pierregondoisvireshk
authored andcommitted
cpufreq: scmi: Set transition_delay_us
Make use of the newly added callbacks: - rate_limit_get() - fast_switch_rate_limit() to populate policies's `transition_delay_us`, defined as the 'Preferred average time interval between consecutive invocations of the driver to set the frequency for this policy.' Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 2441caa commit ad2a910

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/cpufreq/scmi-cpufreq.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,29 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power,
144144
return 0;
145145
}
146146

147+
static int
148+
scmi_get_rate_limit(u32 domain, bool has_fast_switch)
149+
{
150+
int ret, rate_limit;
151+
152+
if (has_fast_switch) {
153+
/*
154+
* Fast channels are used whenever available,
155+
* so use their rate_limit value if populated.
156+
*/
157+
ret = perf_ops->fast_switch_rate_limit(ph, domain,
158+
&rate_limit);
159+
if (!ret && rate_limit)
160+
return rate_limit;
161+
}
162+
163+
ret = perf_ops->rate_limit_get(ph, domain, &rate_limit);
164+
if (ret)
165+
return 0;
166+
167+
return rate_limit;
168+
}
169+
147170
static int scmi_cpufreq_init(struct cpufreq_policy *policy)
148171
{
149172
int ret, nr_opp, domain;
@@ -250,6 +273,9 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
250273
policy->fast_switch_possible =
251274
perf_ops->fast_switch_possible(ph, domain);
252275

276+
policy->transition_delay_us =
277+
scmi_get_rate_limit(domain, policy->fast_switch_possible);
278+
253279
return 0;
254280

255281
out_free_opp:

0 commit comments

Comments
 (0)