OPP: Fix missing debugfs supply directory for OPPs
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 11 Dec 2018 11:09:36 +0000 (16:39 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 11 Dec 2018 11:21:56 +0000 (16:51 +0530)
commit46f48aca2e5aef3f430e95d1a5fb68227ec8ec85
tree0b4df41cec1365e38ee62495fa59da07363777e8
parent90e3577b5feb42bac1269e16bb3d2bdd8f6df40f
OPP: Fix missing debugfs supply directory for OPPs

There is one case where we may end up with no "supply" directory for the
OPPs in debugfs. That happens when the OPP core isn't managing the
regulators for the device and the device's OPP do have microvolt
property. It happens because the opp_table->regulator_count remains set
to 0 and the debugfs routines don't add any supply directory in such a
case.

This commit fixes that by setting opp_table->regulator_count to 1 in
that particular case. But to make everything work nicely and not break
other parts of the core, regulator_count is defined as "int" now instead
of "unsigned int" and it can have different special values now. It is
set to -1 initially to mark it "uninitialized" and later only we set it
to 0 or positive values after checking how many supplies are there.

This also helps in finding the bugs where only few of the OPPs have the
"opp-microvolt" property set and not all.

Fixes: 1fae788ed640 ("PM / OPP: Don't create debugfs "supply-0" directory unnecessarily")
Reported-by: Quentin Perret <quentin.perret@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
drivers/opp/of.c
drivers/opp/opp.h