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

Commit 205e1263 authored by Dov Levenglick's avatar Dov Levenglick Committed by Gerrit - the friendly Code Review server
Browse files

mmc: schci: add support for MMC_PM_KEEP_POWER in eMMC



There are eMMC cards that should not be powered off
during suspend/resume cycles.
This patch adds support for such cards and avoids powering
the card off during suspend or powering it back on
during resume when MMC_PM_KEEP_POWER is set.

Change-Id: Iec1a0aac80ee41dff56f192e7253c2bd00c15694
Signed-off-by: default avatarDov Levenglick <dovl@codeaurora.org>
parent 5bc2f8ec
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -2210,6 +2210,9 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
	if (mmc_card_suspended(host->card))
	if (mmc_card_suspended(host->card))
		goto out;
		goto out;


	if (is_suspend)
		host->dev_status = DEV_SUSPENDING;

	if (mmc_card_cmdq(host->card)) {
	if (mmc_card_cmdq(host->card)) {
		BUG_ON(host->cmdq_ctx.active_reqs);
		BUG_ON(host->cmdq_ctx.active_reqs);


@@ -2249,6 +2252,10 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
		mmc_card_set_suspended(host->card);
		mmc_card_set_suspended(host->card);
	}
	}
out:
out:
	if (err)
		host->dev_status = DEV_UNKNOWN;
	else if (is_suspend)
		host->dev_status = DEV_SUSPENDED;
	mmc_release_host(host);
	mmc_release_host(host);
	return err;
	return err;
}
}
@@ -2324,6 +2331,8 @@ static int _mmc_resume(struct mmc_host *host)
		mmc_init_clk_scaling(host);
		mmc_init_clk_scaling(host);


out:
out:
	if (!err)
		host->dev_status = DEV_RESUMED;
	return err;
	return err;
}
}


+10 −0
Original line number Original line Diff line number Diff line
@@ -1407,6 +1407,16 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
	struct mmc_host *mmc = host->mmc;
	struct mmc_host *mmc = host->mmc;
	u8 pwr = 0;
	u8 pwr = 0;


	/*
	 * Don't disable/re-enable power to the card when running a
	 * suspend/resume sequence and the pm_flags are configured to preserve
	 * card power during suspend.
	 */
	if (mmc_card_keep_power(mmc) &&
	    ((mmc->dev_status == DEV_SUSPENDED && mode == MMC_POWER_UP) ||
	     (mmc->dev_status == DEV_SUSPENDING && mode == MMC_POWER_OFF)))
		return;

	if (!IS_ERR(mmc->supply.vmmc)) {
	if (!IS_ERR(mmc->supply.vmmc)) {
		spin_unlock_irq(&host->lock);
		spin_unlock_irq(&host->lock);
		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+1 −0
Original line number Original line Diff line number Diff line
@@ -284,6 +284,7 @@ enum dev_state {
	DEV_SUSPENDING = 1,
	DEV_SUSPENDING = 1,
	DEV_SUSPENDED,
	DEV_SUSPENDED,
	DEV_RESUMED,
	DEV_RESUMED,
	DEV_UNKNOWN,	/* Device is in an unknown state */
};
};


/**
/**