Re: [PATCH 2/2] regulator: provide regulator_set_voltage_sel_regmap_step() helper
From: Bartosz Golaszewski
Date: Tue Dec 11 2018 - 05:55:52 EST
pon., 10 gru 2018 o 16:41 Mark Brown <broonie@xxxxxxxxxx> napisaÅ(a):
>
> On Mon, Dec 10, 2018 at 04:10:24PM +0100, Bartosz Golaszewski wrote:
>
> > On some devices we need to manually ramp the regulators to desired
> > voltage one step at a time. This patch adds a helper routine for
> > regmap users that checks if the regulator is enabled and, if so,
>
> My first question would be why do this at the regmap helper level, why
> not do this at the core level by stepping through selectors? I'd also
> expect to be programming the step size here, while some regulators
> aren't able to regulate well over larger step changes I'd expect that
> they wouldn't need to step through every single possible voltage value,
> that's potentially extremely slow.
>
This sounds like a good improvement to the core regulator code indeed.
I'll give it a try but I'm not sure I'll have something before the
next merge window, so for now I'll put this logic into my driver that
I'd like to get merged for 4.22 and we can factor it out later on once
we agree on the right approach.
> > + asc = diff > 0 ? false : true;
> > + end = asc ? sel + 1 : sel - 1;
> > + asc ? curr++ : curr--;
>
> Please just write normal conditional statements so the code is more
> readable and hence maintainable.
Sure.
Thanks,
Bartosz