Re: [PATCH 2/2] OPP: Fix missing debugfs supply directory for OPPs

From: Viresh Kumar
Date: Tue Dec 11 2018 - 23:48:09 EST


On 11-12-18, 13:48, Quentin Perret wrote:
> On Tuesday 11 Dec 2018 at 16:56:29 (+0530), Viresh Kumar wrote:
> > 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.
>
> Tested on Juno r0 and Hikey960 successfully. The 'supply' directory is
> now correctly exposed.
>
> Feel free to add Tested-by: Quentin Perret <quentin.perret@xxxxxxx>

Thanks.

--
viresh