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

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

Merge "mmc: revert runtime idle state"

parents 30d372bd e76cf738
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -4097,13 +4097,6 @@ static int mmc_blk_probe(struct mmc_card *card)
	}

	pm_runtime_set_autosuspend_delay(&card->dev, MMC_AUTOSUSPEND_DELAY_MS);
	/*
	 * If there is a runtime_idle function, it should take care of
	 * suspending the card
	 */
	if (card->host->bus_ops->runtime_idle)
		pm_runtime_dont_use_autosuspend(&card->dev);
	else
	pm_runtime_use_autosuspend(&card->dev);

	/*
+1 −12
Original line number Diff line number Diff line
@@ -206,21 +206,10 @@ static int mmc_runtime_resume(struct device *dev)
	return host->bus_ops->runtime_resume(host);
}

static int mmc_runtime_idle(struct device *dev)
{
	struct mmc_card *card = mmc_dev_to_card(dev);
	struct mmc_host *host = card->host;

	if (host->bus_ops->runtime_idle)
		return host->bus_ops->runtime_idle(host);
	return 0;
}

#endif /* !CONFIG_PM_RUNTIME */

static const struct dev_pm_ops mmc_bus_pm_ops = {
	SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume,
			mmc_runtime_idle)
	SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, NULL)
	SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
};

+1 −14
Original line number Diff line number Diff line
@@ -2034,19 +2034,6 @@ void mmc_get_card(struct mmc_card *card)
}
EXPORT_SYMBOL(mmc_get_card);

/*
 * This is a helper function, which drops the runtime
 * pm reference for the card device.
 */
void __mmc_put_card(struct mmc_card *card)
{
	/* In case of runtime_idle, it will handle the suspend */
	if (card->host->bus_ops->runtime_idle)
		pm_runtime_put(&card->dev);
	else
		pm_runtime_put_autosuspend(&card->dev);
}
EXPORT_SYMBOL(__mmc_put_card);

/*
 * This is a helper function, which releases the host and drops the runtime
@@ -2056,7 +2043,7 @@ void mmc_put_card(struct mmc_card *card)
{
	mmc_release_host(card->host);
	pm_runtime_mark_last_busy(&card->dev);
	__mmc_put_card(card);
	pm_runtime_put_autosuspend(&card->dev);
}
EXPORT_SYMBOL(mmc_put_card);

+0 −64
Original line number Diff line number Diff line
@@ -2643,69 +2643,6 @@ static int mmc_power_restore(struct mmc_host *host)
	return ret;
}

#define NO_AUTOSUSPEND	(-1)
static int mmc_runtime_idle(struct mmc_host *host)
{
	int err = 0;
	bool halt_cmdq;

	BUG_ON(!host->card);

	mmc_claim_host(host);

	halt_cmdq = mmc_card_cmdq(host->card) &&
			(host->card->bkops.needs_check ||
			 host->card->bkops.needs_manual);

	/*
	 * If there are active requests, can't check for bkops. Postpone
	 * until the next time that runtime_idle is scheduled.
	 */
	if (host->cmdq_ctx.active_reqs)
		goto no_suspend;

	if (halt_cmdq) {
		err = mmc_cmdq_halt(host, true);
		if (err) {
			pr_err("%s: %s failed to halt cmdq (%d)\n",
					mmc_hostname(host), __func__, err);
			goto out;
		}
	}

	if (host->card->bkops.needs_manual)
		host->card->bkops.needs_check = false;

	if (host->card->bkops.needs_check) {
		mmc_check_bkops(host->card);
		host->card->bkops.needs_check = false;

	}

	if (host->card->bkops.needs_manual)
		mmc_start_manual_bkops(host->card);

	if (halt_cmdq) {
		err = mmc_cmdq_halt(host, false);
		if (err)
			pr_err("%s: %s failed to unhalt cmdq (%d)\n",
					mmc_hostname(host), __func__, err);
	}

out:
	/*
	 * TODO: consider prolonging suspend when bkops
	 * is running in order to allow a longer time for
	 * bkops to complete
	 * */
	pm_schedule_suspend(&host->card->dev, MMC_AUTOSUSPEND_DELAY_MS);
no_suspend:
	mmc_release_host(host);
	pm_runtime_mark_last_busy(&host->card->dev);
	/* return negative value in order to avoid autosuspend */
	return (err) ? err : NO_AUTOSUSPEND;
}

static const struct mmc_bus_ops mmc_ops = {
	.remove = mmc_remove,
	.detect = mmc_detect,
@@ -2713,7 +2650,6 @@ static const struct mmc_bus_ops mmc_ops = {
	.resume = mmc_resume,
	.runtime_suspend = mmc_runtime_suspend,
	.runtime_resume = mmc_runtime_resume,
	.runtime_idle = mmc_runtime_idle,
	.power_restore = mmc_power_restore,
	.alive = mmc_alive,
	.change_bus_speed = mmc_change_bus_speed,