* [PATCH 1/2] mmc: sdhci-msm: Initialize the local ios in msm_toggle_vqmmc()
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 ` Shawn Lin
2026-09-30 4:32 ` [PATCH 2/2] mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling Shawn Lin
2026-09-30 9:40 ` [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc Ulf Hansson
2 siblings, 0 replies; 5+ messages in thread
From: Shawn Lin @ 2026-09-30 4:32 UTC (permalink / raw)
To: Ulf Hansson
Cc: linux-mmc, Adrian Hunter, linux-kernel, Shawn Lin, linux-arm-msm
msm_toggle_vqmmc() builds a local struct mmc_ios and only initializes
its signal_voltage, leaving vdd and the other members uninitialized
when passing it to mmc_regulator_set_vqmmc(). It happens to work
because the function only looks at signal_voltage today, but the next
patch makes mmc_regulator_set_vqmmc() honor ios->vdd when calculating
the 3.3V voltage range, which would read the uninitialized member.
Start the local ios from mmc->ios so that all members are valid.
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/host/sdhci-msm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index aecd425..32b1bcb 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1490,7 +1490,7 @@ static int msm_toggle_vqmmc(struct sdhci_msm_host *msm_host,
struct mmc_host *mmc, bool level)
{
int ret;
- struct mmc_ios ios;
+ struct mmc_ios ios = mmc->ios;
if (msm_host->vqmmc_enabled == level)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/2] mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling
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
2026-09-30 9:40 ` [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc Ulf Hansson
2 siblings, 0 replies; 5+ messages in thread
From: Shawn Lin @ 2026-09-30 4:32 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Adrian Hunter, linux-kernel, Shawn Lin
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc
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 ` [PATCH 2/2] mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling Shawn Lin
@ 2026-09-30 9:40 ` Ulf Hansson
2026-09-30 14:46 ` Shawn Lin
2 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2026-09-30 9:40 UTC (permalink / raw)
To: Shawn Lin; +Cc: Ulf Hansson, linux-mmc, Adrian Hunter, linux-kernel
On Wed, Sep 30, 2026 at 6:33 AM Shawn Lin <shawn.lin@rock-chips.com> wrote:
>
>
> mmc_regulator_set_vqmmc() derives the vqmmc voltage range from
> mmc->ios.vdd, which can be stale with respect to the ios passed by the
> caller. patch 2 uses ios->vdd instead; patch 1 prepares sdhci-msm,
> which passes a local ios with an uninitialized vdd.
>
>
>
> Shawn Lin (2):
> mmc: sdhci-msm: Initialize the local ios in msm_toggle_vqmmc()
> mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling
>
> drivers/mmc/core/regulator.c | 2 +-
> drivers/mmc/host/sdhci-msm.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>
Not sure how you posted this, but it seems like patch1 didn't make it
to lore nor to patchwork.
Are you using b4?
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Let mmc_regulator_set_vqmmc() use ios->vdd to set vqmmc
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
0 siblings, 0 replies; 5+ messages in thread
From: Shawn Lin @ 2026-09-30 14:46 UTC (permalink / raw)
To: Ulf Hansson
Cc: shawn.lin, Ulf Hansson, linux-mmc, Adrian Hunter, linux-kernel
Hi Ulf
在 2026/09/30 星期三 17:40, Ulf Hansson 写道:
> On Wed, Sep 30, 2026 at 6:33 AM Shawn Lin <shawn.lin@rock-chips.com> wrote:
>>
>>
>> mmc_regulator_set_vqmmc() derives the vqmmc voltage range from
>> mmc->ios.vdd, which can be stale with respect to the ios passed by the
>> caller. patch 2 uses ios->vdd instead; patch 1 prepares sdhci-msm,
>> which passes a local ios with an uninitialized vdd.
>>
>>
>>
>> Shawn Lin (2):
>> mmc: sdhci-msm: Initialize the local ios in msm_toggle_vqmmc()
>> mmc: core: Use the ios vdd when calculating vqmmc for 3.3V signaling
>>
>> drivers/mmc/core/regulator.c | 2 +-
>> drivers/mmc/host/sdhci-msm.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> --
>> 2.7.4
>>
>
> Not sure how you posted this, but it seems like patch1 didn't make it
> to lore nor to patchwork.
>
> Are you using b4?
Yes, I was using b4.
I'm not at all surprised that some patches take longer than others in
the same series to hit the mailing list. I've run into it occasionally.
My guess is that certain words in the email trigger the list's
moderation filter.
But anyway, it reached lore finally:
https://lore.kernel.org/linux-mmc/1790742751-245571-2-git-send-email-shawn.lin@rock-chips.com/T/#u
>
> Kind regards
> Uffe
>
^ permalink raw reply [flat|nested] 5+ messages in thread