On 28-10-20, 12:31, Jon Hunter wrote: > On 28/10/2020 04:11, Viresh Kumar wrote: > > When do we fail if the frequency isn't known ? That's the case where > > we try to set it to one from the table. > > Currently, if the frequency is not known, we fail right before we do the > initial frequency check [0]. Right, so the frequency returned there is 0. By unknown I assumed that you are talking about the case where the frequency isn't found in the table. > > But (looking at your change), ->get() can't really return 0. We depend > > on it to get us the exact frequency the hardware is programmed at > > instead of reading a cached value in the software. > > Actually it can and it does currently. Note in tegra186_cpufreq_get() > the variable 'freq' is initialised to 0, and if no match is found, then > it returns 0. This is what happens currently on some Tegra186 boards. Then there is a problem with the implementation of this helper in your case. This shouldn't try to go compare the value read from the register with the table, rather convert that directly to a meaningful frequency. Its like reading registers and then doing some computations with the values read with the parent PLLs frequency. Something like what you will normally do in the implementation of clk_get_rate(). -- viresh