Skip to content

Commit

Permalink
cpufreq: Ensure the min_freq is lower than max_freq
Browse files Browse the repository at this point in the history
* Libperfmgr increases the minimal frequency to 9999999 in order to boost
  the cpu to the maximal frequency. This usally works because it also
  increases the max frequency to 9999999 at init. However if we decrease
  the maximal frequency afterwards, which mi_thermald does, setting the
  minimal frequency to 9999999 fails because it exceeds the maximal
  frequency.

* We can allow setting a minimal frequency higher than the maximal
  frequency and setting a lower maximal frequency than the minimal
  frequency by adjusting the minimal frequency if it exceeds the
  maximal frequency.

Change-Id: I25b7ccde714aac14c8fdb9910857c3bd38c0aa05
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
  • Loading branch information
ArianK16a authored and onettboots committed Nov 10, 2022
1 parent 5bf872a commit 576ce81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
* because new_policy is a copy of policy with one field updated.
*/
if (new_policy->min > new_policy->max)
return -EINVAL;
new_policy->min = new_policy->max;

/* verify the cpu speed can be set within this limit */
ret = cpufreq_driver->verify(new_policy);
Expand Down

0 comments on commit 576ce81

Please sign in to comment.