aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/at91_mci.c
diff options
context:
space:
mode:
authorMarc Pignat <marc.pignat@hevs.ch>2007-07-16 05:07:02 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-07-20 12:51:30 -0400
commit63b66438860f246f25f5563cde4978cf255cb810 (patch)
tree5a295e77c5264a1790f76da41ec8d1acb8bf0d50 /drivers/mmc/host/at91_mci.c
parent81764fa9a472dd72b93385f30f718ed4f98ec129 (diff)
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: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host/at91_mci.c')
-rw-r--r--drivers/mmc/host/at91_mci.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 28c881895ab7..15aab374127e 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -903,8 +903,10 @@ static int __init at91_mci_probe(struct platform_device *pdev)
903 /* 903 /*
904 * Add host to MMC layer 904 * Add host to MMC layer
905 */ 905 */
906 if (host->board->det_pin) 906 if (host->board->det_pin) {
907 host->present = !at91_get_gpio_value(host->board->det_pin); 907 host->present = !at91_get_gpio_value(host->board->det_pin);
908 device_init_wakeup(&pdev->dev, 1);
909 }
908 else 910 else
909 host->present = -1; 911 host->present = -1;
910 912
@@ -940,6 +942,7 @@ static int __exit at91_mci_remove(struct platform_device *pdev)
940 host = mmc_priv(mmc); 942 host = mmc_priv(mmc);
941 943
942 if (host->present != -1) { 944 if (host->present != -1) {
945 device_init_wakeup(&pdev->dev, 0);
943 free_irq(host->board->det_pin, host); 946 free_irq(host->board->det_pin, host);
944 cancel_delayed_work(&host->mmc->detect); 947 cancel_delayed_work(&host->mmc->detect);
945 } 948 }
@@ -966,8 +969,12 @@ static int __exit at91_mci_remove(struct platform_device *pdev)
966static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state) 969static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
967{ 970{
968 struct mmc_host *mmc = platform_get_drvdata(pdev); 971 struct mmc_host *mmc = platform_get_drvdata(pdev);
972 struct at91mci_host *host = mmc_priv(mmc);
969 int ret = 0; 973 int ret = 0;
970 974
975 if (device_may_wakeup(&pdev->dev))
976 enable_irq_wake(host->board->det_pin);
977
971 if (mmc) 978 if (mmc)
972 ret = mmc_suspend_host(mmc, state); 979 ret = mmc_suspend_host(mmc, state);
973 980
@@ -977,8 +984,12 @@ static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
977static int at91_mci_resume(struct platform_device *pdev) 984static int at91_mci_resume(struct platform_device *pdev)
978{ 985{
979 struct mmc_host *mmc = platform_get_drvdata(pdev); 986 struct mmc_host *mmc = platform_get_drvdata(pdev);
987 struct at91mci_host *host = mmc_priv(mmc);
980 int ret = 0; 988 int ret = 0;
981 989
990 if (device_may_wakeup(&pdev->dev))
991 disable_irq_wake(host->board->det_pin);
992
982 if (mmc) 993 if (mmc)
983 ret = mmc_resume_host(mmc); 994 ret = mmc_resume_host(mmc);
984 995