cpufreq: Avoid unnecessary frequency updates due to mismatch
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 4 May 2022 08:21:35 +0000 (13:51 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 6 May 2022 18:56:21 +0000 (20:56 +0200)
commitf55ae08c89873e140c7cac2a7fa161d31a0d60cf
treea605e4d6436833eb0dc7c621e6eb0e47f171019a
parent02678c08822f45246e5efa371c91c9e154e34e11
cpufreq: Avoid unnecessary frequency updates due to mismatch

For some platforms, the frequency returned by hardware may be slightly
different from what is provided in the frequency table. For example,
hardware may return 499 MHz instead of 500 MHz. In such cases it is
better to avoid getting into unnecessary frequency updates, as we may
end up switching policy->cur between the two and sending unnecessary
pre/post update notifications, etc.

This patch has chosen allows the hardware frequency and table frequency
to deviate by 1 MHz for now, we may want to increase it a bit later on
if someone still complains.

Reported-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Jia-wei Chang <jia-wei.chang@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c