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

Commit 7b980fba authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: core: Update PON based on the system state"

parents 678f959b af22748e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3945,6 +3945,10 @@ static int _mmc_blk_suspend(struct mmc_card *card)
static void mmc_blk_shutdown(struct mmc_card *card)
{
	_mmc_blk_suspend(card);

	/* send power off notification */
	if (mmc_card_mmc(card))
		mmc_send_pon(card);
}

#ifdef CONFIG_PM
+12 −10
Original line number Diff line number Diff line
@@ -1250,10 +1250,7 @@ static int mmc_reboot_notify(struct notifier_block *notify_block,
	struct mmc_card *card = container_of(
			notify_block, struct mmc_card, reboot_notify);

	if (event != SYS_RESTART)
		card->issue_long_pon = true;
	else
		card->issue_long_pon = false;
	card->pon_type = (event != SYS_RESTART) ? MMC_LONG_PON : MMC_SHRT_PON;

	return NOTIFY_OK;
}
@@ -2118,19 +2115,24 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
	return err;
}

int mmc_send_long_pon(struct mmc_card *card)
int mmc_send_pon(struct mmc_card *card)
{
	int err = 0;
	struct mmc_host *host = card->host;

	if (!mmc_can_poweroff_notify(card))
		goto out;

	mmc_claim_host(host);
	if (card->issue_long_pon && mmc_can_poweroff_notify(card)) {
	if (card->pon_type & MMC_LONG_PON)
		err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_LONG);
	else if (card->pon_type & MMC_SHRT_PON)
		err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_SHORT);
	if (err)
			pr_warning("%s: error %d sending Long PON",
					mmc_hostname(host), err);
	}
		pr_warn("%s: error %d sending PON type %u",
			mmc_hostname(host), err, card->pon_type);
	mmc_release_host(host);
out:
	return err;
}

+7 −2
Original line number Diff line number Diff line
@@ -321,6 +321,11 @@ struct mmc_bkops_info {
	bool needs_manual;
};

enum mmc_pon_type {
	MMC_LONG_PON = 1,
	MMC_SHRT_PON,
};

/*
 * MMC device
 */
@@ -404,7 +409,7 @@ struct mmc_card {

	struct mmc_wr_pack_stats wr_pack_stats; /* packed commands stats*/
	struct notifier_block        reboot_notify;
	bool issue_long_pon;
	enum mmc_pon_type pon_type;
	u8 *cached_ext_csd;
	bool cmdq_init;
	struct mmc_bkops_info bkops;
@@ -688,6 +693,6 @@ extern void mmc_fixup_device(struct mmc_card *card,
extern struct mmc_wr_pack_stats *mmc_blk_get_packed_statistics(
			struct mmc_card *card);
extern void mmc_blk_init_packed_statistics(struct mmc_card *card);
extern int mmc_send_long_pon(struct mmc_card *card);
extern int mmc_send_pon(struct mmc_card *card);
extern void mmc_blk_cmdq_req_done(struct mmc_request *mrq);
#endif /* LINUX_MMC_CARD_H */