aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc/uvc_video.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@skynet.be>2009-01-03 17:12:40 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-29 05:35:36 -0500
commit2c2d264bb951c1a846b86431d3e784edfb79ab39 (patch)
treeab2a7c70b1638cd88c322e899d2c6b2f60157ba9 /drivers/media/video/uvc/uvc_video.c
parentbb1b082ed65292fc6fc7e01bbe0dd005d5a4140e (diff)
V4L/DVB (10197): uvcvideo: Whitespace and comments cleanup, copyright updates.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvc_video.c')
-rw-r--r--drivers/media/video/uvc/uvc_video.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index 6e9e30f174a1..f9eb0e974051 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * uvc_video.c -- USB Video Class driver - Video handling 2 * uvc_video.c -- USB Video Class driver - Video handling
3 * 3 *
4 * Copyright (C) 2005-2008 4 * Copyright (C) 2005-2009
5 * Laurent Pinchart (laurent.pinchart@skynet.be) 5 * Laurent Pinchart (laurent.pinchart@skynet.be)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -159,7 +159,7 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
159 } 159 }
160 160
161 /* Some broken devices return a null or wrong dwMaxVideoFrameSize. 161 /* Some broken devices return a null or wrong dwMaxVideoFrameSize.
162 * Try to get the value from the format and frame descriptor. 162 * Try to get the value from the format and frame descriptors.
163 */ 163 */
164 uvc_fixup_buffer_size(video, ctrl); 164 uvc_fixup_buffer_size(video, ctrl);
165 ret = 0; 165 ret = 0;
@@ -190,9 +190,6 @@ static int uvc_set_video_ctrl(struct uvc_video_device *video,
190 *(__le16 *)&data[12] = cpu_to_le16(ctrl->wCompQuality); 190 *(__le16 *)&data[12] = cpu_to_le16(ctrl->wCompQuality);
191 *(__le16 *)&data[14] = cpu_to_le16(ctrl->wCompWindowSize); 191 *(__le16 *)&data[14] = cpu_to_le16(ctrl->wCompWindowSize);
192 *(__le16 *)&data[16] = cpu_to_le16(ctrl->wDelay); 192 *(__le16 *)&data[16] = cpu_to_le16(ctrl->wDelay);
193 /* Note: Some of the fields below are not required for IN devices (see
194 * UVC spec, 4.3.1.1), but we still copy them in case support for OUT
195 * devices is added in the future. */
196 put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]); 193 put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]);
197 put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]); 194 put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]);
198 195
@@ -399,7 +396,7 @@ static int uvc_video_decode_start(struct uvc_video_device *video,
399 * 396 *
400 * Empty buffers (bytesused == 0) don't trigger end of frame detection 397 * Empty buffers (bytesused == 0) don't trigger end of frame detection
401 * as it doesn't make sense to return an empty buffer. This also 398 * as it doesn't make sense to return an empty buffer. This also
402 * avoids detecting and of frame conditions at FID toggling if the 399 * avoids detecting end of frame conditions at FID toggling if the
403 * previous payload had the EOF bit set. 400 * previous payload had the EOF bit set.
404 */ 401 */
405 if (fid != video->last_fid && buf->buf.bytesused != 0) { 402 if (fid != video->last_fid && buf->buf.bytesused != 0) {
@@ -452,6 +449,17 @@ static void uvc_video_decode_end(struct uvc_video_device *video,
452 } 449 }
453} 450}
454 451
452/* Video payload encoding is handled by uvc_video_encode_header() and
453 * uvc_video_encode_data(). Only bulk transfers are currently supported.
454 *
455 * uvc_video_encode_header is called at the start of a payload. It adds header
456 * data to the transfer buffer and returns the header size. As the only known
457 * UVC output device transfers a whole frame in a single payload, the EOF bit
458 * is always set in the header.
459 *
460 * uvc_video_encode_data is called for every URB and copies the data from the
461 * video buffer to the transfer buffer.
462 */
455static int uvc_video_encode_header(struct uvc_video_device *video, 463static int uvc_video_encode_header(struct uvc_video_device *video,
456 struct uvc_buffer *buf, __u8 *data, int len) 464 struct uvc_buffer *buf, __u8 *data, int len)
457{ 465{
@@ -952,7 +960,7 @@ int uvc_video_suspend(struct uvc_video_device *video)
952} 960}
953 961
954/* 962/*
955 * Reconfigure the video interface and restart streaming if it was enable 963 * Reconfigure the video interface and restart streaming if it was enabled
956 * before suspend. 964 * before suspend.
957 * 965 *
958 * If an error occurs, disable the video queue. This will wake all pending 966 * If an error occurs, disable the video queue. This will wake all pending
@@ -984,8 +992,8 @@ int uvc_video_resume(struct uvc_video_device *video)
984 */ 992 */
985 993
986/* 994/*
987 * Initialize the UVC video device by retrieving the default format and 995 * Initialize the UVC video device by switching to alternate setting 0 and
988 * committing it. 996 * retrieve the default format.
989 * 997 *
990 * Some cameras (namely the Fuji Finepix) set the format and frame 998 * Some cameras (namely the Fuji Finepix) set the format and frame
991 * indexes to zero. The UVC standard doesn't clearly make this a spec 999 * indexes to zero. The UVC standard doesn't clearly make this a spec
@@ -1013,7 +1021,7 @@ int uvc_video_init(struct uvc_video_device *video)
1013 */ 1021 */
1014 usb_set_interface(video->dev->udev, video->streaming->intfnum, 0); 1022 usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
1015 1023
1016 /* Some webcams don't suport GET_DEF request on the probe control. We 1024 /* Some webcams don't suport GET_DEF requests on the probe control. We
1017 * fall back to GET_CUR if GET_DEF fails. 1025 * fall back to GET_CUR if GET_DEF fails.
1018 */ 1026 */
1019 if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_DEF)) < 0 && 1027 if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_DEF)) < 0 &&