mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: linux-mmc@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH 2/2] mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling
Date: Wed, 30 Sep 2026 12:32:31 +0800	[thread overview]
Message-ID: <1790742751-245571-3-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1790742751-245571-1-git-send-email-shawn.lin@rock-chips.com>

mmc_regulator_set_vqmmc() takes an ios pointer and switches on its
signal_voltage, but the MMC_SIGNAL_VOLTAGE_330 path looks up the VMMC
voltage range using mmc->ios.vdd instead of ios->vdd. That mixes the
ios passed by the caller with the global mmc->ios state, which do not
have to agree.

mmc_set_signal_voltage() only updates host->ios.signal_voltage before
invoking ->start_signal_voltage_switch(); host->ios.vdd is refreshed
when the power supply is (re)configured, e.g. in mmc_power_up() after a
new OCR has been selected. A host driver switching the signal voltage
for a vdd that has not been committed to mmc->ios yet, or passing its
own ios snapshot, would therefore get a vqmmc range computed for the
previous, stale vdd instead of the signaling voltage it is switching
to. With a stale vdd of the 1.65-1.95V range, the computed 3.3V window
ends up with min_uV > max_uV and the vqmmc regulator is never set, so
the signaling switch fails.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

 drivers/mmc/core/regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/regulator.c b/drivers/mmc/core/regulator.c
index a85179f..c553356 100644
--- a/drivers/mmc/core/regulator.c
+++ b/drivers/mmc/core/regulator.c
@@ -197,7 +197,7 @@ int mmc_regulator_set_vqmmc(struct mmc_host *mmc, struct mmc_ios *ios)
 		return mmc_regulator_set_voltage_if_supported(mmc->supply.vqmmc,
 						1700000, 1800000, 1950000);
 	case MMC_SIGNAL_VOLTAGE_330:
-		ret = mmc_ocrbitnum_to_vdd(mmc->ios.vdd, &volt, &max_uV);
+		ret = mmc_ocrbitnum_to_vdd(ios->vdd, &volt, &max_uV);
 		if (ret < 0)
 			return ret;
 
-- 
2.7.4


  parent reply	other threads:[~2026-09-30  5:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  4:32 [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc Shawn Lin
2026-09-30  4:32 ` [PATCH 1/2] mmc: sdhci-msm: Initialize the local ios in msm_toggle_vqmmc() Shawn Lin
2026-09-30  4:32 ` Shawn Lin [this message]
2026-09-30  9:40 ` [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc Ulf Hansson
2026-09-30 14:46   ` Shawn Lin

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=1790742751-245571-3-git-send-email-shawn.lin@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulfh@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®