Re: [PATCH 2/2] regulator: provide regulator_set_voltage_sel_regmap_step() helper

From: Mark Brown
Date: Mon Dec 10 2018 - 10:41:30 EST


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.

> + 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.

Attachment: signature.asc
Description: PGP signature