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

Commit 40bce510 authored by Anjana Hari's avatar Anjana Hari
Browse files

mmc: core: Add card detection IRQ restore



Card detection can be done on TLMM or PMIC GPIOs.
In the latter case, the IRQ should be explicitly restored
in order for the detection to be successful after restoring
from hibernation and also cleared in freeze path.

Change-Id: I828b736fc5cb46e132ea849b8965f8c4a3b2feac
Signed-off-by: default avatarAnjana Hari <ahari@codeaurora.org>
parent 9bb2fe7d
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -132,6 +132,27 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio)
}
EXPORT_SYMBOL(mmc_gpio_request_ro);

void mmc_gpiod_free_cd_irq(struct mmc_host *host)
{
	devm_free_irq(host->parent, host->slot.cd_irq, host);
}
EXPORT_SYMBOL(mmc_gpiod_free_cd_irq);

void mmc_gpiod_restore_cd_irq(struct mmc_host *host)
{
	struct mmc_gpio *ctx = host->slot.handler_priv;
	int irq = host->slot.cd_irq;

	if (irq >= 0) {
		devm_request_threaded_irq(host->parent, irq,
			NULL, ctx->cd_gpio_isr,
			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
			IRQF_ONESHOT,
			ctx->cd_label, host);
	}
}
EXPORT_SYMBOL(mmc_gpiod_restore_cd_irq);

void mmc_gpiod_request_cd_irq(struct mmc_host *host)
{
	struct mmc_gpio *ctx = host->slot.handler_priv;
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
			 unsigned int debounce, bool *gpio_invert);
void mmc_gpio_set_cd_isr(struct mmc_host *host,
			 irqreturn_t (*isr)(int irq, void *dev_id));
void mmc_gpiod_free_cd_irq(struct mmc_host *host);
void mmc_gpiod_restore_cd_irq(struct mmc_host *host);
void mmc_gpiod_request_cd_irq(struct mmc_host *host);
bool mmc_can_gpio_cd(struct mmc_host *host);
void mmc_register_extcon(struct mmc_host *host);