Hans Verkuil [Sat, 7 Mar 2015 17:15:25 +0000 (14:15 -0300)]
[media] vivid-tpg: correctly average the two pixels in gen_twopix()
gen_twopix() is always called twice: once for the first and once for
the second pixel. Improve the code to properly average the two if the
format requires horizontal downsampling.
This is necessary for patterns like 1x1 red/blue checkers.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 7 Mar 2015 17:06:43 +0000 (14:06 -0300)]
[media] vivid-tpg: precalculate downsampled lines
When dealing with vertical downsampling two successive lines have to be
averaged. In the case of the test pattern generator that only happens
if the two lines are using different patterns. So precalculate the average
between two pattern lines: one of pattern P and one of pattern P + 1.
That way there is no need to do any on-the-fly downsampling: it's all done
in the precalculate phase.
This patch also implements horizontal downsampling in the precalculate phase.
The only thing that needs to be done is to half the width since the actual
downsampling happens when two pixels at a time are generated.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This is step one of supporting horizontal and vertical downsampling.
This just adds support for the h/vdownsampling fields and it increases
the maximum number of planes to 3.
Currently none of the planar formats need horizontal or vertical
downsampling, so this change has no effect at the moment.
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 13:06:55 +0000 (10:06 -0300)]
[media] vivid: do not allow video loopback for SEQ_TB/BT
Sequential top-bottom/bottom-top fields are not supported as video loopback.
This is too much work to implement for field settings that are rarely used.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 7 Mar 2015 15:30:43 +0000 (12:30 -0300)]
[media] vivid: use TPG_MAX_PLANES instead of hardcoding plane-arrays
Two arrays of size 'max number of planes' have a hardcoded size instead
of using TPG_MAX_PLANES. Fix that, since TPG_MAX_PLANES will be increased
later on.
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 15:34:32 +0000 (12:34 -0300)]
[media] vivid: the overlay API wasn't disabled completely for multiplanar
If the vivid driver is loaded in multiplanar mode, then the capture overlay
functionality should be disabled. This wasn't fully done, which led to
v4l2-compliance errors.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] soc-camera: Make clock_start and clock_stop operations optional
Instead of forcing drivers to implement empty clock operations, make
them optional.
v4l2 clock registration in the soc-camera core should probably be
conditionned on the availability of those operations, but careful
review and/or testing of all drivers would be needed, so that should be
a separate step.
Josh Wu [Mon, 2 Mar 2015 01:52:38 +0000 (22:52 -0300)]
[media] media: ov2640: add async probe function
In async probe, there is a case that ov2640 is probed before the
host device which provided 'mclk'.
To support this async probe, we will get 'mclk' at first in the probe(),
if failed it will return -EPROBE_DEFER. That will let ov2640 wait for
the host device probed.
V4L2 clocks, e.g. used by camera sensors for their master clock, do not
have to be supplied by a different V4L2 driver, they can also be
supplied by an independent source. In this case the standart kernel
clock API should be used to handle such clocks. This patch adds support
for such cases.
All uses of the v4l2_clk API so far only register one clock with a fixed
name. This allows us to get rid of it, which also will make CCF and DT
integration easier.
Hans Verkuil [Sat, 14 Mar 2015 16:28:25 +0000 (13:28 -0300)]
[media] v4l2-ioctl: allow all controls if ctrl_class == 0
The check_ext_ctrls() function in v4l2-ioctl.c checks if all controls in the
control array are from the same control class as c->ctrl_class. However,
that check should only be done if c->ctrl_class != 0. A 0 value means
that this restriction does not apply.
So return 1 (OK) if c->ctrl_class == 0.
Found by running v4l2-compliance on the uvc driver.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The vb2_buffer struct was copied instead of taking a pointer to it, but
vb2_buffer_done() needs the real object, not a copy, since it is hooking
the buffer into a different list.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 13 Mar 2015 10:00:07 +0000 (07:00 -0300)]
[media] cx231xx: fix compiler warnings
If CONFIG_VIDEO_CX231XX_RC is undefined, then these compiler warnings
are generated:
In file included from drivers/media/usb/cx231xx/cx231xx-cards.c:23:0:
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_release_resources’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
#define cx231xx_ir_exit(dev) (0)
^
drivers/media/usb/cx231xx/cx231xx-cards.c:1158:2: note: in expansion of macro ‘cx231xx_ir_exit’
cx231xx_ir_exit(dev);
^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_init_dev’:
drivers/media/usb/cx231xx/cx231xx.h:981:30: warning: statement with no effect [-Wunused-value]
#define cx231xx_ir_init(dev) (0)
^
drivers/media/usb/cx231xx/cx231xx-cards.c:1351:2: note: in expansion of macro ‘cx231xx_ir_init’
cx231xx_ir_init(dev);
^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_probe’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
#define cx231xx_ir_exit(dev) (0)
^
drivers/media/usb/cx231xx/cx231xx-cards.c:1705:2: note: in expansion of macro ‘cx231xx_ir_exit’
cx231xx_ir_exit(dev);
^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_disconnect’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
#define cx231xx_ir_exit(dev) (0)
^
drivers/media/usb/cx231xx/cx231xx-cards.c:1754:3: note: in expansion of macro ‘cx231xx_ir_exit’
cx231xx_ir_exit(dev);
^
Fix by using static inlines instead of defines.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Arnd Bergmann [Thu, 12 Mar 2015 10:29:42 +0000 (07:29 -0300)]
[media] wl128x-radio really depends on TI_ST
All other drivers using the TI_ST infrastructure use
'depends on' for this symbol, and it makes no sense
to only enable that if CONFIG_NET is enable, because
the radio driver also depends on CONFIG_NET itself:
Hans Verkuil [Thu, 12 Mar 2015 07:27:43 +0000 (04:27 -0300)]
[media] rtl2832: fix compiler warning
>From the daily build:
rtl2832.c: In function 'rtl2832_read_status':
rtl2832.c:703:12: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
} else if (tmp == 10) {
^
The code is OK, it's just the compiler that cannot figure out what's
going on. So just init 'tmp' to 0.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Wed, 11 Mar 2015 12:00:45 +0000 (09:00 -0300)]
[media] DocBook v4l: update bytesperline handling
The documentation says that the bytesperline field in v4l2_pix_format refers
to the largest plane in the case of planar formats (i.e. multiple planes
stores in a single buffer).
For almost all planar formats the first plane is also the largest (or equal)
plane, except for two formats: V4L2_PIX_FMT_NV24/NV42. For this YUV 4:4:4
format the second chroma plane is twice the size of the first luma plane.
Looking at the very few drivers that support this format the bytesperline
value that they report is actually that of the first plane and not that
of the largest plane.
Rather than fixing the drivers it makes more sense to update the documentation
since it is very difficult to use the largest plane for this. You would have
to check what the format is in order to know to which plane bytesperline
belongs, which makes calculations much more difficult.
This patch updates the documentation accordingly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Ezequiel Garcia [Tue, 10 Mar 2015 14:37:14 +0000 (11:37 -0300)]
[media] stk1160: Make sure current buffer is released
The available (i.e. not used) buffers are returned by stk1160_clear_queue(),
on the stop_streaming() path. However, this is insufficient and the current
buffer must be released as well. Fix it.
Lad, Prabhakar [Sun, 8 Mar 2015 21:57:24 +0000 (18:57 -0300)]
[media] media: davinci: vpif_display: embed video_device struct in channel_obj
Embed video_device struct (video_dev) in channel_obj and also the
Unregister path doesn't need to free the video_device structure,
hence, change the video_device.release callback point to
video_device_release_empty.
Lad, Prabhakar [Sun, 8 Mar 2015 21:57:23 +0000 (18:57 -0300)]
[media] media: davinci: vpif_capture: embed video_device struct in channel_obj
Embed video_device struct (video_dev) in channel_obj and also the
Unregister path doesn't need to free the video_device structure,
hence, change the video_device.release callback point to
video_device_release_empty.
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:53 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: embed video_device struct in bcap_device
Embed video_device struct (video_dev) in bcap_device and
Unregister path doesn't need to free the video_device
structure, hence, change the video_device.release callback
point to video_device_release_empty.
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:45 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: make sure all buffers are returned on stop_streaming() callback
In start_streaming() callback the buffer is removed from the
dma_queue list and assigned to cur_frm, this patch makes sure
that is returned to vb2 core with VB2_BUF_STATE_ERROR flag.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Tested-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This patch does the following:
a: returns -EINVAL in case format image size is less
then current image size.
b: assigns nbuffers to two in case the total of vq->num_buffers
and nbuffers is less then the number of buffers required by driver.
c: sets the sizes[0] of plane according to the fmt passed or which is
being set in the device.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Tested-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:39 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: set min_buffers_needed
this patch sets the min_buffers_needed field of the vb2 queue
so that the vb2 core will make sure start_streaming() callback
is called only when we have minimum buffers queued.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Tested-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:38 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: release buffers in case start_streaming() call back fails
this patch adds support to release the buffer by calling
vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
if start_streaming() call back fails.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Tested-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Lad, Prabhakar [Sat, 7 Mar 2015 16:12:09 +0000 (13:12 -0300)]
[media] media: am437x-vpfe: embed video_device struct in vpfe_device
Embed video_device struct (video_dev) in vpfe_device and
Unregister path doesn't need to free the video_device
structure, hence, change the video_device.release callback
point to video_device_release_empty.
Masatake YAMATO [Wed, 4 Mar 2015 20:13:24 +0000 (17:13 -0300)]
[media] am437x: include linux/videodev2.h for expanding BASE_VIDIOC_PRIVATE
In am437x-vpfe.h BASE_VIDIOC_PRIVATE is used for
making the name of ioctl command(VIDIOC_AM437X_CCDC_CFG).
The definition of BASE_VIDIOC_PRIVATE is in linux/videodev2.h.
However, linux/videodev2.h is not included in am437x-vpfe.h.
As the result an application using has to include both
am437x-vpfe.h and linux/videodev2.h.
With this patch, the application can include just am437x-vpfe.h.
Hans Verkuil [Tue, 3 Mar 2015 11:23:59 +0000 (08:23 -0300)]
[media] vb2: check if vb2_fop_write/read is allowed
Return -EINVAL if read() or write() is not supported by the queue. This
makes it possible to provide both vb2_fop_read and vb2_fop_write in a
struct v4l2_file_operations since the vb2_fop_* function will check if
the file operation is allowed.
A similar check exists in __vb2_init_fileio() which is called from
__vb2_perform_fileio(), but that check is only done if no file I/O is
active. So the sequence of read() followed by write() would be allowed,
which is obviously a bug.
In addition, vb2_fop_write/read should always return -EINVAL if the
operation is not allowed, and by putting the check in the lower levels
of the code it is possible that other error codes are returned (EBUSY
or ERESTARTSYS).
All these issues are avoided by just doing a quick explicit check.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Laurent Pinchart [Mon, 23 Feb 2015 14:49:21 +0000 (11:49 -0300)]
[media] media: am437x: Don't release OF node reference twice
The remote port reference is released both at the end of the OF graph
parsing loop, and in the error code path at the end of the function.
Those two calls will release the same reference, causing the reference
count to go negative.
[media] uvcvideo: Validate index during step-wise frame intervals enumeration
Frame intervals exposed as an interval and step (so-called step-wise)
are restricted by the V4L2 API to a single enumeration entry. Return an
error when the index is not zero.
Reported-by: Alexey Smirnoff <fling@member.fsf.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[mchehab@osg.samsung.com: add a missing collon at the end of the return
statement, in order to avoid compilation breakage] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Laurent Pinchart [Mon, 16 Feb 2015 17:38:28 +0000 (14:38 -0300)]
[media] uvcvideo: Don't call vb2 mmap and get_unmapped_area with queue lock held
videobuf2 has long been subject to AB-BA style deadlocks due to the
queue lock and mmap_sem being taken in different orders for the mmap and
get_unmapped_area operations. The problem has been fixed by making those
two operations callable without taking the queue lock, using an
mmap_lock internal to videobuf2.
The uvcvideo driver still calls the mmap and get_unmapped_area
operations with the queue lock held, resulting in a potential deadlock.
As the operations can now be called without locking the queue, fix it.
[media] media: s5p-mfc: fix broken pointer cast on 64bit arch
Unsigned int cannot be used to store casted pointer on 64bit
architecture, so correct such casts to properly use unsigned long
variables.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com>
[k.debski@samsung.com: removed volatile and __iomem from cast]
[media] media: s5p-mfc: fix mmap support for 64bit arch
TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it
should not be used for defining offset boundary for mmaping buffers for
CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on
the CAPTURE queue on 64bit architectures (like ARM64).
Add lane_polarities field to struct v4l2_of_bus_mipi_csi2 and write the
contents of the lane-polarities property to it. The field tells the polarity
of the physical lanes starting from the first one. Any unused lanes are
ignored, i.e. only the polarity of the used lanes is specified.
Also rework reading the "data-lanes" property a little.
Sakari Ailus [Wed, 25 Mar 2015 22:57:35 +0000 (19:57 -0300)]
[media] omap3isp: Replace many MMIO regions by two
The omap3isp MMIO register block is contiguous in the MMIO register space
apart from the fact that the ISP IOMMU register block is in the middle of
the area. Ioremap it at two occasions, and keep the rest of the layout of
the register space internal to the omap3isp driver.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 25 Mar 2015 22:57:34 +0000 (19:57 -0300)]
[media] omap3isp: Move the syscon register out of the ISP register maps
The syscon register isn't part of the ISP, use it through the syscom driver
regmap instead. The syscom block is considered to be from 343x on ISP
revision 2.0 whereas 15.0 is assumed to have 3630 syscon.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 25 Mar 2015 22:57:32 +0000 (19:57 -0300)]
[media] omap3isp: Calculate vpclk_div for CSI-2
The video port clock is l3_ick divided by vpclk_div. This clock must be high
enough for the external pixel rate. The video port requires two clock cycles
to process a pixel.
Sakari Ailus [Wed, 25 Mar 2015 22:57:30 +0000 (19:57 -0300)]
[media] omap3isp: Refactor device configuration structs for Device Tree
Make omap3isp configuration data structures more suitable for consumption by
the DT by separating the I2C bus information of all the sub-devices in a
group and the ISP bus information from each other. The ISP bus information
is made a pointer instead of being directly embedded in the struct.
In the case of the DT only the sensor specific information on the ISP bus
configuration is retained. The structs are renamed to reflect that.
After this change the structs needed to describe device configuration can be
allocated and accessed separately without those needed only in the case of
platform data. The platform data related structs can be later removed once
the support for platform data can be removed.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Igor Grinberg <grinberg@compulab.co.il> (for cm-t35) Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 25 Mar 2015 22:57:29 +0000 (19:57 -0300)]
[media] omap3isp: Platform data could be NULL
Only check for call platform data callback functions if there's platform
data. Also take care of a few other cases where the NULL pdata pointer could
have been accessed, and remove the check for NULL dev->platform_data
pointer.
Removing the check for NULL dev->platform_data isn't strictly needed by the
DT support but there's no harm from that either: the device now can be used
without sensors, for instance.
Sakari Ailus [Wed, 25 Mar 2015 22:57:26 +0000 (19:57 -0300)]
[media] omap3isp: Avoid a BUG_ON() in media_entity_create_link()
If an uninitialised v4l2_subdev struct was passed to
media_entity_create_link(), one of the BUG_ON()'s in the function will be
hit since media_entity.num_pads will be zero. Avoid this by checking whether
the num_pads field is non-zero for the interface.
Laurent Pinchart [Sat, 21 Feb 2015 20:59:54 +0000 (17:59 -0300)]
[media] media: omap3isp: hist: Move histogram DMA to DMA engine
Replace the custom OMAP DMA API usage by DMA engine. Feature-wise the
driver has lost the ability to get notified of DMA transfers failure
through the completion handler, as the DMA engine API doesn't expose
that status information.
Laurent Pinchart [Tue, 24 Feb 2015 10:39:49 +0000 (07:39 -0300)]
[media] media: omap3isp: video: Don't call vb2 mmap with queue lock held
videobuf2 has long been subject to AB-BA style deadlocks due to the
queue lock and mmap_sem being taken in different orders for the mmap
operation. The problem has been fixed by making this operation callable
without taking the queue lock, using an mmap_lock internal to videobuf2.
The omap3isp driver still calls the mmap operation with the queue lock
held, resulting in a potential deadlock. As the operation can now be
called without locking the queue, fix it.
Markus Elfring [Sun, 1 Feb 2015 18:34:37 +0000 (15:34 -0300)]
[media] mn88472: One function call less in mn88472_init() after error detection
The release_firmware() function was called in three cases by the mn88472_init()
function during error handling even if the passed variable "fw" contained still
a null pointer.
This implementation detail could be improved by the introduction of another
jump label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>