diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/wbsd.c | 106 |
1 files changed, 90 insertions, 16 deletions
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 4f13bd2ccf9a..60afc1235120 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -1980,37 +1980,53 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev) | |||
1980 | 1980 | ||
1981 | #ifdef CONFIG_PM | 1981 | #ifdef CONFIG_PM |
1982 | 1982 | ||
1983 | static int wbsd_suspend(struct platform_device *dev, pm_message_t state) | 1983 | static int wbsd_suspend(struct wbsd_host *host, pm_message_t state) |
1984 | { | ||
1985 | BUG_ON(host == NULL); | ||
1986 | |||
1987 | return mmc_suspend_host(host->mmc, state); | ||
1988 | } | ||
1989 | |||
1990 | static int wbsd_resume(struct wbsd_host *host) | ||
1991 | { | ||
1992 | BUG_ON(host == NULL); | ||
1993 | |||
1994 | wbsd_init_device(host); | ||
1995 | |||
1996 | return mmc_resume_host(host->mmc); | ||
1997 | } | ||
1998 | |||
1999 | static int wbsd_platform_suspend(struct platform_device *dev, pm_message_t state) | ||
1984 | { | 2000 | { |
1985 | struct mmc_host *mmc = platform_get_drvdata(dev); | 2001 | struct mmc_host *mmc = platform_get_drvdata(dev); |
1986 | struct wbsd_host *host; | 2002 | struct wbsd_host *host; |
1987 | int ret; | 2003 | int ret; |
1988 | 2004 | ||
1989 | if (!mmc) | 2005 | if (mmc == NULL) |
1990 | return 0; | 2006 | return 0; |
1991 | 2007 | ||
1992 | DBG("Suspending...\n"); | 2008 | DBGF("Suspending...\n"); |
1993 | |||
1994 | ret = mmc_suspend_host(mmc, state); | ||
1995 | if (!ret) | ||
1996 | return ret; | ||
1997 | 2009 | ||
1998 | host = mmc_priv(mmc); | 2010 | host = mmc_priv(mmc); |
1999 | 2011 | ||
2012 | ret = wbsd_suspend(host, state); | ||
2013 | if (ret) | ||
2014 | return ret; | ||
2015 | |||
2000 | wbsd_chip_poweroff(host); | 2016 | wbsd_chip_poweroff(host); |
2001 | 2017 | ||
2002 | return 0; | 2018 | return 0; |
2003 | } | 2019 | } |
2004 | 2020 | ||
2005 | static int wbsd_resume(struct platform_device *dev) | 2021 | static int wbsd_platform_resume(struct platform_device *dev) |
2006 | { | 2022 | { |
2007 | struct mmc_host *mmc = platform_get_drvdata(dev); | 2023 | struct mmc_host *mmc = platform_get_drvdata(dev); |
2008 | struct wbsd_host *host; | 2024 | struct wbsd_host *host; |
2009 | 2025 | ||
2010 | if (!mmc) | 2026 | if (mmc == NULL) |
2011 | return 0; | 2027 | return 0; |
2012 | 2028 | ||
2013 | DBG("Resuming...\n"); | 2029 | DBGF("Resuming...\n"); |
2014 | 2030 | ||
2015 | host = mmc_priv(mmc); | 2031 | host = mmc_priv(mmc); |
2016 | 2032 | ||
@@ -2021,15 +2037,70 @@ static int wbsd_resume(struct platform_device *dev) | |||
2021 | */ | 2037 | */ |
2022 | mdelay(5); | 2038 | mdelay(5); |
2023 | 2039 | ||
2024 | wbsd_init_device(host); | 2040 | return wbsd_resume(host); |
2041 | } | ||
2042 | |||
2043 | #ifdef CONFIG_PNP | ||
2044 | |||
2045 | static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state) | ||
2046 | { | ||
2047 | struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); | ||
2048 | struct wbsd_host *host; | ||
2049 | |||
2050 | if (mmc == NULL) | ||
2051 | return 0; | ||
2025 | 2052 | ||
2026 | return mmc_resume_host(mmc); | 2053 | DBGF("Suspending...\n"); |
2054 | |||
2055 | host = mmc_priv(mmc); | ||
2056 | |||
2057 | return wbsd_suspend(host, state); | ||
2027 | } | 2058 | } |
2028 | 2059 | ||
2060 | static int wbsd_pnp_resume(struct pnp_dev *pnp_dev) | ||
2061 | { | ||
2062 | struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); | ||
2063 | struct wbsd_host *host; | ||
2064 | |||
2065 | if (mmc == NULL) | ||
2066 | return 0; | ||
2067 | |||
2068 | DBGF("Resuming...\n"); | ||
2069 | |||
2070 | host = mmc_priv(mmc); | ||
2071 | |||
2072 | /* | ||
2073 | * See if chip needs to be configured. | ||
2074 | */ | ||
2075 | if (host->config != 0) | ||
2076 | { | ||
2077 | if (!wbsd_chip_validate(host)) | ||
2078 | { | ||
2079 | printk(KERN_WARNING DRIVER_NAME | ||
2080 | ": PnP active but chip not configured! " | ||
2081 | "You probably have a buggy BIOS. " | ||
2082 | "Configuring chip manually.\n"); | ||
2083 | wbsd_chip_config(host); | ||
2084 | } | ||
2085 | } | ||
2086 | |||
2087 | /* | ||
2088 | * Allow device to initialise itself properly. | ||
2089 | */ | ||
2090 | mdelay(5); | ||
2091 | |||
2092 | return wbsd_resume(host); | ||
2093 | } | ||
2094 | |||
2095 | #endif /* CONFIG_PNP */ | ||
2096 | |||
2029 | #else /* CONFIG_PM */ | 2097 | #else /* CONFIG_PM */ |
2030 | 2098 | ||
2031 | #define wbsd_suspend NULL | 2099 | #define wbsd_platform_suspend NULL |
2032 | #define wbsd_resume NULL | 2100 | #define wbsd_platform_resume NULL |
2101 | |||
2102 | #define wbsd_pnp_suspend NULL | ||
2103 | #define wbsd_pnp_resume NULL | ||
2033 | 2104 | ||
2034 | #endif /* CONFIG_PM */ | 2105 | #endif /* CONFIG_PM */ |
2035 | 2106 | ||
@@ -2039,8 +2110,8 @@ static struct platform_driver wbsd_driver = { | |||
2039 | .probe = wbsd_probe, | 2110 | .probe = wbsd_probe, |
2040 | .remove = __devexit_p(wbsd_remove), | 2111 | .remove = __devexit_p(wbsd_remove), |
2041 | 2112 | ||
2042 | .suspend = wbsd_suspend, | 2113 | .suspend = wbsd_platform_suspend, |
2043 | .resume = wbsd_resume, | 2114 | .resume = wbsd_platform_resume, |
2044 | .driver = { | 2115 | .driver = { |
2045 | .name = DRIVER_NAME, | 2116 | .name = DRIVER_NAME, |
2046 | }, | 2117 | }, |
@@ -2053,6 +2124,9 @@ static struct pnp_driver wbsd_pnp_driver = { | |||
2053 | .id_table = pnp_dev_table, | 2124 | .id_table = pnp_dev_table, |
2054 | .probe = wbsd_pnp_probe, | 2125 | .probe = wbsd_pnp_probe, |
2055 | .remove = __devexit_p(wbsd_pnp_remove), | 2126 | .remove = __devexit_p(wbsd_pnp_remove), |
2127 | |||
2128 | .suspend = wbsd_pnp_suspend, | ||
2129 | .resume = wbsd_pnp_resume, | ||
2056 | }; | 2130 | }; |
2057 | 2131 | ||
2058 | #endif /* CONFIG_PNP */ | 2132 | #endif /* CONFIG_PNP */ |