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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:42 +0000 (10:22 +0200)
commit4668e18bc2993959a8f409ced4adf2fd295e0e81
tree72fff52f906c6f2a8064cd4b3ab3704672a6dcd9
parenta3265a9440030068547a20dfee646666f3ca5278
cpufreq: Avoid unnecessary frequency updates due to mismatch

[ Upstream commit f55ae08c89873e140c7cac2a7fa161d31a0d60cf ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/cpufreq.c