Skip to content

Commit 477865a

Browse files
Wenchao Chenstorulf
authored andcommitted
mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
With cat regulator_summary, we found that vqmmc was not shutting down after the card was pulled. cat /sys/kernel/debug/regulator/regulator_summary 1.before fix 1)Insert SD card vddsdio 1 1 0 unknown 3500mV 0mA 1200mV 3750mV 71100000.mmc-vqmmc 1 0mA 3500mV 3600mV 2)Pull out the SD card vddsdio 1 1 0 unknown 3500mV 0mA 1200mV 3750mV 71100000.mmc-vqmmc 1 0mA 3500mV 3600mV 2.after fix 1)Insert SD cardt vddsdio 1 1 0 unknown 3500mV 0mA 1200mV 3750mV 71100000.mmc-vqmmc 1 0mA 3500mV 3600mV 2)Pull out the SD card vddsdio 0 1 0 unknown 3500mV 0mA 1200mV 3750mV 71100000.mmc-vqmmc 0 0mA 3500mV 3600mV Fixes: fb8bd90 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller") Signed-off-by: Wenchao Chen <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent d9ed644 commit 477865a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

drivers/mmc/host/sdhci-sprd.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,33 @@ static void sdhci_sprd_request_done(struct sdhci_host *host,
416416
mmc_request_done(host->mmc, mrq);
417417
}
418418

419+
static void sdhci_sprd_set_power(struct sdhci_host *host, unsigned char mode,
420+
unsigned short vdd)
421+
{
422+
struct mmc_host *mmc = host->mmc;
423+
424+
switch (mode) {
425+
case MMC_POWER_OFF:
426+
mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, 0);
427+
428+
mmc_regulator_disable_vqmmc(mmc);
429+
break;
430+
case MMC_POWER_ON:
431+
mmc_regulator_enable_vqmmc(mmc);
432+
break;
433+
case MMC_POWER_UP:
434+
mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, vdd);
435+
break;
436+
}
437+
}
438+
419439
static struct sdhci_ops sdhci_sprd_ops = {
420440
.read_l = sdhci_sprd_readl,
421441
.write_l = sdhci_sprd_writel,
422442
.write_w = sdhci_sprd_writew,
423443
.write_b = sdhci_sprd_writeb,
424444
.set_clock = sdhci_sprd_set_clock,
445+
.set_power = sdhci_sprd_set_power,
425446
.get_max_clock = sdhci_sprd_get_max_clock,
426447
.get_min_clock = sdhci_sprd_get_min_clock,
427448
.set_bus_width = sdhci_set_bus_width,
@@ -823,6 +844,10 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
823844
host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
824845
SDHCI_SUPPORT_DDR50);
825846

847+
ret = mmc_regulator_get_supply(host->mmc);
848+
if (ret)
849+
goto pm_runtime_disable;
850+
826851
ret = sdhci_setup_host(host);
827852
if (ret)
828853
goto pm_runtime_disable;

0 commit comments

Comments
 (0)