mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Casco <jesse.casco@gmail.com>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] regulator: qcom-rpmh: Don't overwrite the initial mode with the boot readback
Date: Thu, 12 Nov 2026 11:09:42 -0500	[thread overview]
Message-ID: <20261112160942.27909-1-jesse.casco@gmail.com> (raw)

rpmh_regulator_init_vreg() registers the regulator, and
set_machine_constraints() applies regulator-initial-mode (or the mode
derived from regulator-system-load) through ->set_mode(), caching it in
vreg->mode. Probe then calls rpmh_regulator_determine_initial_mode()
unconditionally, which for an enabled regulator overwrites vreg->mode
with the RPMh boot readback (mapping a raw mode of 0 to the lowest
supported mode).

Skip rpmh_regulator_determine_initial_mode() when registration has
already set vreg->mode. Leaving vreg->bypassed clear also matches the
non-bypass mode request that ->set_mode() just sent.

Fixes: 09d99ff7fc3c ("regulator: qcom-rpmh: readback voltage/bypass/mode set during bootup")
Cc: stable@vger.kernel.org
Signed-off-by: Jesse Casco <jesse.casco@gmail.com>
---
 drivers/regulator/qcom-rpmh-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c
index 08e39499be86..da4764ffa632 100644
--- a/drivers/regulator/qcom-rpmh-regulator.c
+++ b/drivers/regulator/qcom-rpmh-regulator.c
@@ -1961,6 +1961,10 @@ static int rpmh_regulator_probe(struct platform_device *pdev)
 		if (ret < 0)
 			return ret;
 
+		/* Keep a mode already applied by set_machine_constraints() */
+		if (vreg->mode != REGULATOR_MODE_INVALID)
+			continue;
+
 		ret = rpmh_regulator_determine_initial_mode(vreg);
 		if (ret < 0)
 			dev_err(dev, "failed to read initial mode for %s\n",

base-commit: a2a6f6b0b394eda55bd3483ecafbdc8228819a98
-- 
2.56.0


                 reply	other threads:[~2026-11-12 16:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261112160942.27909-1-jesse.casco@gmail.com \
    --to=jesse.casco@gmail.com \
    --cc=broonie@kernel.org \
    --cc=kamal.wadhwa@oss.qualcomm.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®