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

Commit 56902d5e authored by Can Guo's avatar Can Guo Committed by Ram Prakash Gupta
Browse files

mmc: core: Fix card remove detect when use extcon



Since SDM845 uses extcon for card insertion and remove detection
and cd_gpio in device tree is not given, so the mmc_gpio_get_cd
function cannot detect card remove by reading gpio value. Fix it
by checking extcon state if extcon is initialized during sdhci
msm probe.

Change-Id: Ib44d211f707393cb440c387a06fa70d3adc99736
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent 79c36b07
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -81,7 +81,15 @@ int mmc_gpio_get_cd(struct mmc_host *host)
{
	struct mmc_gpio *ctx = host->slot.handler_priv;
	int cansleep;
	int ret;

	if (host->extcon) {
		ret =  extcon_get_state(host->extcon, EXTCON_MECHANICAL);
		if (ret < 0)
			dev_err(mmc_dev(host), "%s: Extcon failed to check card state, ret=%d\n",
					__func__, ret);
		return ret;
	}
	if (!ctx || !ctx->cd_gpio)
		return -ENOSYS;