[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8f05eb9644d1920f7158c19d769c943fd5dba9a1.camel@linaro.org>
Date: Wed, 05 Nov 2025 16:15:02 +0000
From: André Draszik <andre.draszik@...aro.org>
To: Mark Brown <broonie@...nel.org>
Cc: Tudor Ambarus <tudor.ambarus@...aro.org>, Rob Herring <robh@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Krzysztof Kozlowski <krzk@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>, Lee Jones <lee@...nel.org>, Linus
Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Peter Griffin
<peter.griffin@...aro.org>, Will McVicker <willmcvicker@...gle.com>,
kernel-team@...roid.com, linux-kernel@...r.kernel.org,
linux-samsung-soc@...r.kernel.org, devicetree@...r.kernel.org,
linux-gpio@...r.kernel.org
Subject: Re: [PATCH v3 10/20] regulator: add REGULATOR_LINEAR_VRANGE macro
Thanks Mark for your review!
On Tue, 2025-11-04 at 14:27 +0000, Mark Brown wrote:
> On Mon, Nov 03, 2025 at 07:14:49PM +0000, André Draszik wrote:
>
> > REGULATOR_LINEAR_VRANGE is similar to REGULATOR_LINEAR_RANGE, but
> > allows a more natural declaration of a voltage range for a regulator,
> > in that it expects the minimum and maximum values as voltages rather
> > than as selectors.
>
> > Using voltages arguably makes this macro easier to use by drivers and
> > code using it can become easier to read compared to
> > REGULATOR_LINEAR_RANGE.
>
> It does introduce an additional layer of indirection into the validation
> that the configuration is correct, the reason we use selectors is that
> they should map directly onto the register in the datasheet.
My datasheet mentions the range more prominently than the selectors, and as driver
author I can easily validate both (neither macro does any validation itself). I do
believe code like this:
REGULATOR_LINEAR_VRANGE(200000, 450000, 1300000, STEP_6_25_MV)
looks more meaningful and is more naturally readable than
REGULATOR_LINEAR_RANGE(450000, 0x28, 0xb0, STEP_6_25_MV)
as it's much easier to see the actual range without doing any additional calculations.
I'd prefer to keep the alternative macro, but will drop this patch if you really
disagree that it adds any value
Cheers,
Andre'
Powered by blists - more mailing lists