From: Stephan Gerhold <stephan@gerhold.net>
To: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Stephan Gerhold <stephan.gerhold@kernkonzept.com>,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH RFC 2/2] regulator: qcom_smd: Disable unused regulators
Date: Mon, 9 Oct 2023 22:23:40 +0200 [thread overview]
Message-ID: <ZSRhTIqYX7hQ0_lc@gerhold.net> (raw)
In-Reply-To: <9b7744bf-d42c-4922-85e8-ca4777f313a7@linaro.org>
On Fri, Oct 06, 2023 at 11:15:40PM +0200, Konrad Dybcio wrote:
> On 4.10.2023 16:17, Stephan Gerhold wrote:
> > The RPM firmware on Qualcomm platforms does not provide a way to check
> > if a regulator is on during boot using the SMD interface. If the
> > regulators are already on during boot and Linux does not make use of
> > them they will currently stay enabled forever. The regulator core does
> > not know these regulators are on and cannot clean them up together with
> > the other unused regulators.
> >
> > Fix this by setting the initial enable state to -EINVAL similar to
> > qcom-rpmh-regulator.c. The regulator core will then also explicitly
> > disable all unused regulators with unknown status.
> >
> > Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
> > ---
> > NOTE: This has a slight potential of breaking boards that rely on having
> > unused regulators permanently enabled (without regulator-always-on).
> > However, this is always a mistake in the device tree so it's probably
> > better to risk some breakage now, add the missing regulators and avoid
> > this problem for all future boards.
> > ---
> > drivers/regulator/qcom_smd-regulator.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
> > index f53ada076252..0bbfba2e17ff 100644
> > --- a/drivers/regulator/qcom_smd-regulator.c
> > +++ b/drivers/regulator/qcom_smd-regulator.c
> > @@ -53,14 +53,14 @@ static int rpm_reg_write_active(struct qcom_rpm_reg *vreg)
> > reqlen++;
> > }
> >
> > - if (vreg->uv_updated && vreg->is_enabled) {
> > + if (vreg->uv_updated && vreg->is_enabled > 0) {
> At a quick glance, are there any states for this value, other
> than 0 and 1? This is not the regulator_ops->is_enabled, but
> qcom_rpm_reg->is_enabled.
>
Yes, I initially assign vreg->is_enabled = -EINVAL (for use with PATCH
1/2). It's in the part of the patch that you trimmed in your reply. :D
Thanks,
Stephan
@@ -1377,6 +1377,7 @@ static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct device *dev
vreg->rpm = rpm;
vreg->type = rpm_data->type;
vreg->id = rpm_data->id;
+ vreg->is_enabled = -EINVAL;
memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc));
vreg->desc.name = rpm_data->name;
next prev parent reply other threads:[~2023-10-09 20:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 14:17 [PATCH RFC 0/2] regulator: qcom_smd: Disable unused regulators Stephan Gerhold
2023-10-04 14:17 ` [PATCH RFC 1/2] regulator: core: Disable unused regulators with unknown status Stephan Gerhold
2023-10-06 21:11 ` Konrad Dybcio
2023-10-09 20:21 ` Stephan Gerhold
2023-10-10 12:14 ` Konrad Dybcio
2023-10-23 12:09 ` Mark Brown
2023-10-23 23:11 ` Bjorn Andersson
2023-10-24 8:57 ` Stephan Gerhold
2023-10-25 17:49 ` Mark Brown
2023-10-25 19:51 ` Stephan Gerhold
2023-10-25 20:07 ` Mark Brown
2023-10-04 14:17 ` [PATCH RFC 2/2] regulator: qcom_smd: Disable unused regulators Stephan Gerhold
2023-10-06 21:15 ` Konrad Dybcio
2023-10-09 20:23 ` Stephan Gerhold [this message]
2023-10-09 21:00 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZSRhTIqYX7hQ0_lc@gerhold.net \
--to=stephan@gerhold.net \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stephan.gerhold@kernkonzept.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox