提交 9b0ae867 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

V4L/DVB (8754): uvcvideo: Implement the USB power management reset_resume method.

When a suspended device has been reset instead of being resumed, USB core
calls the reset_resume method if available instead of unbinding and rebinding
the device.

This patch implements reset_resume by reusing the current resume
implementation and simplifies the resume method by skipping the controls
restore stage. Resuming from autosuspend should be faster.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 14d96260
...@@ -1663,7 +1663,7 @@ static int uvc_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -1663,7 +1663,7 @@ static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
return uvc_video_suspend(&dev->video); return uvc_video_suspend(&dev->video);
} }
static int uvc_resume(struct usb_interface *intf) static int __uvc_resume(struct usb_interface *intf, int reset)
{ {
struct uvc_device *dev = usb_get_intfdata(intf); struct uvc_device *dev = usb_get_intfdata(intf);
int ret; int ret;
...@@ -1672,7 +1672,7 @@ static int uvc_resume(struct usb_interface *intf) ...@@ -1672,7 +1672,7 @@ static int uvc_resume(struct usb_interface *intf)
intf->cur_altsetting->desc.bInterfaceNumber); intf->cur_altsetting->desc.bInterfaceNumber);
if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) { if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) {
if ((ret = uvc_ctrl_resume_device(dev)) < 0) if (reset && (ret = uvc_ctrl_resume_device(dev)) < 0)
return ret; return ret;
return uvc_status_resume(dev); return uvc_status_resume(dev);
...@@ -1687,6 +1687,16 @@ static int uvc_resume(struct usb_interface *intf) ...@@ -1687,6 +1687,16 @@ static int uvc_resume(struct usb_interface *intf)
return uvc_video_resume(&dev->video); return uvc_video_resume(&dev->video);
} }
static int uvc_resume(struct usb_interface *intf)
{
return __uvc_resume(intf, 0);
}
static int uvc_reset_resume(struct usb_interface *intf)
{
return __uvc_resume(intf, 1);
}
/* ------------------------------------------------------------------------ /* ------------------------------------------------------------------------
* Driver initialization and cleanup * Driver initialization and cleanup
*/ */
...@@ -1952,6 +1962,7 @@ struct uvc_driver uvc_driver = { ...@@ -1952,6 +1962,7 @@ struct uvc_driver uvc_driver = {
.disconnect = uvc_disconnect, .disconnect = uvc_disconnect,
.suspend = uvc_suspend, .suspend = uvc_suspend,
.resume = uvc_resume, .resume = uvc_resume,
.reset_resume = uvc_reset_resume,
.id_table = uvc_ids, .id_table = uvc_ids,
.supports_autosuspend = 1, .supports_autosuspend = 1,
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册