Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a27f46da authored by Sarthak Garg's avatar Sarthak Garg
Browse files

mmc: sdhci-msm: Ensure SD card power isn't ON when card removed



Make sure SD card power is not enabled when the card is
being removed.
On multi-card tray designs, the same card-tray would be used for SD
card and SIM cards. If SD card is placed at the rightmost location
in the tray, then SIM card may come in contact with SD card power-
supply while removing the tray. It may result in SIM damage.
So in sdhci_msm_handle_pwr_irq we skip the BUS_ON request when the
SD card is removed to be in consistent with the MGPI hardware fix to
prevent any damage to the SIM card in case of mult-card tray designs.
But we need to have a similar check in sdhci_msm_check_power_status to
be in consistent with the sdhci_msm_handle_pwr_irq function.
When the SD card is removed regulators are never turned ON.
Reset host->pwr and POWER_CONTROL register accordingly.

In the current 4.19 implementation there is one corner case where the
regulators can be turned ON after card removal.
Consider below case :

<3>[  321.145382]  (1)[321:kworker/1:1H]mmc0: mmc_power_off enter
<4>[  321.145429]  (1)[321:kworker/1:1H] mmc_power_cycle+0x6c/0xa0
<4>[  321.145434]  (1)[321:kworker/1:1H] mmc_sd_hw_reset+0x3c/0x68
<4>[  321.145438]  (1)[321:kworker/1:1H] mmc_hw_reset+0x64/0x158
<4>[  321.145442]  (1)[321:kworker/1:1H] mmc_blk_reset+0x68/0x1e8
<4>[  321.145446]  (1)[321:kworker/1:1H]
mmc_blk_mq_rw_recovery+0x1cc/0x540

<3>[  321.145519]  (3)[329:irq/29-4784000.]mmc0: Received IRQ(29),
status=0x9 --> Finally powering_off

<3>[  321.152363]  (1)[321:kworker/1:1H]mmc0: mmc_power_up enter -->
Powering UP
<4>[  321.152408]  (1)[321:kworker/1:1H] mmc_power_up+0x90/0x2e0
<4>[  321.152413]  (1)[321:kworker/1:1H] mmc_power_cycle+0x38/0xa0
<4>[  321.152417]  (1)[321:kworker/1:1H] mmc_sd_hw_reset+0x3c/0x68
<4>[  321.152421]  (1)[321:kworker/1:1H] mmc_hw_reset+0x64/0x158
<4>[  321.152426]  (1)[321:kworker/1:1H] mmc_blk_reset+0x68/0x1e8
<4>[  321.152430]  (1)[321:kworker/1:1H]
mmc_blk_mq_rw_recovery+0x1cc/0x540

<3>[  321.152489]  (2)[334:irq/207-4784000]mmc0: cd gpio irq,
gpio state 0 (CARD_REMOVAL)
<3>[  321.152494]  (2)[334:irq/207-4784000]mmc0: _mmc_detect_change
enter, delay:50, cd_irq:1

<3>[  321.156547]  (3)[329:irq/29-4784000.]mmc0: Received IRQ(29),
status=0x2 --> Powering ON despite the card was removed.

Port 5.4 logic to check for card presence before turning ON the
regulators as part of sdhci_msm_pwr_irq.

Change-Id: I6f64a1c869dde2ed6ea2b95d0b6d2f59203b28b7
Signed-off-by: default avatarSarthak Garg <quic_sartgarg@quicinc.com>
parent 833c0d8f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment