diff options
Diffstat (limited to 'drivers/media/video/marvell-ccic/mmp-driver.c')
-rw-r--r-- | drivers/media/video/marvell-ccic/mmp-driver.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c index fb0b124b35f3..0d64e2d7474a 100644 --- a/drivers/media/video/marvell-ccic/mmp-driver.c +++ b/drivers/media/video/marvell-ccic/mmp-driver.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
29 | #include <linux/pm.h> | ||
29 | 30 | ||
30 | #include "mcam-core.h" | 31 | #include "mcam-core.h" |
31 | 32 | ||
@@ -310,10 +311,44 @@ static int mmpcam_platform_remove(struct platform_device *pdev) | |||
310 | return mmpcam_remove(cam); | 311 | return mmpcam_remove(cam); |
311 | } | 312 | } |
312 | 313 | ||
314 | /* | ||
315 | * Suspend/resume support. | ||
316 | */ | ||
317 | #ifdef CONFIG_PM | ||
318 | |||
319 | static int mmpcam_suspend(struct platform_device *pdev, pm_message_t state) | ||
320 | { | ||
321 | struct mmp_camera *cam = mmpcam_find_device(pdev); | ||
322 | |||
323 | if (state.event != PM_EVENT_SUSPEND) | ||
324 | return 0; | ||
325 | mccic_suspend(&cam->mcam); | ||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static int mmpcam_resume(struct platform_device *pdev) | ||
330 | { | ||
331 | struct mmp_camera *cam = mmpcam_find_device(pdev); | ||
332 | |||
333 | /* | ||
334 | * Power up unconditionally just in case the core tries to | ||
335 | * touch a register even if nothing was active before; trust | ||
336 | * me, it's better this way. | ||
337 | */ | ||
338 | mmpcam_power_up(&cam->mcam); | ||
339 | return mccic_resume(&cam->mcam); | ||
340 | } | ||
341 | |||
342 | #endif | ||
343 | |||
313 | 344 | ||
314 | static struct platform_driver mmpcam_driver = { | 345 | static struct platform_driver mmpcam_driver = { |
315 | .probe = mmpcam_probe, | 346 | .probe = mmpcam_probe, |
316 | .remove = mmpcam_platform_remove, | 347 | .remove = mmpcam_platform_remove, |
348 | #ifdef CONFIG_PM | ||
349 | .suspend = mmpcam_suspend, | ||
350 | .resume = mmpcam_resume, | ||
351 | #endif | ||
317 | .driver = { | 352 | .driver = { |
318 | .name = "mmp-camera", | 353 | .name = "mmp-camera", |
319 | .owner = THIS_MODULE | 354 | .owner = THIS_MODULE |