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>
This commit is contained in:
parent
5d05294ac8
commit
6a70974922
|
@ -1026,6 +1026,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -926,6 +926,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -114,7 +114,8 @@ static void fill_frame(struct gspca_dev *gspca_dev,
|
|||
cam_pkt_op pkt_scan;
|
||||
|
||||
if (urb->status != 0) {
|
||||
PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
|
||||
if (!gspca_dev->frozen)
|
||||
PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
|
||||
return; /* disconnection ? */
|
||||
}
|
||||
pkt_scan = gspca_dev->sd_desc->pkt_scan;
|
||||
|
@ -1808,6 +1809,33 @@ void gspca_disconnect(struct usb_interface *intf)
|
|||
}
|
||||
EXPORT_SYMBOL(gspca_disconnect);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int gspca_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
{
|
||||
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
|
||||
|
||||
if (!gspca_dev->streaming)
|
||||
return 0;
|
||||
gspca_dev->frozen = 1; /* avoid urb error messages */
|
||||
gspca_dev->sd_desc->stopN(gspca_dev);
|
||||
destroy_urbs(gspca_dev);
|
||||
gspca_set_alt0(gspca_dev);
|
||||
gspca_dev->sd_desc->stop0(gspca_dev);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(gspca_suspend);
|
||||
|
||||
int gspca_resume(struct usb_interface *intf)
|
||||
{
|
||||
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
|
||||
|
||||
gspca_dev->frozen = 0;
|
||||
if (!gspca_dev->streaming)
|
||||
return 0;
|
||||
return gspca_init_transfer(gspca_dev);
|
||||
}
|
||||
EXPORT_SYMBOL(gspca_resume);
|
||||
#endif
|
||||
/* -- cam driver utility functions -- */
|
||||
|
||||
/* auto gain and exposure algorithm based on the knee algorithm described here:
|
||||
|
|
|
@ -154,6 +154,9 @@ struct gspca_dev {
|
|||
struct mutex queue_lock; /* ISOC queue protection */
|
||||
__u32 sequence; /* frame sequence number */
|
||||
char streaming;
|
||||
#ifdef CONFIG_PM
|
||||
char frozen; /* suspend - resume */
|
||||
#endif
|
||||
char users; /* number of opens */
|
||||
char present; /* device connected */
|
||||
char nbufread; /* number of buffers for read() */
|
||||
|
@ -173,6 +176,10 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
|
|||
struct gspca_frame *frame,
|
||||
const __u8 *data,
|
||||
int len);
|
||||
#ifdef CONFIG_PM
|
||||
int gspca_suspend(struct usb_interface *intf, pm_message_t message);
|
||||
int gspca_resume(struct usb_interface *intf);
|
||||
#endif
|
||||
int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum,
|
||||
int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee);
|
||||
#endif /* GSPCAV2_H */
|
||||
|
|
|
@ -439,6 +439,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -2132,6 +2132,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -596,6 +596,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -936,6 +936,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1231,6 +1231,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1617,6 +1617,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1093,6 +1093,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -2154,6 +2154,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -855,6 +855,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -772,6 +772,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1667,6 +1667,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1184,6 +1184,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -564,6 +564,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1456,6 +1456,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1014,6 +1014,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -644,6 +644,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -1774,6 +1774,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -- module insert / remove -- */
|
||||
|
|
|
@ -7584,6 +7584,10 @@ static struct usb_driver sd_driver = {
|
|||
.id_table = device_table,
|
||||
.probe = sd_probe,
|
||||
.disconnect = gspca_disconnect,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = gspca_suspend,
|
||||
.resume = gspca_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int __init sd_mod_init(void)
|
||||
|
|
Loading…
Reference in New Issue