aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2006-12-10 09:55:38 -0500
committerPierre Ossman <drzeus@drzeus.cx>2007-02-04 14:54:10 -0500
commitdba4accab17bd2e2e09088f746257a8c14af1cc2 (patch)
tree5a97d4f225de1e52042c92823536354118c69abe /drivers/mmc
parent41d78f7405659b55e082c5f0b3d1b625e75e1294 (diff)
tifm_sd: add suspend and resume functionality
Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/tifm_sd.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index 2adfe346701..ce19b045ca6 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -921,6 +921,41 @@ static void tifm_sd_remove(struct tifm_dev *sock)
921 mmc_free_host(mmc); 921 mmc_free_host(mmc);
922} 922}
923 923
924#ifdef CONFIG_PM
925
926static int tifm_sd_suspend(struct tifm_dev *sock, pm_message_t state)
927{
928 struct mmc_host *mmc = tifm_get_drvdata(sock);
929 int rc;
930
931 rc = mmc_suspend_host(mmc, state);
932 /* The meaning of the bit majority in this constant is unknown. */
933 writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
934 sock->addr + SOCK_CONTROL);
935 return rc;
936}
937
938static int tifm_sd_resume(struct tifm_dev *sock)
939{
940 struct mmc_host *mmc = tifm_get_drvdata(sock);
941 struct tifm_sd *host = mmc_priv(mmc);
942
943 if (sock->media_id != FM_SD
944 || tifm_sd_initialize_host(host)) {
945 tifm_eject(sock);
946 return 0;
947 } else {
948 return mmc_resume_host(mmc);
949 }
950}
951
952#else
953
954#define tifm_sd_suspend NULL
955#define tifm_sd_resume NULL
956
957#endif /* CONFIG_PM */
958
924static tifm_media_id tifm_sd_id_tbl[] = { 959static tifm_media_id tifm_sd_id_tbl[] = {
925 FM_SD, 0 960 FM_SD, 0
926}; 961};
@@ -932,7 +967,9 @@ static struct tifm_driver tifm_sd_driver = {
932 }, 967 },
933 .id_table = tifm_sd_id_tbl, 968 .id_table = tifm_sd_id_tbl,
934 .probe = tifm_sd_probe, 969 .probe = tifm_sd_probe,
935 .remove = tifm_sd_remove 970 .remove = tifm_sd_remove,
971 .suspend = tifm_sd_suspend,
972 .resume = tifm_sd_resume
936}; 973};
937 974
938static int __init tifm_sd_init(void) 975static int __init tifm_sd_init(void)