cpufreq: tegra194: use refclk delta based loop instead of udelay
authorSumit Gupta <sumitg@nvidia.com>
Wed, 4 Oct 2023 14:05:37 +0000 (19:35 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 10 Oct 2023 05:33:03 +0000 (11:03 +0530)
commita60a556788752a5696960ed11409a552b79e68e8
tree8387a88193df05662637d9c1030d0d7d18578eb8
parent6b121b4cf7e1f598beecf592d6184126b46eca46
cpufreq: tegra194: use refclk delta based loop instead of udelay

Use reference clock count based loop instead of "udelay()" for
sampling of counters to improve the accuracy of re-generated CPU
frequency. "udelay()" internally calls "WFE" which stops the
counters and results in bigger delta between the last set freq
and the re-generated value from counters. The counter sampling
window used in loop is the minimum number of reference clock
cycles which is known to give a stable value of CPU frequency.
The change also helps to reduce the sampling window from "500us"
to "<50us".

Suggested-by: Antti Miettinen <amiettinen@nvidia.com>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/tegra194-cpufreq.c