Re: [PATCH V4 2/3] cpufreq: add support for intermediate (stable) frequencies

Doug Anderson
2014-05-28T19:40:50Z

Viresh,

On Wed, May 21, 2014 at 1:59 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> @@ -1841,9 +1876,23 @@ static int __target_index(struct cpufreq_policy *policy,
> pr_err("%s: Failed to change cpu frequency: %d\n", __func__,
> retval);
>
> - if (notify)
> + if (notify) {
> cpufreq_freq_transition_end(policy, &freqs, retval);
>
> + /*
> + * Failed after setting to intermediate freq? Driver should have
> + * reverted back to initial frequency and so should we. Check
> + * here for intermediate_freq instead of get_intermediate, in
> + * case we have't switched to intermediate freq at all.
> + */
> + if (unlikely(retval && intermediate_freq)) {
> + freqs.old = intermediate_freq;
> + freqs.new = policy->restore_freq;
> + cpufreq_freq_transition_begin(policy, &freqs);
> + cpufreq_freq_transition_end(policy, &freqs, retval);

As far as I can tell this notification says "I tried to switch from
"intermediate_freq" to "policy->restore_freq" but I failed, so I'm
still at "intermediate_freq". I think you probably want to pass 0 as
the last argument to cpufreq_freq_transition_end() to fix...

Other than that this looks good to me. I'll do a final review when
you spin the next version (since I think you need to fix stuff for
Stephen too). I'll probably wait and re-review the Tegra version when
you and Stephen come to a consensus on it.

-Doug