From 82fc4015597a54a3071b063bd670db3afd57dbd1 Mon Sep 17 00:00:00 2001 From: "Bao D. Nguyen" Date: Fri, 13 Mar 2020 16:33:52 -0700 Subject: [PATCH] mmc: sdhci-msm: Avoid enable SD card power if card is removed In some multi card tray designs, removing the SD card may cause the SD card power supply pin to come in contact with the SIM card. Ensure the SD card power is not turned on when the SD card is removed to avoid the SD card power supply to cause damage to the SIM card. Change-Id: Ic2a2e21e592d46dbd011a4e3f2ac108e9275f92c Signed-off-by: Bao D. Nguyen --- drivers/mmc/host/sdhci-msm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 9d86fe96d303..b0a4e84f46e0 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2058,6 +2058,7 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq) u32 config; const struct sdhci_msm_offset *msm_offset = msm_host->offset; int ret = 0; + struct mmc_host *mmc = host->mmc; irq_status = msm_host_readl(msm_host, host, msm_offset->core_pwrctl_status); @@ -2088,6 +2089,12 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq) udelay(10); } + if (mmc->ops->get_cd && !mmc->ops->get_cd(mmc) && + irq_status & (CORE_PWRCTL_BUS_ON | CORE_PWRCTL_IO_HIGH | + CORE_PWRCTL_IO_LOW)) { + return; + } + /* Handle BUS ON/OFF*/ if (irq_status & CORE_PWRCTL_BUS_ON) { ret = sdhci_msm_setup_vreg(msm_host->pdata, true, false);