Laurent Pinchart [Sun, 21 Nov 2010 20:15:44 +0000 (17:15 -0300)]
[media] uvcvideo: Make the API public
Move the public API definitions to include/linux/uvcvideo.h and bump the
version number to 1.1.0. Compatibility with the old API is kept,
application can still be compiled against the private header and will
not break.
[media] uvcvideo: Return -ERANGE when userspace sets an unsupported menu entry
Instead of passing the value down to the device and getting an error
back (or worse, crashing the firmware), return -ERANGE when the
requested menu entry is not supported.
[media] uvcvideo: Don't report unsupported menu entries
Supported menu entries are reported by the device in response to the
GET_RES query. Use the information to return -EINVAL to userspace for
unsupported values when enumerating menu entries.
Martin Rubli [Wed, 1 Sep 2010 07:11:22 +0000 (04:11 -0300)]
[media] uvcvideo: Add driver documentation
This adds detailed documentation about the driver's extension unit control
features. Part of it has been adopted from the dynctrl.txt that used to be
available in the driver's previous Subversion repository.
The documentation has been rewritten to match the current implementation, in
particular to capture the new XU control support including UVCIOC_CTRL_QUERY.
Laurent Pinchart [Sun, 21 Nov 2010 20:08:16 +0000 (17:08 -0300)]
[media] uvcvideo: Rename UVC_CONTROL_* flags to UVC_CTRL_FLAG_*
This makes the public driver API more uniform, in preparation of moving
uvcvideo.h to include/linux. Keep the old names for backward
compatibility with existing applications.
Martin Rubli [Sat, 2 Oct 2010 22:10:16 +0000 (19:10 -0300)]
[media] uvcvideo: Add UVCIOC_CTRL_QUERY ioctl
This ioctl extends UVCIOC_CTRL_GET/SET by not only allowing to get/set
XU controls but to also send arbitrary UVC commands to XU controls,
namely GET_CUR, SET_CUR, GET_MIN, GET_MAX, GET_RES, GET_LEN, GET_INFO
and GET_DEF. This is required for applications to work with XU controls,
so that they can properly query the size and allocate the necessary
buffers.
To simplify maintainer support of this driver, bump the version to
1.5.0 - this will be the first version that is expected to support
mmap() for raw video frames.
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Acked-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 3 May 2011 23:31:36 +0000 (20:31 -0300)]
[media] cxd2820r: switch automatically between DVB-T and DVB-T2
Remove old DVB-T2 freq module param and detect DVB-T/T2 automatically.
Implementation is trial and error, if DVB-T does not lock try DVB-T2
and vice versa. That's done by replacing normal DVBFE_ALGO_SW with
DVBFE_ALGO_CUSTOM which gives better control for tuning process.
DVB-C still uses normal software ZigZag, DVBFE_ALGO_SW.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Thu, 28 Apr 2011 00:03:07 +0000 (21:03 -0300)]
[media] cx24116: add config option to split firmware download
It is very rare I2C adapter hardware which can provide 32kB I2C write
as one write. Add .i2c_wr_max option to set desired max packet size.
Split transaction to smaller pieces according to that option.
Signed-off-by: Antti Palosaari <crope@iki.fi> Cc: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] media: fsl_viu: fix bug in streamon routine
Currently video capturing using streaming I/O method
doesn't work if capturing to overlay buffer took place
before.
When enabling the stream we have to check the overlay
enable driver flag and reset it so that the interrupt
handler won't execute the overlay interrupt path after
enabling DMA in streamon routine. Otherwise the capture
interrupt won't be handled correctly causing non working
VIDIOC_DQBUF ioctl.
Currently the driver enables overlay when running
VIDIOC_S_FMT ioctl with fmt type V4L2_BUF_TYPE_VIDEO_OVERLAY.
Actually, this is wrong. Add proper VIDIOC_OVERLAY support
instead of using VIDIOC_S_FMT for overlay enable.
Jesper Juhl [Thu, 13 Jan 2011 22:05:47 +0000 (19:05 -0300)]
[media] gspca/stv06xx_pb0100: Don't potentially deref NULL in pb0100_start()
usb_altnum_to_altsetting() may return NULL. If it does we'll dereference a
NULL pointer in
drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c::pb0100_start().
As far as I can tell there's not really anything more sensible than
-ENODEV that we can return in that situation, but I'm not at all intimate
with this code so I'd like a bit of review/comments on this before it's
applied.
Anyway, here's a proposed patch.
Signed-off-by: Jesper Juhl <jj@chaosbits.net> Cc: Jean-Francois Moine <moinejf@free.fr> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Erik Andren <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
David Härdeman [Thu, 28 Apr 2011 15:13:32 +0000 (12:13 -0300)]
[media] rc-core: add trailing silence in rc-loopback tx
If an IR command is sent (using the LIRC userspace) to rc-loopback
which doesn't include a trailing space, the result is that the message
won't be completely decoded. In addition, "leftovers" from a previous
transmission can be left until the next one. Fix this by faking a long
silence after the end of TX data.
Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The MT9V032 is a parallel wide VGA sensor from Aptina (formerly Micron)
controlled through I2C.
The driver creates a V4L2 subdevice. It currently supports binning and
cropping, and the gain, auto gain, exposure, auto exposure and test
pattern controls.
Issues with Register 02 causing spurious channel locking from standby.
Should have always bits 4 & 5 written to 1.
Lower nibble not used in any current driver. Usage if necessary can be
applied through initab to mcr_reg. stv0299 not out of standby before
writing inittab.
Jonathan Nieder [Sun, 1 May 2011 09:30:46 +0000 (06:30 -0300)]
[media] cx88: gracefully reject attempts to use unregistered cx88-blackbird driver
It should not be possible to enter mpeg_open and acquire core->lock
without the blackbird driver being registered, so just error out if it
is not. This makes the code more readable and should prevent the bug
fixed by the patch "hold device lock during sub-driver initialization"
from resurfacing again.
Similarly, if we enter mpeg_release and acquire core->lock then either
the blackbird driver is registered (since open files keep it loaded)
or the sysadmin forced the driver's removal. In the latter case the
state will be inconsistent and this is worth a loud warning.
Tested-by: Andi Huber <hobrom@gmx.at> Tested-by: Marlon de Boer <marlon@hyves.nl> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jonathan Nieder [Sun, 1 May 2011 09:29:56 +0000 (06:29 -0300)]
[media] cx88: hold device lock during sub-driver initialization
cx8802_blackbird_probe makes a device node for the mpeg sub-device
before it has been added to dev->drvlist. If the device is opened
during that time, the open succeeds but request_acquire cannot be
called, so the reference count remains zero. Later, when the device
is closed, the reference count becomes negative --- uh oh.
Close the race by holding core->lock during probe and not releasing
until the device is in drvlist and initialization finished.
Previously the BKL prevented this race.
Reported-by: Andreas Huber <hobrom@gmx.at> Tested-by: Andi Huber <hobrom@gmx.at> Tested-by: Marlon de Boer <marlon@hyves.nl> Cc: stable@kernel.org Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jonathan Nieder [Sun, 1 May 2011 09:29:37 +0000 (06:29 -0300)]
[media] cx88: fix locking of sub-driver operations
The BKL conversion of this driver seems to have gone wrong.
Loading the cx88-blackbird driver deadlocks.
The cause: mpeg_ops::open in the cx2388x blackbird driver acquires the
device lock and calls the sub-driver's request_acquire, which tries to
acquire the lock again. Fix it by clarifying the semantics of
request_acquire, request_release, advise_acquire, and advise_release:
now all will rely on the caller to acquire the device lock.
Based on work by Ben Hutchings <ben@decadent.org.uk>.
Jonathan Nieder [Sun, 1 May 2011 09:29:16 +0000 (06:29 -0300)]
[media] cx88: protect per-device driver list with device lock
The BKL conversion of this driver seems to have gone wrong. Various
uses of the sub-device and driver lists appear to be subject to race
conditions.
In particular, some functions access drvlist without a relevant lock
held, which will race against removal of drivers. Let's start with
that --- clean up by consistently protecting dev->drvlist with
dev->core->lock, noting driver functions that require the device lock
to be held or not to be held.
After this patch, there are still some races --- e.g.,
cx8802_blackbird_remove can run between the time the blackbird driver
is acquired and the time it is used in mpeg_release, and there's a
similar race in cx88_dvb_bus_ctrl. Later patches will address the
remaining known races and the deadlock noticed by Andi. This patch
just makes the semantics clearer in preparation for those later
changes.
Based on work by Ben Hutchings <ben@decadent.org.uk>.
Tested-by: Andi Huber <hobrom@gmx.at> Tested-by: Marlon de Boer <marlon@hyves.nl> Cc: stable@kernel.org Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Ondrej Zary [Wed, 27 Apr 2011 20:35:45 +0000 (17:35 -0300)]
[media] usbvision: remove broken testpattern
Enabling force_testpattern module parameter in usbvision causes kernel panic.
Things like that does not belong to the kernel anyway so the fix is easy.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Ondrej Zary [Wed, 27 Apr 2011 20:36:05 +0000 (17:36 -0300)]
[media] usbvision: add Nogatech USB MicroCam
Add Nogatech USB MicroCam PAL (NV3001P) and NTSC (NV3000N) support to
usbvision driver.
PAL version is tested, NTSC untested.
Data captured using usbsnoop, init_values are listed in the INF file along
with image dimensions, offsets and frame rates.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Improve PID filtering and program register 20 correctly.
Make sure stream_on message is sent if streaming is off, otherwise
PIDs are not registered.
Move mutex outside lme2510_enable_pid.
Gate could close after first I2C message. On stv0288 it does.
Keep 2nd and 3rd message I2C gate control alive.
Remove unnecessary gate closing in this module.
[media] Media, DVB, Siano, smsusb: Avoid static analysis report about 'use after free'
In drivers/media/dvb/siano/smsusb.c we have this code:
...
kfree(dev);
sms_info("device %p destroyed", dev);
...
at least one static analysis tool (Coverity Prevent) complains about this
as a use-after-free bug.
While it's true that we do use the pointer variable after freeing it, the
only use is to print the value of the pointer, so there's not actually any
problem here. But still, silencing the complaint is trivial by just moving
the kfree() call below the sms_info(), so why not just do it?. It doesn't
change the workings of the code in any way, but it makes the tool shut up.
The patch below also removes a rather pointless blank line.
[media] tm6000: add detection based on eeprom name
On some situations, it is desired to use eeprom data to detect
the board type. This patch adds a logic for it and fixes 2 detection
issues:
1) 10Moons UT-821 uses a generic Trident ID. Other boards
also share the same ID. So, better to use an alternative way for
it;
2) Sometimes, HVR-900H is loaded with the default Trident
ID. This seems to be some hardware bug or race condition.
The new logic will only be enabled if the device is detected as
having a generic ID.
Marko Ristola [Fri, 8 Apr 2011 15:40:51 +0000 (12:40 -0300)]
[media] Speed up DVB TS stream delivery from DMA buffer into dvb-core's buffer
Avoid unnecessary DVB TS 188 sized packet copying from DMA buffer into stack.
Backtrack one 188 sized packet just after some garbage bytes when possible.
This obsoletes patch https://patchwork.kernel.org/patch/118147/
Signed-off-by: Marko Ristola <marko.ristola@kolumbus.fi> Acked-by: Andreas Oberritter <obi@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] cx23885: Don't leak firmware in cx23885_card_setup()
We leak the memory allocated to 'fw' (the firmware) when the variable goes
out of scope.
Fix the leak by calling release_firmware(fw) before 'fw' goes out of
scope.
Steven Toth [Wed, 6 Apr 2011 11:32:56 +0000 (08:32 -0300)]
[media] cx18: mmap() support for raw YUV video capture
Add support for mmap method streaming of raw YUV video on cx18-based
hardware, in addition to the existing support for read() streaming of
raw YUV and MPEG-2 encoded video.
[simon.farnsworth@onelan.co.uk: I forward-ported this from Steven's original work,
done under contract to ONELAN. The original code is at
http://www.kernellabs.com/hg/~stoth/cx18-videobuf]
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
stv0288 Register 42 bits 6 & 7 should be set to 0.
This is causing intermittent lock, the dvb-usb-lmedm04 driver uses
register 50 (auto fine mode) to correct for this, this register is
now returned to its default setting.
Dan Carpenter [Sat, 26 Mar 2011 01:52:22 +0000 (22:52 -0300)]
[media] pvrusb2: check for allocation failures
This function returns NULL on failure so lets do that if kzalloc()
fails. There is a separate problem that the caller for this function
doesn't check for errors...
Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-By: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Timothy Lee [Fri, 25 Mar 2011 18:00:33 +0000 (15:00 -0300)]
[media] saa7134: support MagicPro ProHDTV Pro2 Hybrid DMB-TH PCI card
This card has a TD18271 silicon tuner, and uses TDA8290 and LGS8G75 to
demodulate analog and digital broadcast respectively. GPIO configurations
were derived using DScaler regspy.
Jean Delvare [Wed, 23 Mar 2011 13:35:57 +0000 (10:35 -0300)]
[media] zoran: Drop unused module parameters encoder and decoder
The ability to force the encoder or decoder chip was broken by commit 0ab6e1c38d80ab586e3a1ca9e71844131d9f51dc in February 2009. As nobody
complained for over 2 years, I take it that these parameters were no
longer used so we can simply drop them.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Florian Mickler [Sun, 20 Mar 2011 21:50:52 +0000 (18:50 -0300)]
[media] lmedm04: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Florian Mickler [Sun, 20 Mar 2011 21:50:50 +0000 (18:50 -0300)]
[media] au6610: get rid of on-stack dma buffer
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Signed-off-by: Florian Mickler <florian@mickler.org> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Florian Mickler [Sun, 20 Mar 2011 21:50:49 +0000 (18:50 -0300)]
[media] ce6230: get rid of on-stack dma buffer
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Signed-off-by: Florian Mickler <florian@mickler.org> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Florian Mickler [Sun, 20 Mar 2011 21:50:48 +0000 (18:50 -0300)]
[media] ec168: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Signed-off-by: Florian Mickler <florian@mickler.org> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Florian Mickler [Mon, 21 Mar 2011 10:19:10 +0000 (07:19 -0300)]
[media] vp702x: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Florian Mickler [Mon, 21 Mar 2011 18:33:46 +0000 (15:33 -0300)]
[media] opera1: get rid of on-stack dma buffer
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Florian Mickler [Mon, 21 Mar 2011 18:33:45 +0000 (15:33 -0300)]
[media] m920x: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Florian Mickler [Mon, 21 Mar 2011 18:33:44 +0000 (15:33 -0300)]
[media] dw2102: get rid of on-stack dma buffer
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Signed-off-by: Florian Mickler <florian@mickler.org> Cc: Igor M. Liplianin <liplianin@tut.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Florian Mickler [Mon, 21 Mar 2011 18:33:43 +0000 (15:33 -0300)]
[media] friio: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Florian Mickler [Mon, 21 Mar 2011 18:33:41 +0000 (15:33 -0300)]
[media] a800: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.