diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-10-13 09:11:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-25 05:39:14 -0500 |
commit | b83bba24a29c44b696b5977e3874bc07b13dc3c0 (patch) | |
tree | 0379cb6f3b164dc253713c14e9246d7acee5af43 /drivers/media/usb/uvc/uvc_driver.c | |
parent | aa3d17df6470338223f7ae6893647453e8f8e98e (diff) |
[media] uvcvideo: Separate video and queue enable/disable operations
In order to make use of the vb2 queue start/stop_streaming operations
the video and queue enable/disable operations need to be split, as the
vb2 queue will need to enable and disable video instead of the other way
around.
Also move buffer queue disable outside of uvc_video_resume() to remove
all queue disable operations out of uvc_video.c.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_driver.c')
-rw-r--r-- | drivers/media/usb/uvc/uvc_driver.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 30163432a711..ab1e2fd0a599 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c | |||
@@ -1734,6 +1734,11 @@ static int uvc_register_video(struct uvc_device *dev, | |||
1734 | struct video_device *vdev; | 1734 | struct video_device *vdev; |
1735 | int ret; | 1735 | int ret; |
1736 | 1736 | ||
1737 | /* Initialize the video buffers queue. */ | ||
1738 | ret = uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param); | ||
1739 | if (ret) | ||
1740 | return ret; | ||
1741 | |||
1737 | /* Initialize the streaming interface with default streaming | 1742 | /* Initialize the streaming interface with default streaming |
1738 | * parameters. | 1743 | * parameters. |
1739 | */ | 1744 | */ |
@@ -2008,14 +2013,13 @@ static int __uvc_resume(struct usb_interface *intf, int reset) | |||
2008 | { | 2013 | { |
2009 | struct uvc_device *dev = usb_get_intfdata(intf); | 2014 | struct uvc_device *dev = usb_get_intfdata(intf); |
2010 | struct uvc_streaming *stream; | 2015 | struct uvc_streaming *stream; |
2016 | int ret = 0; | ||
2011 | 2017 | ||
2012 | uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", | 2018 | uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", |
2013 | intf->cur_altsetting->desc.bInterfaceNumber); | 2019 | intf->cur_altsetting->desc.bInterfaceNumber); |
2014 | 2020 | ||
2015 | if (intf->cur_altsetting->desc.bInterfaceSubClass == | 2021 | if (intf->cur_altsetting->desc.bInterfaceSubClass == |
2016 | UVC_SC_VIDEOCONTROL) { | 2022 | UVC_SC_VIDEOCONTROL) { |
2017 | int ret = 0; | ||
2018 | |||
2019 | if (reset) { | 2023 | if (reset) { |
2020 | ret = uvc_ctrl_restore_values(dev); | 2024 | ret = uvc_ctrl_restore_values(dev); |
2021 | if (ret < 0) | 2025 | if (ret < 0) |
@@ -2031,8 +2035,12 @@ static int __uvc_resume(struct usb_interface *intf, int reset) | |||
2031 | } | 2035 | } |
2032 | 2036 | ||
2033 | list_for_each_entry(stream, &dev->streams, list) { | 2037 | list_for_each_entry(stream, &dev->streams, list) { |
2034 | if (stream->intf == intf) | 2038 | if (stream->intf == intf) { |
2035 | return uvc_video_resume(stream, reset); | 2039 | ret = uvc_video_resume(stream, reset); |
2040 | if (ret < 0) | ||
2041 | uvc_queue_enable(&stream->queue, 0); | ||
2042 | return ret; | ||
2043 | } | ||
2036 | } | 2044 | } |
2037 | 2045 | ||
2038 | uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface " | 2046 | uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface " |