diff options
author | Saeed Bishara <saeed@marvell.com> | 2009-12-06 11:26:19 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-12-17 00:56:59 -0500 |
commit | 6481f2b52cd5411ea6342b749daf0e4f3b390d7b (patch) | |
tree | 7ce843a328f536eaaa8ee475107dc9108646470b /drivers | |
parent | c77a2f4e6b76c9094182dfa653ece4243f6df80c (diff) |
sata_mv: add power management support for the platform driver
Signed-off-by: Saeed Bishara <saeed@marvell.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rwxr-xr-x[-rw-r--r--] | drivers/ata/sata_mv.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index b625b3614989..0f7704c0b4cc 100644..100755 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4112,9 +4112,52 @@ static int __devexit mv_platform_remove(struct platform_device *pdev) | |||
4112 | return 0; | 4112 | return 0; |
4113 | } | 4113 | } |
4114 | 4114 | ||
4115 | #ifdef CONFIG_PM | ||
4116 | static int mv_platform_suspend(struct platform_device *pdev, pm_message_t state) | ||
4117 | { | ||
4118 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
4119 | if (host) | ||
4120 | return ata_host_suspend(host, state); | ||
4121 | else | ||
4122 | return 0; | ||
4123 | } | ||
4124 | |||
4125 | static int mv_platform_resume(struct platform_device *pdev) | ||
4126 | { | ||
4127 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
4128 | int ret; | ||
4129 | |||
4130 | if (host) { | ||
4131 | struct mv_host_priv *hpriv = host->private_data; | ||
4132 | const struct mv_sata_platform_data *mv_platform_data = \ | ||
4133 | pdev->dev.platform_data; | ||
4134 | /* | ||
4135 | * (Re-)program MBUS remapping windows if we are asked to. | ||
4136 | */ | ||
4137 | if (mv_platform_data->dram != NULL) | ||
4138 | mv_conf_mbus_windows(hpriv, mv_platform_data->dram); | ||
4139 | |||
4140 | /* initialize adapter */ | ||
4141 | ret = mv_init_host(host, chip_soc); | ||
4142 | if (ret) { | ||
4143 | printk(KERN_ERR DRV_NAME ": Error during HW init\n"); | ||
4144 | return ret; | ||
4145 | } | ||
4146 | ata_host_resume(host); | ||
4147 | } | ||
4148 | |||
4149 | return 0; | ||
4150 | } | ||
4151 | #else | ||
4152 | #define mv_platform_suspend NULL | ||
4153 | #define mv_platform_resume NULL | ||
4154 | #endif | ||
4155 | |||
4115 | static struct platform_driver mv_platform_driver = { | 4156 | static struct platform_driver mv_platform_driver = { |
4116 | .probe = mv_platform_probe, | 4157 | .probe = mv_platform_probe, |
4117 | .remove = __devexit_p(mv_platform_remove), | 4158 | .remove = __devexit_p(mv_platform_remove), |
4159 | .suspend = mv_platform_suspend, | ||
4160 | .resume = mv_platform_resume, | ||
4118 | .driver = { | 4161 | .driver = { |
4119 | .name = DRV_NAME, | 4162 | .name = DRV_NAME, |
4120 | .owner = THIS_MODULE, | 4163 | .owner = THIS_MODULE, |