aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cafe_ccic.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2007-03-25 10:36:28 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:04 -0400
commitff68defa08376b6c0482b249b7dfd35241861bce (patch)
tree0ba01672c2c3900e61ddd8fd3a8d2c5736a31fa0 /drivers/media/video/cafe_ccic.c
parent5b50ed7ca2432e7ea3caf8cc2ef5ac805c082519 (diff)
V4L/DVB (5467): Add suspend/resume support to the Cafe CCIC
Add suspend/resume support to the Cafe CCIC driver. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cafe_ccic.c')
-rw-r--r--drivers/media/video/cafe_ccic.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index bfae5d2fd744..4aa360b89ada 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -37,7 +37,7 @@
37 37
38#include "cafe_ccic-regs.h" 38#include "cafe_ccic-regs.h"
39 39
40#define CAFE_VERSION 0x000001 40#define CAFE_VERSION 0x000002
41 41
42 42
43/* 43/*
@@ -2188,6 +2188,45 @@ static void cafe_pci_remove(struct pci_dev *pdev)
2188} 2188}
2189 2189
2190 2190
2191#ifdef CONFIG_PM
2192/*
2193 * Basic power management.
2194 */
2195static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2196{
2197 struct cafe_camera *cam = cafe_find_by_pdev(pdev);
2198 int ret;
2199
2200 ret = pci_save_state(pdev);
2201 if (ret)
2202 return ret;
2203 cafe_ctlr_stop_dma(cam);
2204 cafe_ctlr_power_down(cam);
2205 pci_disable_device(pdev);
2206 return 0;
2207}
2208
2209
2210static int cafe_pci_resume(struct pci_dev *pdev)
2211{
2212 struct cafe_camera *cam = cafe_find_by_pdev(pdev);
2213 int ret = 0;
2214
2215 ret = pci_restore_state(pdev);
2216 if (ret)
2217 return ret;
2218 pci_enable_device(pdev);
2219 cafe_ctlr_init(cam);
2220 cafe_ctlr_power_up(cam);
2221 set_bit(CF_CONFIG_NEEDED, &cam->flags);
2222 if (cam->state == S_SPECREAD)
2223 cam->state = S_IDLE; /* Don't bother restarting */
2224 else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING)
2225 ret = cafe_read_setup(cam, cam->state);
2226 return ret;
2227}
2228
2229#endif /* CONFIG_PM */
2191 2230
2192 2231
2193static struct pci_device_id cafe_ids[] = { 2232static struct pci_device_id cafe_ids[] = {
@@ -2203,6 +2242,10 @@ static struct pci_driver cafe_pci_driver = {
2203 .id_table = cafe_ids, 2242 .id_table = cafe_ids,
2204 .probe = cafe_pci_probe, 2243 .probe = cafe_pci_probe,
2205 .remove = cafe_pci_remove, 2244 .remove = cafe_pci_remove,
2245#ifdef CONFIG_PM
2246 .suspend = cafe_pci_suspend,
2247 .resume = cafe_pci_resume,
2248#endif
2206}; 2249};
2207 2250
2208 2251