[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQoFC3YDNlw4imML@finisterre.sirena.org.uk>
Date: Tue, 4 Nov 2025 13:52:11 +0000
From: Mark Brown <broonie@...nel.org>
To: Andreas Kemnade <akemnade@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC] regulator: core: fix constraints handling if current
state out of range
On Mon, Nov 03, 2025 at 08:32:41PM +0100, Andreas Kemnade wrote:
> - if (current_uV < rdev->constraints->min_uV) {
> + if ((current_uV < rdev->constraints->min_uV) ||
> + (current_uV > rdev->constraints->max_uV)) {
> target_min = rdev->constraints->min_uV;
> - target_max = rdev->constraints->min_uV;
> - }
> -
> - if (current_uV > rdev->constraints->max_uV) {
> - target_min = rdev->constraints->max_uV;
> target_max = rdev->constraints->max_uV;
> }
There's a valid issue here if we can't represent the exact constraint
(the hope was that people wouldn't specify constraints that their
hardware wasn't capable of representing but we can't exactly stop
them...) however this change is risky in the case where the voltage is
too high since if we specify a range from minimum to maximum we'll try
to select a voltage as close as possible to the minimum. That could
result in a large change if the range is wide, and potentially go under
the voltage the hardware needs for it's current configuration. We were
trying to set the highest voltage in the range to minimise the risk
there. This isn't a concern in the case where we're raising the
voltage.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists