diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-25 11:36:28 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-25 11:36:28 -0300 |
commit | 52b4436f698bfa9b1a168f77b516b15c27245ba4 (patch) | |
tree | 1ad4e9a232b0a6b47eb244dbccdc83c27dde4a40 /linux/drivers/media/video | |
parent | 032d2024e65ea39e6c54936f3d299fe6ab9b2120 (diff) | |
download | mediapointer-dvb-s2-52b4436f698bfa9b1a168f77b516b15c27245ba4.tar.gz mediapointer-dvb-s2-52b4436f698bfa9b1a168f77b516b15c27245ba4.tar.bz2 |
4/7 Add suspend/resume support to the Cafe CCIC
From: Jonathan Corbet <corbet@lwn.net>
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 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/cafe_ccic.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c index aa84c90ce..ea69590a1 100644 --- a/linux/drivers/media/video/cafe_ccic.c +++ b/linux/drivers/media/video/cafe_ccic.c @@ -38,7 +38,7 @@ #include "cafe_ccic-regs.h" -#define CAFE_VERSION 0x000001 +#define CAFE_VERSION 0x000002 /* @@ -2195,6 +2195,45 @@ static void cafe_pci_remove(struct pci_dev *pdev) } +#ifdef CONFIG_PM +/* + * Basic power management. + */ +static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct cafe_camera *cam = cafe_find_by_pdev(pdev); + int ret; + + ret = pci_save_state(pdev); + if (ret) + return ret; + cafe_ctlr_stop_dma(cam); + cafe_ctlr_power_down(cam); + pci_disable_device(pdev); + return 0; +} + + +static int cafe_pci_resume(struct pci_dev *pdev) +{ + struct cafe_camera *cam = cafe_find_by_pdev(pdev); + int ret = 0; + + ret = pci_restore_state(pdev); + if (ret) + return ret; + pci_enable_device(pdev); + cafe_ctlr_init(cam); + cafe_ctlr_power_up(cam); + set_bit(CF_CONFIG_NEEDED, &cam->flags); + if (cam->state == S_SPECREAD) + cam->state = S_IDLE; /* Don't bother restarting */ + else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) + ret = cafe_read_setup(cam, cam->state); + return ret; +} + +#endif /* CONFIG_PM */ static struct pci_device_id cafe_ids[] = { @@ -2210,6 +2249,10 @@ static struct pci_driver cafe_pci_driver = { .id_table = cafe_ids, .probe = cafe_pci_probe, .remove = cafe_pci_remove, +#ifdef CONFIG_PM + .suspend = cafe_pci_suspend, + .resume = cafe_pci_resume, +#endif }; |