aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
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
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')
-rw-r--r--drivers/media/video/gspca/conex.c4
-rw-r--r--drivers/media/video/gspca/etoms.c4
-rw-r--r--drivers/media/video/gspca/gspca.c30
-rw-r--r--drivers/media/video/gspca/gspca.h7
-rw-r--r--drivers/media/video/gspca/mars.c4
-rw-r--r--drivers/media/video/gspca/ov519.c4
-rw-r--r--drivers/media/video/gspca/pac207.c4
-rw-r--r--drivers/media/video/gspca/pac7311.c4
-rw-r--r--drivers/media/video/gspca/sonixb.c4
-rw-r--r--drivers/media/video/gspca/sonixj.c4
-rw-r--r--drivers/media/video/gspca/spca500.c4
-rw-r--r--drivers/media/video/gspca/spca501.c4
-rw-r--r--drivers/media/video/gspca/spca505.c4
-rw-r--r--drivers/media/video/gspca/spca506.c4
-rw-r--r--drivers/media/video/gspca/spca508.c4
-rw-r--r--drivers/media/video/gspca/spca561.c4
-rw-r--r--drivers/media/video/gspca/stk014.c4
-rw-r--r--drivers/media/video/gspca/sunplus.c4
-rw-r--r--drivers/media/video/gspca/t613.c4
-rw-r--r--drivers/media/video/gspca/tv8532.c4
-rw-r--r--drivers/media/video/gspca/vc032x.c4
-rw-r--r--drivers/media/video/gspca/zc3xx.c4
22 files changed, 116 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index cd3a3f5829b2..739ef557c434 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -1026,6 +1026,10 @@ static struct usb_driver sd_driver = {
1026 .id_table = device_table, 1026 .id_table = device_table,
1027 .probe = sd_probe, 1027 .probe = sd_probe,
1028 .disconnect = gspca_disconnect, 1028 .disconnect = gspca_disconnect,
1029#ifdef CONFIG_PM
1030 .suspend = gspca_suspend,
1031 .resume = gspca_resume,
1032#endif
1029}; 1033};
1030 1034
1031/* -- module insert / remove -- */ 1035/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index ca23c3f9aaa2..a3cccab7b814 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -926,6 +926,10 @@ static struct usb_driver sd_driver = {
926 .id_table = device_table, 926 .id_table = device_table,
927 .probe = sd_probe, 927 .probe = sd_probe,
928 .disconnect = gspca_disconnect, 928 .disconnect = gspca_disconnect,
929#ifdef CONFIG_PM
930 .suspend = gspca_suspend,
931 .resume = gspca_resume,
932#endif
929}; 933};
930 934
931/* -- module insert / remove -- */ 935/* -- module insert / remove -- */
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:
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 5cb584546ee6..2596568e82fd 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -154,6 +154,9 @@ struct gspca_dev {
154 struct mutex queue_lock; /* ISOC queue protection */ 154 struct mutex queue_lock; /* ISOC queue protection */
155 __u32 sequence; /* frame sequence number */ 155 __u32 sequence; /* frame sequence number */
156 char streaming; 156 char streaming;
157#ifdef CONFIG_PM
158 char frozen; /* suspend - resume */
159#endif
157 char users; /* number of opens */ 160 char users; /* number of opens */
158 char present; /* device connected */ 161 char present; /* device connected */
159 char nbufread; /* number of buffers for read() */ 162 char nbufread; /* number of buffers for read() */
@@ -173,6 +176,10 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
173 struct gspca_frame *frame, 176 struct gspca_frame *frame,
174 const __u8 *data, 177 const __u8 *data,
175 int len); 178 int len);
179#ifdef CONFIG_PM
180int gspca_suspend(struct usb_interface *intf, pm_message_t message);
181int gspca_resume(struct usb_interface *intf);
182#endif
176int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum, 183int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum,
177 int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee); 184 int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee);
178#endif /* GSPCAV2_H */ 185#endif /* GSPCAV2_H */
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 21c4ee56a10a..d7e209578186 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -439,6 +439,10 @@ static struct usb_driver sd_driver = {
439 .id_table = device_table, 439 .id_table = device_table,
440 .probe = sd_probe, 440 .probe = sd_probe,
441 .disconnect = gspca_disconnect, 441 .disconnect = gspca_disconnect,
442#ifdef CONFIG_PM
443 .suspend = gspca_suspend,
444 .resume = gspca_resume,
445#endif
442}; 446};
443 447
444/* -- module insert / remove -- */ 448/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index b4f00ec0885c..c132f8d2cf05 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -2132,6 +2132,10 @@ static struct usb_driver sd_driver = {
2132 .id_table = device_table, 2132 .id_table = device_table,
2133 .probe = sd_probe, 2133 .probe = sd_probe,
2134 .disconnect = gspca_disconnect, 2134 .disconnect = gspca_disconnect,
2135#ifdef CONFIG_PM
2136 .suspend = gspca_suspend,
2137 .resume = gspca_resume,
2138#endif
2135}; 2139};
2136 2140
2137/* -- module insert / remove -- */ 2141/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index cee45b0486cb..d9668f4cb4d1 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -596,6 +596,10 @@ static struct usb_driver sd_driver = {
596 .id_table = device_table, 596 .id_table = device_table,
597 .probe = sd_probe, 597 .probe = sd_probe,
598 .disconnect = gspca_disconnect, 598 .disconnect = gspca_disconnect,
599#ifdef CONFIG_PM
600 .suspend = gspca_suspend,
601 .resume = gspca_resume,
602#endif
599}; 603};
600 604
601/* -- module insert / remove -- */ 605/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index e4f56e0d3ff3..4cc9379ee411 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -936,6 +936,10 @@ static struct usb_driver sd_driver = {
936 .id_table = device_table, 936 .id_table = device_table,
937 .probe = sd_probe, 937 .probe = sd_probe,
938 .disconnect = gspca_disconnect, 938 .disconnect = gspca_disconnect,
939#ifdef CONFIG_PM
940 .suspend = gspca_suspend,
941 .resume = gspca_resume,
942#endif
939}; 943};
940 944
941/* -- module insert / remove -- */ 945/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 11210c71f66c..e535ced79f16 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -1231,6 +1231,10 @@ static struct usb_driver sd_driver = {
1231 .id_table = device_table, 1231 .id_table = device_table,
1232 .probe = sd_probe, 1232 .probe = sd_probe,
1233 .disconnect = gspca_disconnect, 1233 .disconnect = gspca_disconnect,
1234#ifdef CONFIG_PM
1235 .suspend = gspca_suspend,
1236 .resume = gspca_resume,
1237#endif
1234}; 1238};
1235 1239
1236/* -- module insert / remove -- */ 1240/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 11a29a969602..0d4677688c91 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -1617,6 +1617,10 @@ static struct usb_driver sd_driver = {
1617 .id_table = device_table, 1617 .id_table = device_table,
1618 .probe = sd_probe, 1618 .probe = sd_probe,
1619 .disconnect = gspca_disconnect, 1619 .disconnect = gspca_disconnect,
1620#ifdef CONFIG_PM
1621 .suspend = gspca_suspend,
1622 .resume = gspca_resume,
1623#endif
1620}; 1624};
1621 1625
1622/* -- module insert / remove -- */ 1626/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 17fe2c2a440d..5a20385fb170 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -1093,6 +1093,10 @@ static struct usb_driver sd_driver = {
1093 .id_table = device_table, 1093 .id_table = device_table,
1094 .probe = sd_probe, 1094 .probe = sd_probe,
1095 .disconnect = gspca_disconnect, 1095 .disconnect = gspca_disconnect,
1096#ifdef CONFIG_PM
1097 .suspend = gspca_suspend,
1098 .resume = gspca_resume,
1099#endif
1096}; 1100};
1097 1101
1098/* -- module insert / remove -- */ 1102/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 51a3c3429ef0..525f1b3400e4 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -2154,6 +2154,10 @@ static struct usb_driver sd_driver = {
2154 .id_table = device_table, 2154 .id_table = device_table,
2155 .probe = sd_probe, 2155 .probe = sd_probe,
2156 .disconnect = gspca_disconnect, 2156 .disconnect = gspca_disconnect,
2157#ifdef CONFIG_PM
2158 .suspend = gspca_suspend,
2159 .resume = gspca_resume,
2160#endif
2157}; 2161};
2158 2162
2159/* -- module insert / remove -- */ 2163/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index eda29d609359..8f00558c2f59 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -855,6 +855,10 @@ static struct usb_driver sd_driver = {
855 .id_table = device_table, 855 .id_table = device_table,
856 .probe = sd_probe, 856 .probe = sd_probe,
857 .disconnect = gspca_disconnect, 857 .disconnect = gspca_disconnect,
858#ifdef CONFIG_PM
859 .suspend = gspca_suspend,
860 .resume = gspca_resume,
861#endif
858}; 862};
859 863
860/* -- module insert / remove -- */ 864/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index f622fa75766d..ae772488cf73 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -772,6 +772,10 @@ static struct usb_driver sd_driver = {
772 .id_table = device_table, 772 .id_table = device_table,
773 .probe = sd_probe, 773 .probe = sd_probe,
774 .disconnect = gspca_disconnect, 774 .disconnect = gspca_disconnect,
775#ifdef CONFIG_PM
776 .suspend = gspca_suspend,
777 .resume = gspca_resume,
778#endif
775}; 779};
776 780
777/* -- module insert / remove -- */ 781/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 699340c17dea..7b38c4e70fdf 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1667,6 +1667,10 @@ static struct usb_driver sd_driver = {
1667 .id_table = device_table, 1667 .id_table = device_table,
1668 .probe = sd_probe, 1668 .probe = sd_probe,
1669 .disconnect = gspca_disconnect, 1669 .disconnect = gspca_disconnect,
1670#ifdef CONFIG_PM
1671 .suspend = gspca_suspend,
1672 .resume = gspca_resume,
1673#endif
1670}; 1674};
1671 1675
1672/* -- module insert / remove -- */ 1676/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index ec575f5672df..b6a013f1dec4 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1184,6 +1184,10 @@ static struct usb_driver sd_driver = {
1184 .id_table = device_table, 1184 .id_table = device_table,
1185 .probe = sd_probe, 1185 .probe = sd_probe,
1186 .disconnect = gspca_disconnect, 1186 .disconnect = gspca_disconnect,
1187#ifdef CONFIG_PM
1188 .suspend = gspca_suspend,
1189 .resume = gspca_resume,
1190#endif
1187}; 1191};
1188 1192
1189/* -- module insert / remove -- */ 1193/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 16219cf6a6d5..387a8cf2b3b1 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -564,6 +564,10 @@ static struct usb_driver sd_driver = {
564 .id_table = device_table, 564 .id_table = device_table,
565 .probe = sd_probe, 565 .probe = sd_probe,
566 .disconnect = gspca_disconnect, 566 .disconnect = gspca_disconnect,
567#ifdef CONFIG_PM
568 .suspend = gspca_suspend,
569 .resume = gspca_resume,
570#endif
567}; 571};
568 572
569/* -- module insert / remove -- */ 573/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index 54efa48bee01..c935384fc232 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -1456,6 +1456,10 @@ static struct usb_driver sd_driver = {
1456 .id_table = device_table, 1456 .id_table = device_table,
1457 .probe = sd_probe, 1457 .probe = sd_probe,
1458 .disconnect = gspca_disconnect, 1458 .disconnect = gspca_disconnect,
1459#ifdef CONFIG_PM
1460 .suspend = gspca_suspend,
1461 .resume = gspca_resume,
1462#endif
1459}; 1463};
1460 1464
1461/* -- module insert / remove -- */ 1465/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index fd6918eefbb0..357a2edad21e 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1014,6 +1014,10 @@ static struct usb_driver sd_driver = {
1014 .id_table = device_table, 1014 .id_table = device_table,
1015 .probe = sd_probe, 1015 .probe = sd_probe,
1016 .disconnect = gspca_disconnect, 1016 .disconnect = gspca_disconnect,
1017#ifdef CONFIG_PM
1018 .suspend = gspca_suspend,
1019 .resume = gspca_resume,
1020#endif
1017}; 1021};
1018 1022
1019/* -- module insert / remove -- */ 1023/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 1ff8ba2f7fe5..d2273624a91d 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -644,6 +644,10 @@ static struct usb_driver sd_driver = {
644 .id_table = device_table, 644 .id_table = device_table,
645 .probe = sd_probe, 645 .probe = sd_probe,
646 .disconnect = gspca_disconnect, 646 .disconnect = gspca_disconnect,
647#ifdef CONFIG_PM
648 .suspend = gspca_suspend,
649 .resume = gspca_resume,
650#endif
647}; 651};
648 652
649/* -- module insert / remove -- */ 653/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index f4a52956e0d9..47c7ce641d99 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -1774,6 +1774,10 @@ static struct usb_driver sd_driver = {
1774 .id_table = device_table, 1774 .id_table = device_table,
1775 .probe = sd_probe, 1775 .probe = sd_probe,
1776 .disconnect = gspca_disconnect, 1776 .disconnect = gspca_disconnect,
1777#ifdef CONFIG_PM
1778 .suspend = gspca_suspend,
1779 .resume = gspca_resume,
1780#endif
1777}; 1781};
1778 1782
1779/* -- module insert / remove -- */ 1783/* -- module insert / remove -- */
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index d36f4d7d22b7..79436f27cd4e 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -7584,6 +7584,10 @@ static struct usb_driver sd_driver = {
7584 .id_table = device_table, 7584 .id_table = device_table,
7585 .probe = sd_probe, 7585 .probe = sd_probe,
7586 .disconnect = gspca_disconnect, 7586 .disconnect = gspca_disconnect,
7587#ifdef CONFIG_PM
7588 .suspend = gspca_suspend,
7589 .resume = gspca_resume,
7590#endif
7587}; 7591};
7588 7592
7589static int __init sd_mod_init(void) 7593static int __init sd_mod_init(void)