]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: tegra186: Fix get frequency callback
authorJon Hunter <jonathanh@nvidia.com>
Tue, 3 Nov 2020 11:55:14 +0000 (11:55 +0000)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 17 Nov 2020 04:34:21 +0000 (10:04 +0530)
commit7d83f3ce22af6454cdd62589a7c037e50410ffe9
tree64799c3a9d5c5610b4d5d037057d68ba4122cb74
parenta1fe7c755400af92f0070a66f48f00b659aeacac
cpufreq: tegra186: Fix get frequency callback

Commit fe288c413fec ("cpufreq: tegra186: Fix initial frequency")
implemented the CPUFREQ 'get' callback to determine the current
operating frequency for each CPU. This implementation used a simple
looked up to determine the current operating frequency. The problem
with this is that frequency table for different Tegra186 devices may
vary and so the default boot frequency for Tegra186 device may or may
not be present in the frequency table. If the default boot frequency is
not present in the frequency table, this causes the function
tegra186_cpufreq_get() to return 0 and in turn causes cpufreq_online()
to fail which prevents CPUFREQ from working.

Fix this by always calculating the CPU frequency based upon the current
'ndiv' setting for the CPU. Note that the CPU frequency for Tegra186 is
calculated by reading the current 'ndiv' setting, multiplying by the
CPU reference clock and dividing by a constant divisor.

Fixes: fe288c413fec ("cpufreq: tegra186: Fix initial frequency")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/tegra186-cpufreq.c