Commit 63b66438 authored by Marc Pignat's avatar Marc Pignat Committed by Pierre Ossman

mmc: at91_mci: wakeup on card insertion (or removal)

This piece of code enable the system to be wake-up by a card insertion or removal.
Signed-off-by: default avatarMarc Pignat <marc.pignat@hevs.ch>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 81764fa9
...@@ -903,8 +903,10 @@ static int __init at91_mci_probe(struct platform_device *pdev) ...@@ -903,8 +903,10 @@ static int __init at91_mci_probe(struct platform_device *pdev)
/* /*
* Add host to MMC layer * Add host to MMC layer
*/ */
if (host->board->det_pin) if (host->board->det_pin) {
host->present = !at91_get_gpio_value(host->board->det_pin); host->present = !at91_get_gpio_value(host->board->det_pin);
device_init_wakeup(&pdev->dev, 1);
}
else else
host->present = -1; host->present = -1;
...@@ -940,6 +942,7 @@ static int __exit at91_mci_remove(struct platform_device *pdev) ...@@ -940,6 +942,7 @@ static int __exit at91_mci_remove(struct platform_device *pdev)
host = mmc_priv(mmc); host = mmc_priv(mmc);
if (host->present != -1) { if (host->present != -1) {
device_init_wakeup(&pdev->dev, 0);
free_irq(host->board->det_pin, host); free_irq(host->board->det_pin, host);
cancel_delayed_work(&host->mmc->detect); cancel_delayed_work(&host->mmc->detect);
} }
...@@ -966,8 +969,12 @@ static int __exit at91_mci_remove(struct platform_device *pdev) ...@@ -966,8 +969,12 @@ static int __exit at91_mci_remove(struct platform_device *pdev)
static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state) static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct mmc_host *mmc = platform_get_drvdata(pdev); struct mmc_host *mmc = platform_get_drvdata(pdev);
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0; int ret = 0;
if (device_may_wakeup(&pdev->dev))
enable_irq_wake(host->board->det_pin);
if (mmc) if (mmc)
ret = mmc_suspend_host(mmc, state); ret = mmc_suspend_host(mmc, state);
...@@ -977,8 +984,12 @@ static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -977,8 +984,12 @@ static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
static int at91_mci_resume(struct platform_device *pdev) static int at91_mci_resume(struct platform_device *pdev)
{ {
struct mmc_host *mmc = platform_get_drvdata(pdev); struct mmc_host *mmc = platform_get_drvdata(pdev);
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0; int ret = 0;
if (device_may_wakeup(&pdev->dev))
disable_irq_wake(host->board->det_pin);
if (mmc) if (mmc)
ret = mmc_resume_host(mmc); ret = mmc_resume_host(mmc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment