aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-09-03 15:48:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-03 17:36:58 -0400
commit6a709749228c5f76f128c69c16f39a52d639bd96 (patch)
tree1fffc8a2fc92674153c9d065d8a9d134caf3a507 /drivers/media/video/gspca/gspca.c
parent5d05294ac8f6b5d592ee3379fbddd0fb9d1b4c87 (diff)
V4L/DVB (8718): gspca: suspend/resume added.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 15d302b28b79..2f7bf263255c 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -114,7 +114,8 @@ static void fill_frame(struct gspca_dev *gspca_dev,
114 cam_pkt_op pkt_scan; 114 cam_pkt_op pkt_scan;
115 115
116 if (urb->status != 0) { 116 if (urb->status != 0) {
117 PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status); 117 if (!gspca_dev->frozen)
118 PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
118 return; /* disconnection ? */ 119 return; /* disconnection ? */
119 } 120 }
120 pkt_scan = gspca_dev->sd_desc->pkt_scan; 121 pkt_scan = gspca_dev->sd_desc->pkt_scan;
@@ -1808,6 +1809,33 @@ void gspca_disconnect(struct usb_interface *intf)
1808} 1809}
1809EXPORT_SYMBOL(gspca_disconnect); 1810EXPORT_SYMBOL(gspca_disconnect);
1810 1811
1812#ifdef CONFIG_PM
1813int gspca_suspend(struct usb_interface *intf, pm_message_t message)
1814{
1815 struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
1816
1817 if (!gspca_dev->streaming)
1818 return 0;
1819 gspca_dev->frozen = 1; /* avoid urb error messages */
1820 gspca_dev->sd_desc->stopN(gspca_dev);
1821 destroy_urbs(gspca_dev);
1822 gspca_set_alt0(gspca_dev);
1823 gspca_dev->sd_desc->stop0(gspca_dev);
1824 return 0;
1825}
1826EXPORT_SYMBOL(gspca_suspend);
1827
1828int gspca_resume(struct usb_interface *intf)
1829{
1830 struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
1831
1832 gspca_dev->frozen = 0;
1833 if (!gspca_dev->streaming)
1834 return 0;
1835 return gspca_init_transfer(gspca_dev);
1836}
1837EXPORT_SYMBOL(gspca_resume);
1838#endif
1811/* -- cam driver utility functions -- */ 1839/* -- cam driver utility functions -- */
1812 1840
1813/* auto gain and exposure algorithm based on the knee algorithm described here: 1841/* auto gain and exposure algorithm based on the knee algorithm described here: