Cc: Juan J. Garcia de Soria <skandalfo@gmail.com> Cc: Stephan Raue <stephan@openelec.tv> Cc: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] rc: New rc-based ite-cir driver for several ITE CIRs
This is a second version of an rc-core based driver for the ITE Tech IT8712F
CIR and now for a pair of other variants of the IT8512 CIR too.
This driver should replace the lirc_it87 and lirc_ite8709 currently living in
the LIRC staging directory.
The driver should support the ITE8704, ITE8713, ITE8708 and ITE8709 (this last
one yet untested) PNP ID's.
The code doesn'te reuse code from the pre-existing LIRC drivers, but has been
written from scratch using the nuvoton.cir driver as a skeleton.
This new driver shouldn't exhibit timing problems when running under load (or
with interrupts disabled for relatively long times). It works OOTB with the
RC6 MCE remote bundled with the ASUS EEEBox. TX support is implemented, but
I'm unable to test it since my hardware lacks TX capability.
Signed-off-by: Juan J. Garcia de Soria <skandalfo@gmail.com> Tested-by: Stephan Raue <stephan@openelec.tv> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Rostedt [Thu, 10 Mar 2011 22:41:29 +0000 (19:41 -0300)]
[media] saa7134: Fix strange kconfig dependency on RC_CORE
As the code in saa7134-input is not a module, but the config for it is
set as a boolean instead of a tristate, this causes a strange dependency
on RC_CORE.
VIDEO_SAA7134_RC (which determines if saa7134-input.o is built) depends
on RC_CORE and VIDEO_SAA7134. If VIDEO_SAA7134 is compiled as 'y' but
RC_CORE is compiled as 'm' VIDEO_SAA7134_RC can still be set to 'y'
which causes undefined symbols that it needs from RC_CORE.
The simplest solution is to not allow VIDEO_SAA7134_RC be enabled if
RC_CORE compiled as a module (m) and VIDEO_SA7134 is compiled into the
kernel (y).
Suggested-by: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Cc: linux-kbuild <linux-kbuild@vger.kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Patrice Chotard [Mon, 21 Mar 2011 19:58:56 +0000 (16:58 -0300)]
[media] gspca - main: Add endpoint direction test in alt_xfer
This patch fixes a bug in gspca, more precisely in alt_xfer().
This function looks for an input transfer endpoint in an alternate setting.
By default it returns the first endpoint corresponding to the transfer type
indicated in parameter.
But with some USB devices, the first endpoint corresponding to the transfer
type is not always an INPUT endpoint but an OUTPUT one.
This patch adds the endpoint direction test to be sure to return an INPUT endpoint
Hans Verkuil [Tue, 22 Mar 2011 13:14:07 +0000 (10:14 -0300)]
[media] v4l2: use new flag to enable core priority handling
Rather than guess which driver supports core priority handling, require drivers
that do to explicitly set the V4L2_FL_USE_FH_PRIO flag in video_device.
Updated the core prio handling accordingly and set the flag in the three
drivers that do.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 12 Mar 2011 09:43:28 +0000 (06:43 -0300)]
[media] ivtv: replace ugly casts with a proper container_of
ivtv-ioctl cast the 'void *fh' directly to 'ivtv_open_id *'. This should be
done properly with a contained_of since the 'void *fh' is really a
'struct v4l2_fh *'.
It worked because the v4l2_fh field is also the first field in the ivtv_open_id
struct, but it is not clean code.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 12 Mar 2011 09:37:19 +0000 (06:37 -0300)]
[media] v4l2-device: add kref and a release function
The video_device struct has proper ref counting and its release function
will be called when the last user releases it. But no such support was
available for struct v4l2_device. This made it hard to determine when a
USB driver can release the device if it has multiple device nodes.
With one device node it is easy of course, since when the device node is
released, the whole device can be released.
This patch adds refcounting to v4l2_device. When registering device nodes
the v4l2_device refcount will be increased, when releasing device nodes
it will be decreased. The (optional) release function will be called when
the last device node was released.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 8 Jan 2011 12:38:02 +0000 (09:38 -0300)]
[media] v4l2-fh: add v4l2_fh_is_singular
Several drivers need to do something when the first filehandle is opened
or the last filehandle is closed. Most implement some use count mechanism,
but if they use v4l2_fh, then you can also just check if this is the only
filehandle for the device node. A simple helper function can do this.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 8 Jan 2011 12:36:04 +0000 (09:36 -0300)]
[media] v4l2-fh: add v4l2_fh_open and v4l2_fh_release helper functions
Add two new functions: v4l2_fh_open allocates and initializes a struct v4l2_fh
based on a struct file pointer and v4l2_fh_release releases and frees a struct
v4l2_fh.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Wed, 29 Dec 2010 13:05:02 +0000 (10:05 -0300)]
[media] v4l2_prio: move from v4l2-common to v4l2-dev
We are going to move priority handling into the v4l2 core. As a consequence
the v4l2_prio helper functions need to be moved into the core videodev
module as well to prevent circular dependencies.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Vadim Solomin [Sun, 6 Mar 2011 16:00:38 +0000 (13:00 -0300)]
[media] saa7134-input: key up events not sent after suspend/resume
On my AverMedia AverTV Studio 507, key up events are no longer sent after
a suspend-to-disk/resume cycle, resulting in "stuck" keys.
Apparently, for key up events to be generated, a certain GPIO pin must be set.
Currently it's set in saa7134_input_init1(), but that function is not called
on device resume. I suggest that code be moved to __saa7134_ir_start(), which
is called both on init and resume.
Dan Carpenter [Sun, 6 Mar 2011 13:40:11 +0000 (10:40 -0300)]
[media] stv0367: signedness bug in stv0367_get_tuner_freq()
We use err to store negative error codes so it should be signed. And
if we return an error from stv0367_get_tuner_freq() that needs to be
handled properly as well. (param->frequency is a u32).
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Alexander Strakh [Tue, 25 Jan 2011 21:00:13 +0000 (18:00 -0300)]
[media] drivers/media/video/tlg2300/pd-video.c: Remove second mutex_unlock in pd_vidioc_s_fmt
Error path in file drivers/media/video/tlg2300/pd-video.c:
1. First mutex_unlock on &pd->lock in line 767 (in function that
called from line 805)
2. Second in line 806
Jesper Juhl [Thu, 17 Feb 2011 20:33:56 +0000 (17:33 -0300)]
[media] Zarlink zl10036 DVB-S: Fix mem leak in zl10036_attach
On Thu, 17 Feb 2011, Matthias Schwarzott wrote:
> On Sunday 06 February 2011, Jesper Juhl wrote:
> > If the memory allocation to 'state' succeeds but we jump to the 'error'
> > label before 'state' is assigned to fe->tuner_priv, then the call to
> > 'zl10036_release(fe)' at the 'error:' label will not free 'state', but
> > only what was previously assigned to 'tuner_priv', thus leaking the memory
> > allocated to 'state'.
> > There are may ways to fix this, including assigning the allocated memory
> > directly to 'fe->tuner_priv', but I did not go for that since the
> > additional pointer derefs are more expensive than the local variable, so I
> > just added a 'kfree(state)' call. I guess the call to 'zl10036_release'
> > might not even be needed in this case, but I wasn't sure, so I left it in.
> >
> Yeah, that call to zl10036_release can be completely eleminated.
> Another thing is: jumping to the error label only makes sense when memory was
> already allocated. So the jump in line 471 can be replaced by "return NULL",
> as the other error handling before allocation:
> if (NULL == config) {
> printk(KERN_ERR "%s: no config specified", __func__);
> goto error;
> }
>
> I suggest to improve the patch to clean the code up when changing that.
>
> But I am fine with commiting this patch also if you do not want to change it.
>
Thank you for your feedback. It makes a lot of sense.
Changing it is not a problem :)
How about the updated patch below?
If the memory allocation to 'state' succeeds but we jump to the 'error'
label before 'state' is assigned to fe->tuner_priv, then the call to
'zl10036_release(fe)' at the 'error:' label will not free 'state', but
only what was previously assigned to 'tuner_priv', thus leaking the memory
allocated to 'state'.
This patch fixes the leak and also does not jump to 'error:' before mem
has been allocated but instead just returns. Also some small style
cleanups.
Jiri Slaby [Mon, 28 Feb 2011 09:37:02 +0000 (06:37 -0300)]
[media] V4L: videobuf, don't use dma addr as physical
mem->dma_handle is a dma address obtained by dma_alloc_coherent which
needn't be a physical address in presence of IOMMU, as
a hardware IOMMU can (and most likely) will return a bus address where
physical != bus address.
So ensure we are remapping (remap_pfn_range) the right page in
__videobuf_mmap_mapper by using virt_to_phys(mem->vaddr) and not
mem->dma_handle.
While at it, use PFN_DOWN instead of explicit shift.
[mchehab@redhat.com: Fix compilation breakage due to the lack of a comma] Signed-off-by: Jiri Slaby <jslaby@suse.cz> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] uvcvideo: Fix uvc_fixup_video_ctrl() format search
The scheme used to index format in uvc_fixup_video_ctrl() is not robust:
format index is based on descriptor ordering, which does not necessarily
match bFormatIndex ordering. Searching for first matching format will
prevent uvc_fixup_video_ctrl() from using the wrong format/frame to make
adjustments.
Antti Palosaari [Sat, 19 Mar 2011 21:02:22 +0000 (18:02 -0300)]
[media] af9013: reimplement firmware download
Split FW download packages smarter way and bug free. Implementation is
based of Andrea Merello's example he provided for tda18218 driver.
Count remaining FW bytes down in loop instead of division and modulo
combination used earlier.
Thanks to: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi> Cc: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sat, 19 Mar 2011 19:51:43 +0000 (16:51 -0300)]
[media] af9015: reimplement firmware download
Split FW download packages smarter way and bug free. Implementation is
based of Andrea Merello's example he provided for tda18218 driver.
Count remaining FW bytes down in loop instead of division and modulo
combination used earlier.
Thanks-to: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Cc: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Ian Armstrong [Fri, 18 Mar 2011 22:23:05 +0000 (19:23 -0300)]
[media] af9015: enhance RC
Patch from Ian Armstrong.
I've encountered a couple of problems with the current af9015 driver as
supplied with the 2.6.37 kernel, that the attached patch appears to fix. (I've
generated this patch against the current v4l-dvb git).
Some key-presses are lost. A key-press is only generated upon 'valid' data
(buf[14] == (u8) ~buf[15]), but the buffer is wiped before this check.
Sometimes the 15th byte has not been set at the time of read, so the data
isn't valid & ignored. On the next poll the 15th byte has been set, but the
rest of the data was wiped previously, so the data is still invalid & the key
is lost.
Weird repeat error, where an old key press is sometimes repeated in error. ie.
button sequence '1 (pause) 2 (pause) 3 (pause) 4' generates output like '1
(pause) 2 (pause) 23 (pause) 4'. The current driver zeroes the data for the
key pushed, but sometimes this data is already zero but with other bytes set
suggesting a repeat code. This results in the last key being incorrectly
repeated.
This patch attempts to reduce the risk of a missed key-press & also stop the
random repeat of an old key-press when a new key is pressed.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Xiaochen Wang [Mon, 14 Mar 2011 01:32:53 +0000 (22:32 -0300)]
[media] pvrusb2: check kmalloc return value
allows the driver to proceed and initialize the below two values
even if the kmalloc() fails.
hdw->std_info_enum.def.type_enum.value_names
hdw->std_info_enum.def.type_enum.count
Signed-off-by: Xiaochen Wang <wangxiaochen0@gmail.com> Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Fri, 11 Mar 2011 19:22:21 +0000 (16:22 -0300)]
[media] V4L doc fixes
The xmlto validation produced a number of errors that are now fixed.
Sadly, the DocBook/Makefile still adds --skip-validation to xmlto, so
these errors are missed during a normal compile.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Memory allocated by alloc_page() function might contain some potentially
important data from other system processes. The patch adds a flag to
zero the allocated page before giving it to videobuf2 (and then to
userspace).
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch fixes two minor memory leaks in videobuf2-dma-sg module. They
might happen only in case some other operations (like memory allocation)
failed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l2: vb2: fix queue reallocation and REQBUFS(0) case
This patch fixes 2 minor bugs in videobuf2 core:
1. Queue should be reallocated if one change the memory access
method without changing the number of buffers.
2. In case of REQBUFS(0), the request should not be passed to the
driver.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Kamil Debski [Fri, 11 Mar 2011 09:16:22 +0000 (06:16 -0300)]
[media] v4l: Documentation for the NV12MT format
Added documentation for V4L2_PIX_FMT_NV12MT format. This is a YUV 4:2:0
format with macro block size of 64x32 and specific order of macro blocks
in the memory.
Use pix_mp member of struct v4l2_format to return a format
description rather than pix. Also fill in the plane_fmt array.
This is a missing bit of conversion to the multiplanar API.
Use pr_debug instead of printk so it is possible to control
debug traces at runtime.
E.g. to enable debug trace in file fimc-core.c use command:
echo -n 'file fimc-core.c +p' > /sys/kernel/debug/dynamic_debug/control
or
echo -n 'file fimc-core.c -p' > /sys/kernel/debug/dynamic_debug/control
to disable.
[media] s5p-fimc: Prevent hanging on device close and fix the locking
Rework the locking in m2m driver to assure proper operation on SMP systems.
When job_abort or stop_streaming was called to immediately shutdown
a memory-to-memory transaction video buffers scheduled for processing
were never returned to vb2 and v4l2_m2m_job_finish was not called
which led to hanging.
Correct this and also return the unprocessed buffers to vb2 marking
them as erroneous, in case the end of frame interrupt do not occur.
Reported-by: Sewoon Park <seuni.park@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sungchun Kang [Mon, 7 Feb 2011 18:59:46 +0000 (15:59 -0300)]
[media] s5p-fimc: fix ISR and buffer handling for fimc-capture
In some cases fimc H/W did not stop although there were no output
buffers available. So the capture deactivation interrupt routine
is modified and the state of ST_CAPT_RUN is cleared only
in the LAST-IRQ call.
After LAST-IRQ is generated, H/W pointer will be skipped by 1 frame.
(reference by user manual) So, S/W pointer should be increased too.
Reviewed-by Jonghun Han <jonghun.han@samsung.com> Signed-off-by: Sungchun Kang <sungchun.kang@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Abylay Ospan [Sun, 2 Jan 2011 12:15:00 +0000 (09:15 -0300)]
[media] Force xc5000 firmware loading for NetUP Dual DVB-T/C CI RF card
Two xc5000 tuners connected to same i2c bus.
Experiments shows that situation when one tuner is not initialized
while other is tuned to channel causes TS errors.
Abylay Ospan [Sun, 2 Jan 2011 12:14:00 +0000 (09:14 -0300)]
[media] Fix CI code for NetUP Dual DVB-T/C CI RF card
CI reset takes several seconds on some CAM,
so there is no need to lock mutex all that time.
Also we need not to preserve CI's reset bits in
CIBUSCTRL register, they are handled automatically by FPGA.
Set it to 0 explicitly in order to not reset wrong CAM.
[media] cpia2: Fix some gcc 4.6 warnings when debug is disabled
cpia2_core.c:529:14: warning: variable 'dir' set but not used [-Wunused-but-set-variable]
cpia2_core.c:526:5: warning: variable 'block_index' set but not used [-Wunused-but-set-variable]
[media] several drivers: Fix a few gcc 4.6 warnings
au0828-dvb.c:99:6: warning: variable 'ptr' set but not used [-Wunused-but-set-variable]
au0828-video.c:1180:25: warning: variable 'maxheight' set but not used [-Wunused-but-set-variable]
au0828-video.c:1180:15: warning: variable 'maxwidth' set but not used [-Wunused-but-set-variable]
bttv-input.c:196:16: warning: variable 'current_jiffies' set but not used [-Wunused-but-set-variable]
Those variables are not used at all, so just remove them.
Cc: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 6 Mar 2011 12:31:00 +0000 (09:31 -0300)]
[media] cx88-alsa: fix compiler warning
drivers/media/video/cx88/cx88-alsa.c: In function 'cx88_audio_initdev':
drivers/media/video/cx88/cx88-alsa.c:881:20: warning: 'core' may be used uninitialized in this function
The compiler doesn't understand that snd_cx88_create fills in the core
pointer. So just initialize it to NULL.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 6 Mar 2011 12:30:02 +0000 (09:30 -0300)]
[media] fmdrv_common.c: fix compiler warning
drivers/media/radio/wl128x/fmdrv_common.c: In function 'recv_tasklet':
drivers/media/radio/wl128x/fmdrv_common.c:274:4: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
The result of sizeof() should be printed with %zu.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 6 Mar 2011 12:27:44 +0000 (09:27 -0300)]
[media] altera-ci.c: fix compiler warnings
drivers/media/video/cx23885/altera-ci.c: In function 'altera_hw_filt_init':
drivers/media/video/cx23885/altera-ci.c:671:2: warning: cast from pointer to integer of different size
drivers/media/video/cx23885/altera-ci.c: In function 'altera_ci_init':
drivers/media/video/cx23885/altera-ci.c:739:2: warning: cast from pointer to integer of different size
Use %p instead of 0x%x to print addresses.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 6 Mar 2011 12:26:24 +0000 (09:26 -0300)]
[media] stv0367.c: fix compiler warning
drivers/media/dvb/frontends/stv0367.c: In function 'stv0367ter_lock_algo':
drivers/media/dvb/frontends/stv0367.c:1315:2: warning: cast from pointer to integer of different size
Use %p to print addresses instead of 0x%x.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>