Re: [PATCH 2/2] mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling

From: Adrian Hunter

Date: Tue Oct 06 2026 - 01:58:55 EST


On 30/09/2026 07:32, Shawn Lin wrote:
> 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@xxxxxxxxxxxxxx>

Reviewed-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

>
> ---
>
> 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;
>