[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <802e7f15-029c-4eb6-b0d8-53d16f7da37a@sirena.org.uk>
Date: Wed, 25 Oct 2023 18:49:47 +0100
From: Mark Brown <broonie@...nel.org>
To: Stephan Gerhold <stephan.gerhold@...nkonzept.com>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
Stephan Gerhold <stephan@...hold.net>
Subject: Re: [PATCH RFC 1/2] regulator: core: Disable unused regulators with
unknown status
On Tue, Oct 24, 2023 at 10:57:38AM +0200, Stephan Gerhold wrote:
> I think it does not change much for this patch, though. Even when
> implemented in the core we still need to represent this situation
> somehow for regulator_is_enabled(). Simply returning 0 (disabled) or
> 1 (enabled) would be wrong. Do you think returning -EBUSY would be
> appropriate for that?
In these cases where we simply can't read the expectation is that we'll
always be using the logical state - one way of thinking about it is that
the operation is mostly a bootstrapping helper to figure out what the
initial state is. A quick survey of users suggest they'll pretty much
all be buggy if we start returning errors, and I frankly even if all the
current users were fixed I'd expect that to continue to be a common
error. I suppose that the effect of ignoring the possibility of error
is like the current behaviour though.
> The second challenge I see on a quick look is that both
> qcom_smd-regulator.c and qcom-rpmh-regulator.c use their reference
> counter internally in other function (e.g. to decide if a voltage change
> should be sent, see "vreg->enabled" checks). I think we would also need
> to add some rdev_is_enabled() function that would expose the core
> reference counter to the driver?
> Tracking the enable state in the driver (the way it is right now) is not
> that much code, so I'm not entirely sure if we might actually end up
> with more code/complexity when moving this to the core.
We have to do the reference count in the core anyway since it's a
reference count not just a simple on/off so it doesn't really cost us
anything to make it available to drivers.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists