On 26-08-22, 07:56, Douglas Anderson wrote: > On some cpufreq drivers we know the voltage associated with each > operating point but there is no explicit Linux "regulator" present. An > example is "qcom-cpufreq-hw.c". There the voltage is managed > automatically by the hardware but we still associate it with the OPP > table so we can do energy calculations for EAS. > > The OPP framework handles this in general. In _opp_allocate() it can > be seen that we always allocate space for one supply even if > "regulator_count" is 0. > > Let's handle this properly in debugfs. > > NOTE: as a side effect of this a whole bunch of OPPs in the system may > get supply-related files exposed in debugfs that are mostly useless > (they'll just contain 0). I'd expect this to be OK but it's moderately > annoying. It seems better than trying to dynamically create debugfs > directories when the voltages are non-zero or adding extra complexity > in the code giving a hint to the OPP framework that voltages should be > exposed. > > After this patch, on a sc7180-trogdor class device I can see voltages > for the CPU OPPs under /sys/kernel/debug/opp. The OPP core already supports platforms which don't have a regulator set for the CPU device, but the OPP table have an entry for microvolt. This already works. I looked at your DT and I understand why this isn't working for you. The problem is that your DT doesn't have any of such values (opp-microvolt) but the driver later calls dev_pm_opp_adjust_voltage() to set voltage values. IMO, this is wrong by design. This takes advantage of the fact that the OPP core doesn't check if voltage has been previously set for the device or not in dev_pm_opp_adjust_voltage() and it works by chance currently. I would suggest adding opp-microvolt property to the DT for this platform, the values can be 0 with a comment mentioning that software will fill them later, or if you know approximate values you can fill them as well. And then it will work just fine I hope. -- viresh