Commit 5e68d95d authored by Pierre Ossman's avatar Pierre Ossman Committed by Russell King

[MMC] wbsd pnp suspend

Allow the wbsd driver to use the new suspend/resume functions added to
the PnP layer.
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent b9abaa3f
...@@ -1980,37 +1980,53 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev) ...@@ -1980,37 +1980,53 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int wbsd_suspend(struct platform_device *dev, pm_message_t state) static int wbsd_suspend(struct wbsd_host *host, pm_message_t state)
{
BUG_ON(host == NULL);
return mmc_suspend_host(host->mmc, state);
}
static int wbsd_resume(struct wbsd_host *host)
{
BUG_ON(host == NULL);
wbsd_init_device(host);
return mmc_resume_host(host->mmc);
}
static int wbsd_platform_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct mmc_host *mmc = platform_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
struct wbsd_host *host; struct wbsd_host *host;
int ret; int ret;
if (!mmc) if (mmc == NULL)
return 0; return 0;
DBG("Suspending...\n"); DBGF("Suspending...\n");
ret = mmc_suspend_host(mmc, state);
if (!ret)
return ret;
host = mmc_priv(mmc); host = mmc_priv(mmc);
ret = wbsd_suspend(host, state);
if (ret)
return ret;
wbsd_chip_poweroff(host); wbsd_chip_poweroff(host);
return 0; return 0;
} }
static int wbsd_resume(struct platform_device *dev) static int wbsd_platform_resume(struct platform_device *dev)
{ {
struct mmc_host *mmc = platform_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
struct wbsd_host *host; struct wbsd_host *host;
if (!mmc) if (mmc == NULL)
return 0; return 0;
DBG("Resuming...\n"); DBGF("Resuming...\n");
host = mmc_priv(mmc); host = mmc_priv(mmc);
...@@ -2021,15 +2037,70 @@ static int wbsd_resume(struct platform_device *dev) ...@@ -2021,15 +2037,70 @@ static int wbsd_resume(struct platform_device *dev)
*/ */
mdelay(5); mdelay(5);
wbsd_init_device(host); return wbsd_resume(host);
}
#ifdef CONFIG_PNP
static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state)
{
struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev);
struct wbsd_host *host;
if (mmc == NULL)
return 0;
return mmc_resume_host(mmc); DBGF("Suspending...\n");
host = mmc_priv(mmc);
return wbsd_suspend(host, state);
} }
static int wbsd_pnp_resume(struct pnp_dev *pnp_dev)
{
struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev);
struct wbsd_host *host;
if (mmc == NULL)
return 0;
DBGF("Resuming...\n");
host = mmc_priv(mmc);
/*
* See if chip needs to be configured.
*/
if (host->config != 0)
{
if (!wbsd_chip_validate(host))
{
printk(KERN_WARNING DRIVER_NAME
": PnP active but chip not configured! "
"You probably have a buggy BIOS. "
"Configuring chip manually.\n");
wbsd_chip_config(host);
}
}
/*
* Allow device to initialise itself properly.
*/
mdelay(5);
return wbsd_resume(host);
}
#endif /* CONFIG_PNP */
#else /* CONFIG_PM */ #else /* CONFIG_PM */
#define wbsd_suspend NULL #define wbsd_platform_suspend NULL
#define wbsd_resume NULL #define wbsd_platform_resume NULL
#define wbsd_pnp_suspend NULL
#define wbsd_pnp_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
...@@ -2039,8 +2110,8 @@ static struct platform_driver wbsd_driver = { ...@@ -2039,8 +2110,8 @@ static struct platform_driver wbsd_driver = {
.probe = wbsd_probe, .probe = wbsd_probe,
.remove = __devexit_p(wbsd_remove), .remove = __devexit_p(wbsd_remove),
.suspend = wbsd_suspend, .suspend = wbsd_platform_suspend,
.resume = wbsd_resume, .resume = wbsd_platform_resume,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
}, },
...@@ -2053,6 +2124,9 @@ static struct pnp_driver wbsd_pnp_driver = { ...@@ -2053,6 +2124,9 @@ static struct pnp_driver wbsd_pnp_driver = {
.id_table = pnp_dev_table, .id_table = pnp_dev_table,
.probe = wbsd_pnp_probe, .probe = wbsd_pnp_probe,
.remove = __devexit_p(wbsd_pnp_remove), .remove = __devexit_p(wbsd_pnp_remove),
.suspend = wbsd_pnp_suspend,
.resume = wbsd_pnp_resume,
}; };
#endif /* CONFIG_PNP */ #endif /* CONFIG_PNP */
......
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