Kamil Debski [Mon, 23 Feb 2015 12:26:19 +0000 (09:26 -0300)]
[media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init
The s5p-mfc driver interprets a buffer with bytesused equal to 0 as a
special case indicating end-of-stream. After vb2: fix bytesused == 0
handling (8a75ffb) patch videobuf2 modified the value of bytesused if it
was 0. The allow_zero_bytesused flag was added to videobuf2 to keep
backward compatibility.
Kamil Debski [Mon, 23 Feb 2015 12:26:18 +0000 (09:26 -0300)]
[media] coda: set allow_zero_bytesused flag for vb2_queue_init
The coda driver interprets a buffer with bytesused equal to 0 as a special
case indicating end-of-stream. After vb2: fix bytesused == 0 handling
(8a75ffb) patch videobuf2 modified the value of bytesused if it was 0.
The allow_zero_bytesused flag was added to videobuf2 to keep
backward compatibility.
Kamil Debski [Mon, 23 Feb 2015 12:26:17 +0000 (09:26 -0300)]
[media] vb2: add allow_zero_bytesused flag to the vb2_queue struct
The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the behavior
of __fill_vb2_buffer function, so that if bytesused is 0 it is set to the
size of the buffer. However, bytesused set to 0 is used by older codec
drivers as as indication used to mark the end of stream.
To keep backward compatibility, this patch adds a flag passed to the
vb2_queue_init function - allow_zero_bytesused. If the flag is set upon
initialization of the queue, the videobuf2 keeps the value of bytesused
intact in the OUTPUT queue and passes it to the driver.
Reported-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Arnd Bergmann [Wed, 18 Feb 2015 17:12:42 +0000 (14:12 -0300)]
[media] Add and use IS_REACHABLE macro
In the media drivers, the v4l2 core knows about all submodules
and calls into them from a common function. However this cannot
work if the modules that get called are loadable and the
core is built-in. In that case we get
drivers/built-in.o: In function `set_type':
drivers/media/v4l2-core/tuner-core.c:301: undefined reference to `tea5767_attach'
drivers/media/v4l2-core/tuner-core.c:307: undefined reference to `tea5761_attach'
drivers/media/v4l2-core/tuner-core.c:349: undefined reference to `tda9887_attach'
drivers/media/v4l2-core/tuner-core.c:405: undefined reference to `xc4000_attach'
This was working previously, until the IS_ENABLED() macro was used
to replace the construct like
with the difference that the new code no longer checks whether it is being
built as a loadable module itself.
To fix this, this new patch adds an 'IS_REACHABLE' macro, which evaluates
true in exactly the condition that was used previously. The downside
of this is that this trades an obvious link error for a more subtle
runtime failure, but it is clear that the change that introduced the
link error was unintentional and it seems better to revert it for
now. Also, a similar change was originally created by Trent Piepho
and then reverted by teh change to the IS_ENABLED macro.
Ideally Kconfig would be used to avoid the case of a broken dependency,
or the code restructured in a way to turn around the dependency, but either
way would require much larger changes here.
Fixes: 7b34be71db53 ("[media] use IS_ENABLED() macro")
See-also: c5dec9fb248e ("V4L/DVB (4751): Fix DBV_FE_CUSTOMISE for card drivers compiled into kernel")
The "priv" struct is actually reference counted, so the xc5000_release()
function gets called multiple times for hybrid devices. Because
release_firmware() was always being called, it would work fine as expected
on the first call but then the second call would corrupt aribtrary memory.
Set the pointer to NULL after releasing so that we don't call
release_firmware() twice.
This problem was detected in the HVR-950q where plugging/unplugging the
device multiple times would intermittently show panics in completely
unrelated areas of the kernel.
Cleaning up the following compiler warning:
rtl2832.c:703:12: warning: 'tmp' may be used uninitialized in this function
Even though it could never happen since if rtl2832_rd_demod_reg () doesn't set
tmp, this line would never run because we go to err. It is still nice to avoid
compiler warnings.
[mchehab@osg.samsung.com: fix a merge conflict with another patch meant
to fix the same bug, but doing it at the wrong way] Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sifan Naeem [Tue, 10 Feb 2015 10:41:56 +0000 (07:41 -0300)]
[media] rc: img-ir: fix error in parameters passed to irq_free()
img_ir_remove() passes a pointer to the ISR function as the 2nd
parameter to irq_free() instead of a pointer to the device data
structure.
This issue causes unloading img-ir module to fail with the below
warning after building and loading img-ir as a module.
[media] si2165: Fix possible leak in si2165_upload_firmware()
In case of an error function si2165_upload_firmware() releases the already
requested firmware in the exit path. However, there is one deviation where
the function directly returns. Use the correct cleanup so that the firmware
memory gets freed correctly. Detected by Coverity CID 1269120.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Reviewed-by: Luis de Bethencourt <luis.bg@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
KyongHo Cho [Thu, 5 Feb 2015 05:52:42 +0000 (02:52 -0300)]
[media] v4l: vb2-memops: use vma slab when vma allocation
The slab for vm_area_struct which is vm_area_cachep is already prepared
for the general use. Instead of kmalloc() for the vma copy for userptr,
allocation from vm_area_cachep is more beneficial.
CC: Hans Verkuil <hans.verkuil@cisco.com> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sifan Naeem [Wed, 4 Feb 2015 16:48:14 +0000 (13:48 -0300)]
[media] rc: img-ir: Add and enable sys clock for img-ir
Gets a handle to the system clock, already described in the binding
document, and calls the appropriate common clock framework functions
to mark it prepared/enabled, the common clock framework initially
enables the clock and doesn't disable it at least until the
device/driver is removed.
It's important the systen clock is enabled before register interface is
accessed by the driver.
The system clock to IR is needed for the driver to communicate with the
IR hardware via MMIO accesses on the system bus, so it must not be
disabled during use or the driver will malfunction.
Markus Elfring [Tue, 3 Feb 2015 15:47:48 +0000 (12:47 -0300)]
[media] DVB: Less function calls in dvb_ca_en50221_init() after error detection
The functions "dvb_unregister_device" and "kfree" could still be called
by the dvb_ca_en50221_init() function in the case that a previous resource
allocation failed.
* Corresponding details could be improved by adjustments for jump targets.
* Let us delete also an unnecessary check for the variable "ca" there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] media: radio-si4713: improve usage of gpiod API
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Simplify accordingly.
Moreover use the _optional variant which has tighter error checking, but
is simpler to use which allows further simplification.
Hans Verkuil [Fri, 20 Mar 2015 17:05:03 +0000 (14:05 -0300)]
[media] videodev2.h/v4l2-dv-timings.h: add V4L2_DV_FL_IS_CE_VIDEO flag
In the past the V4L2_DV_BT_STD_CEA861 standard bit was used to
determine whether the format is a CE (Consumer Electronics) format
or not. However, the 640x480p59.94 format is part of the CEA-861
standard, but it is *not* a CE video format.
Add a new flag to make this explicit. This information is needed
in order to determine the default R'G'B' encoding for the format:
for CE video this is limited range (16-235) instead of full range
(0-255).
The header with all the timings has been updated with this new
flag.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Martin Bugge <marbugge@cisco.com> Cc: Mats Randgaard <mats.randgaard@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Prashant Laddha [Sat, 21 Mar 2015 12:29:14 +0000 (09:29 -0300)]
[media] vivid: add support to set CVT, GTF timings
In addition to v4l2_find_dv_timings_cap(), where timings are searched
against the list of preset timings, the incoming timing from v4l2-ctl
is checked against CVT and GTF standards. If it confirms to be CVT or
GTF, it is treated as valid timing and vivid format is updated with
new timings.
Prashant Laddha [Fri, 20 Mar 2015 06:41:45 +0000 (03:41 -0300)]
[media] vivid: add CVT,GTF standards to vivid dv timings caps
Currently vivid supports V4L2_DV_BT_STD_DMT and V4L2_DV_BT_STD_CEA861
discrete video standards. Extending the capability set to allow for
setting CVT and GTF standards. This change, along with adding the
support for calculating CVT, GTF timings in v4l2-ctl would extend
the number of resolutions supported by vivid to almost any custom
resolution.
Also extending the limits on min and max pixel clock to accommodate
pixel clock range provided by cvt/gtf for resolutions ranging from
640x360p50 to 4kx2Kp60.
Florian Echtler [Tue, 31 Mar 2015 09:43:28 +0000 (06:43 -0300)]
[media] sur40: fix occasional hard freeze due to buffer queue underrun
This patch fixes a kernel panic which occurs when buf_list is empty. This can
happen occasionally when user space is under heavy load (e.g. due to image
processing on the CPU) and new buffers aren't re-queued fast enough. In that
case, vb2_start_streaming_called can return true, but when the spinlock
is taken and sur40_poll attempts to fetch the next buffer from buf_list, the
list is in fact empty.
This patch needs to be applied on top of the queued one adding V4L2 support
to the sur40 driver.
The slock spinlock in the cx23885_dev struct is only initialised if analogue
video is being used, but is used in other places too, leading to the attached
lockdep complaint.
Move the lock initialisation so that it is done unconditionally.
[media] s5p-jpeg: Initialize jpeg_addr fields to zero
JPEG codecs on Exynos4 and Exynos3250 SoCs utilize different number
of planes for storing the raw image data, depending on the format
of the image being processed. For the unused planes a random data
was being written to the related registers. Regardless of the fact
that this seemed not to be harmful, fix the issue for clarity reasons.
Reported-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Laurent Pinchart [Wed, 15 May 2013 14:36:19 +0000 (11:36 -0300)]
[media] v4l: xilinx: Add Xilinx Video IP core
Xilinx platforms have no hardwired video capture or video processing
interface. Users create capture and memory to memory processing
pipelines in the FPGA fabric to suit their particular needs, by
instantiating video IP cores from a large library.
The Xilinx Video IP core is a framework that models a video pipeline
described in the device tree and expose the pipeline to userspace
through the media controller and V4L2 APIs.
Laurent Pinchart [Fri, 17 May 2013 10:31:04 +0000 (07:31 -0300)]
[media] v4l: of: Add v4l2_of_parse_link() function
The function fills a link data structure with the device node and port
number at both the local and remote ends of a link defined by one of its
endpoint nodes.
Hans Verkuil [Mon, 30 Mar 2015 16:54:13 +0000 (13:54 -0300)]
[media] ivtv: replace crop by selection
Replace the old g/s_crop ioctls by the new g/s_selection ioctls.
This solves a v4l2-compliance failure, and it is something that needs
to be done anyway to eventually be able to remove the old g/s_crop
ioctl ops.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sun, 15 Mar 2015 17:30:25 +0000 (14:30 -0300)]
[media] v4l2_plane_pix_format: use __u32 bytesperline instead of __u16
While running v4l2-compliance tests on vivid I suddenly got errors due to
a call to vmalloc_user with size 0 from vb2.
Digging deeper into the cause I discovered that this was due to the fact that
struct v4l2_plane_pix_format defines bytesperline as a __u16 instead of a __u32.
The test I was running selected a format of 4 * 4096 by 4 * 2048 with a 32
bit pixelformat.
So bytesperline was 4 * 4 * 4096 = 65536, which becomes 0 in a __u16. And
bytesperline * height is suddenly 0 as well. While the vivid driver may be
a virtual driver, it is to be expected that this limit will be hit for real
hardware as well in the near future: 8k deep-color video will already reach
it.
The solution is to change the type to __u32. The only drivers besides vivid
that use the multiplanar API are little-endian ARM and SH platforms (exynos,
ti-vpe, vsp1), so this is safe.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 9 Mar 2015 16:34:05 +0000 (13:34 -0300)]
[media] m2m-deinterlace: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
TechnoTrend TT-connect S2-4600 is a USB2.0 DVB-S/S2 tuner using the popular
Montage M88DS3103/M88TS2022 demod/tuner.
The demodulator needs a firmware. Antti posted a firmware when releasing
support for PCTV 461e, available here:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>