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

Commit 0ddfedec authored by Asutosh Das's avatar Asutosh Das Committed by Stephen Boyd
Browse files

mmc: sdhci: add sdio wakeup event



This patch adds wakeup event capability for sdio cards.
When a wakeup event is received during suspend, a reference
to the card devices' wakeup source is taken for 300 ms.

It is expected that the function driver would act on the
wakeup event within this time-period.

Change-Id: I80fe0c450e8d9b3df51aa181d667d94517c961dc
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent 7e63010c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "sdhci.h"

#define DRIVER_NAME "sdhci"
#define SDHCI_SUSPEND_TIMEOUT 300 /* 300 ms */

#define DBG(f, x...) \
	pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
@@ -2873,6 +2874,12 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
			mmc_hostname(host->mmc), host->clock,
			host->mmc->clk_gated, host->irq_enabled);
		spin_unlock(&host->lock);
		/* prevent suspend till the ksdioirqd runs or resume happens */
		if ((host->mmc->dev_status == DEV_SUSPENDING) ||
		    (host->mmc->dev_status == DEV_SUSPENDED))
			pm_wakeup_event(&host->mmc->card->dev,
					SDHCI_SUSPEND_TIMEOUT);
		else
			mmc_signal_sdio_irq(host->mmc);
		return IRQ_HANDLED;
	}
@@ -2968,9 +2975,13 @@ out:
	/*
	 * We have to delay this as it calls back into the driver.
	 */
	if (cardint)
	if (cardint) {
		/* clks are on, but suspend may be in progress */
		if (host->mmc->dev_status == DEV_SUSPENDING)
			pm_wakeup_event(&host->mmc->card->dev,
					SDHCI_SUSPEND_TIMEOUT);
		mmc_signal_sdio_irq(host->mmc);

	}
	return result;
}