Commit Graph

21 Commits

Author SHA1 Message Date
Laurent Pinchart 50144aeeb7 V4L/DVB (10652): uvcvideo: Add quirk to override wrong bandwidth value for Vimicro devices
At least 3 Vimicro cameras (0x332d, 0x3410 and 0x3420) fail to return correct
bandwidth information. The first model rounds the value provided by the host
to the nearest supported packet size, while the other two always request the
maximum bandwidth.

Introduce a device quirk to override the value returned by the device with an
estimated bandwidth computed by the driver from the frame size and frame rate,
and enable it for all Vimicro cameras.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:51 -03:00
Laurent Pinchart c90e777976 V4L/DVB (10651): uvcvideo: Ignore empty bulk URBs
Devices may send a zero-length packet to signal the end of a bulk payload. If
the payload size is a multiple of the URB size the zero-length packet will be
received by the URB completion handler. Handle this by ignoring all empty URBs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:51 -03:00
Laurent Pinchart 72362422f3 V4L/DVB (10650): uvcvideo: Initialize streaming parameters with the probe control value
The UVC specification requires SET_CUR requests on the streaming commit control
to use values retrieved from a successful GET_CUR request on the probe control.
Initialize streaming parameters with the probe control current value to make
sure the driver always complies.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:51 -03:00
Laurent Pinchart efdc8a9585 V4L/DVB (10295): uvcvideo: Retry URB buffers allocation when the system is low on memory.
URB buffers for video transfers are sized to UVC_MAX_PACKETS bulk/isochronous
packets by default. If the system is too low on memory try successively
smaller numbers of packets until allocation succeeds.

Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:26 -03:00
Laurent Pinchart 51cac8ada5 V4L/DVB (10199): uvcvideo: Fix GET_DEF failure detection.
Commit 44f0079ec7 erroneously considers all
GET_DEF requests as unsuccessful. Fix this by checking the request return
value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:37 -02:00
Laurent Pinchart 2c2d264bb9 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>
2009-01-29 08:35:36 -02:00
Huang Weiyi 16e68d7cb8 V4L/DVB (10193): removed unused #include <version.h>'s
Removed unused #include <version.h>'s in files below,
  drivers/media/video/cs5345.c
  drivers/media/video/pwc/pwc-if.c
  drivers/media/video/saa717x.c
  drivers/media/video/upd64031a.c
  drivers/media/video/upd64083.c
  drivers/media/video/uvc/uvc_ctrl.c
  drivers/media/video/uvc/uvc_driver.c
  drivers/media/video/uvc/uvc_queue.c
  drivers/media/video/uvc/uvc_video.c
  drivers/media/video/uvc/uvc_status.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:36 -02:00
Laurent Pinchart ff924203c9 V4L/DVB (10104): uvcvideo: Add support for video output devices
Extend the range of supported UVC devices by allowing video output devices
matching the following structure:

TT_STREAMING -> VC_PROCESSING_UNIT -> VC_EXTENSION_UNIT{0,n} -> OTT_*

Video output devices are reported with the V4L2_CAP_VIDEO_OUTPUT capability
flag and are subject to the same restrictions as video input devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:40:32 -02:00
Laurent Pinchart f8dd4af6d4 V4L/DVB (10101): uvcvideo: Fix bulk URB processing when the header is erroneous
When the first bulk URB of a video payload contains an erroneous header, or
when no V4L2 buffer is available, the whole payload must be dropped. Change
the skip logic to drop all bulk URBs until the end of the payload instead of
the first one only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:40:31 -02:00
Laurent Pinchart 0fbd8ee6de V4L/DVB (9809): uvcvideo: Add nodrop module parameter to turn incomplete frame drop off.
The driver drops incomplete uncompressed video frames to avoid confusing
userspace with corrupt data. Add a nodrop module parameter to turn that
behaviour off and make all frames available to userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:33 -02:00
Laurent Pinchart 23867b2511 V4L/DVB (9661): uvcvideo: Commit streaming parameters when enabling the video stream
Sonix-based cameras seem to require the host to commit video streaming
parameters before selecting the alternate endpoint. While most applications
issue a VIDIOC_S_FMT ioctl before starting streaming, this is not required
by the V4L2 specification.

The problem has been noticed on Ubuntu 8.10 with applications using libv4l.
The library blocks VIDIOC_S_FMT calls when the requested format is identical
to the currently selected format. As the driver commits video streaming
parameters when initialising the device, only the first run of a
libv4l-enabled application would succeed.

For the sake of completeness, experiment showed that the camera keeps sending
12 bytes isochronous packets (header only, no data) without toggling the FID
bit if video streaming parameters haven't been committed before selecting the
alternate endpoint.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:36 -02:00
Laurent Pinchart 4d3939f6ee V4L/DVB (9659): uvcvideo: Use {get|set}_unaligned_le32 macros
Replace combination of endianess conversion and unaligned access macros with
{get|set}_unaligned_*.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:36 -02:00
Laurent Pinchart 44f0079ec7 V4L/DVB (9570): uvcvideo: Handle failed video GET_{MIN|MAX|DEF} requests more gracefully
Failed requests will now generate a one-time warning message instead of the
usual "Failed to query..." error, which should be more user-friendly. The
driver will also recover automatically from failed GET_MIN/GET_MAX requests
when the device is half-broken without requiring the MINMAX quirk (fully
broken devices still need the quirk).

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:31 -02:00
Laurent Pinchart d63beb9ef0 V4L/DVB (9031): uvcvideo: Fix incomplete frame drop when switching to a variable size format.
When streaming in a fixed size format the driver sets a flag in the uvc_queue
structure to drop incomplete incoming frames. The flag wasn't cleared when
switching to a variable size format, which resulted in a broken
'MJPEG after YUV'.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:37:08 -02:00
Laurent Pinchart 08ebd003d9 V4L/DVB (8846): uvcvideo: Supress spurious "EOF in empty payload" trace message
Pass the payload size instead of the header size to uvc_video_decode_end() to
avoid generating an extra trace message for each frame.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:55 -02:00
Julia Lawall e9e24cee67 V4L/DVB (8729): Use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

@depends on haskernel@
expression n,d;
@@

(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:51 -02:00
Laurent Pinchart 04793dd041 V4L/DVB (8617): uvcvideo: don't use stack-based buffers for USB transfers.
Data buffers on the stack are not allowed for USB I/O. Use dynamically
allocated buffers instead.

Signed-off-by: Bruce Schmid <duck@freescale.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-08-06 06:57:37 -03:00
Hans Verkuil f87086e302 v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10
Also remove some blank lines that were used to split compat code at -devel
tree.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:17:52 -03:00
Laurent Pinchart e01117c816 V4L/DVB (8209): uvcvideo: Don't free URB buffers on suspend.
All submitted URBs must be killed at suspend time, but URB buffers don't have
to be freed. Avoiding a free on suspend/reallocate on resume lowers the presure
on system memory.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:17:45 -03:00
Laurent Pinchart 291358785c V4L/DVB (8208): uvcvideo: Use GFP_NOIO when allocating memory during resume
The swap device might still be asleep, so memory allocated in the resume
handler must use GFP_NOIO. Thanks to Oliver Neukum for catching and reporting
this bug.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:17:40 -03:00
Laurent Pinchart c0efd23292 V4L/DVB (8145a): USB Video Class driver
This driver supports video input devices compliant with the USB Video Class
specification. This means lots of currently manufactured webcams, and probably
most of the future ones.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-06-30 17:31:13 -03:00