firefly-linux-kernel-4.4.55.git
9 years ago[media] vivid: add new format fields
Hans Verkuil [Sat, 7 Mar 2015 18:04:49 +0000 (15:04 -0300)]
[media] vivid: add new format fields

These fields are necessary to handle the new planar formats.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: split off the pattern drawing code
Hans Verkuil [Mon, 9 Mar 2015 14:52:43 +0000 (11:52 -0300)]
[media] vivid-tpg: split off the pattern drawing code

The last part of the vivid-tpg refactoring: split off the pattern
drawing code into a function of its own. This greatly improves the
readability and maintainability of this code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: move the 'extras' drawing to a separate function
Hans Verkuil [Mon, 9 Mar 2015 14:47:48 +0000 (11:47 -0300)]
[media] vivid-tpg: move the 'extras' drawing to a separate function

This moves the drawing code for the extras (border, square, etc) to
a function of its own instead of having this in the main for loop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: move 'extras' parameters to tpg_draw_params
Hans Verkuil [Mon, 9 Mar 2015 14:39:19 +0000 (11:39 -0300)]
[media] vivid-tpg: move 'extras' parameters to tpg_draw_params

Any parameters related to drawing 'extras' like the border, the square,
etc. are moved to struct tpg_draw_params.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: move pattern-related fields to struct tpg_draw_params
Hans Verkuil [Mon, 9 Mar 2015 14:30:05 +0000 (11:30 -0300)]
[media] vivid-tpg: move pattern-related fields to struct tpg_draw_params

Add a new function that fills in pattern-related fields in struct
tpg_draw_params.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: move common parameters to tpg_draw_params
Hans Verkuil [Mon, 9 Mar 2015 14:26:43 +0000 (11:26 -0300)]
[media] vivid-tpg: move common parameters to tpg_draw_params

Replace local variables by fields in the tpg_draw_params struct.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add a new tpg_draw_params structure
Hans Verkuil [Mon, 9 Mar 2015 14:07:23 +0000 (11:07 -0300)]
[media] vivid-tpg: add a new tpg_draw_params structure

This is needed to refactor the drawing function which is much too big.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add const where appropriate
Hans Verkuil [Mon, 9 Mar 2015 14:04:02 +0000 (11:04 -0300)]
[media] vivid-tpg: add const where appropriate

Added 'const' to several functions where that is possible to do.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add helper functions to simplify common calculations
Hans Verkuil [Sun, 8 Mar 2015 08:53:10 +0000 (05:53 -0300)]
[media] vivid-tpg: add helper functions to simplify common calculations

Add helper functions to handle horizontal downscaling and horizontal
scaling.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add support for V4L2_PIX_FMT_GREY
Hans Verkuil [Sat, 7 Mar 2015 17:57:50 +0000 (14:57 -0300)]
[media] vivid-tpg: add support for V4L2_PIX_FMT_GREY

Add monochrome support to the TPG.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add support for more planar formats
Hans Verkuil [Sat, 7 Mar 2015 17:55:09 +0000 (14:55 -0300)]
[media] vivid-tpg: add support for more planar formats

Now that the support for hor/vert downsampled planar formats is in
place we can add support for such formats to the TPG.

This patch adds support for:

V4L2_PIX_FMT_YUV420M
V4L2_PIX_FMT_YVU420M
V4L2_PIX_FMT_YUV420
V4L2_PIX_FMT_YVU420
V4L2_PIX_FMT_YUV422P
V4L2_PIX_FMT_NV16
V4L2_PIX_FMT_NV61
V4L2_PIX_FMT_NV12
V4L2_PIX_FMT_NV21
V4L2_PIX_FMT_NV12P
V4L2_PIX_FMT_NV21P

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: finish hor/vert downsampling support
Hans Verkuil [Sat, 7 Mar 2015 17:50:41 +0000 (14:50 -0300)]
[media] vivid-tpg: finish hor/vert downsampling support

Implement horizontal and vertical downsampling when filling in the
plane. The TPG is now ready to support such formats.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: add hor/vert downsampling support to tpg_gen_text
Hans Verkuil [Sat, 7 Mar 2015 17:23:16 +0000 (14:23 -0300)]
[media] vivid-tpg: add hor/vert downsampling support to tpg_gen_text

This will just skip lines/pixels since color fidelity is not quite
as important here as it is with the test patterns themselves.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: correctly average the two pixels in gen_twopix()
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>
9 years ago[media] vivid-tpg: precalculate downsampled lines
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>
9 years ago[media] vivid-tpg: add hor/vert downsampling fields
Hans Verkuil [Sat, 7 Mar 2015 16:57:27 +0000 (13:57 -0300)]
[media] vivid-tpg: add hor/vert downsampling fields

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>
9 years ago[media] vivid-tpg: add helper functions for single buffer planar formats
Hans Verkuil [Sat, 7 Mar 2015 16:39:01 +0000 (13:39 -0300)]
[media] vivid-tpg: add helper functions for single buffer planar formats

Add helpers functions to determine the line widths and image sizes
for planar formats that are stores in a single buffer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg: separate planes and buffers
Hans Verkuil [Sat, 7 Mar 2015 16:01:53 +0000 (13:01 -0300)]
[media] vivid-tpg: separate planes and buffers

Add a new field that contains the number of buffers. This may be
less than the number of planes in case multiple planes are combined
into one buffer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: do not allow video loopback for SEQ_TB/BT
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>
9 years ago[media] vivid-tpg: don't add offset when switching to monochrome
Hans Verkuil [Sat, 7 Mar 2015 15:53:39 +0000 (12:53 -0300)]
[media] vivid-tpg: don't add offset when switching to monochrome

The grayscale values are still full range sRGB, so don't add the
limited range offset.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: add new checkboard patterns
Hans Verkuil [Sat, 7 Mar 2015 15:49:57 +0000 (12:49 -0300)]
[media] vivid: add new checkboard patterns

Add a 2x2 checker patterns and 1x1 and 2x2 red/blue checker patterns.

Useful for testing 4:2:2 and 4:2:0 formats.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: fix test pattern movement for V4L2_FIELD_ALTERNATE
Hans Verkuil [Sat, 7 Mar 2015 15:38:42 +0000 (12:38 -0300)]
[media] vivid: fix test pattern movement for V4L2_FIELD_ALTERNATE

The successive TOP/BOTTOM fields did not move as they should: only
every other field actually changed position.

The cause was that the tpg needs to know if it is dealing with a
FIELD_ALTERNATE case since that requires slightly different handling.

So tell the TPG whether or not the field setting is for the ALTERNATE
case or not.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: use TPG_MAX_PLANES instead of hardcoding plane-arrays
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>
9 years ago[media] vivid: wrong top/bottom order for FIELD_ALTERNATE
Hans Verkuil [Fri, 6 Mar 2015 14:24:04 +0000 (11:24 -0300)]
[media] vivid: wrong top/bottom order for FIELD_ALTERNATE

The condition to decide whether the current field is top or bottom
was inverted. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: fix typo in plane size checks
Hans Verkuil [Sat, 7 Mar 2015 15:19:36 +0000 (12:19 -0300)]
[media] vivid: fix typo in plane size checks

The plane size check was hardcoded to plane 0 instead of using the plane
index.

This failed when using the NV61M format which has a larger plane size for
the second plane compared to the first plane.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: the overlay API wasn't disabled completely for multiplanar
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>
9 years ago[media] rcar-vin: Don't implement empty optional clock operations
Laurent Pinchart [Mon, 9 Mar 2015 06:39:35 +0000 (03:39 -0300)]
[media] rcar-vin: Don't implement empty optional clock operations

The clock_start and clock_stop operations are now optional, don't
implement empty stubs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] soc-camera: Make clock_start and clock_stop operations optional
Laurent Pinchart [Mon, 9 Mar 2015 06:39:34 +0000 (03:39 -0300)]
[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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] soc-camera: Unregister v4l2 clock in the OF bind error path
Laurent Pinchart [Mon, 9 Mar 2015 06:39:33 +0000 (03:39 -0300)]
[media] soc-camera: Unregister v4l2 clock in the OF bind error path

The v4l2 clock registered in soc_of_bind() must be unregistered if an
error occurs and makes the function fail.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: ov2640: add primary dt support
Josh Wu [Tue, 10 Feb 2015 09:31:35 +0000 (06:31 -0300)]
[media] media: ov2640: add primary dt support

Add device tree support for ov2640.
In device tree, user needs to provide the master clock (xvclk).
User can add the reset/pwdn pins if they have.

Cc: devicetree@vger.kernel.org
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: ov2640: dt: add the device tree binding document
Josh Wu [Tue, 10 Feb 2015 09:31:36 +0000 (06:31 -0300)]
[media] media: ov2640: dt: add the device tree binding document

Add the document for ov2640 dt.

Cc: devicetree@vger.kernel.org
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: ov2640: add async probe function
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.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: soc-camera: use icd->control instead of icd->pdev for reset()
Josh Wu [Tue, 10 Feb 2015 09:31:33 +0000 (06:31 -0300)]
[media] media: soc-camera: use icd->control instead of icd->pdev for reset()

icd->control is the sub device dev, i.e. i2c device.
icd->pdev is the soc camera device's device.

To be consitent with power() function, we will call reset() with
icd->control as well.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] V4L: add CCF support to the v4l2_clk API
Guennadi Liakhovetski [Sun, 1 Feb 2015 11:12:33 +0000 (08:12 -0300)]
[media] V4L: add CCF support to the v4l2_clk API

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.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] V4L: remove clock name from v4l2_clk API
Guennadi Liakhovetski [Sat, 31 Jan 2015 23:21:32 +0000 (20:21 -0300)]
[media] V4L: remove clock name from v4l2_clk API

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.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-ioctl: allow all controls if ctrl_class == 0
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>
9 years ago[media] v4l2-dev: disable selection ioctls for non-video devices
Hans Verkuil [Fri, 13 Mar 2015 16:25:53 +0000 (13:25 -0300)]
[media] v4l2-dev: disable selection ioctls for non-video devices

The selection/cropping ioctls are only valid for video nodes, not for vbi.

Found by v4l2-compliance when run on a VBI device node.

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>
9 years ago[media] au0828: fix broken streaming
Hans Verkuil [Fri, 13 Mar 2015 13:41:39 +0000 (10:41 -0300)]
[media] au0828: fix broken streaming

Commit c5036d61e0bed3f4f51391a145638b426825e69c ("media: au0828: drop
vbi_buffer_filled() and re-use buffer_filled()") broke video and vbi streaming.

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>
9 years ago[media] DocBook media: fix PIX_FMT_SGRBR8 example
Hans Verkuil [Fri, 13 Mar 2015 11:00:05 +0000 (08:00 -0300)]
[media] DocBook media: fix PIX_FMT_SGRBR8 example

Fix the example of the V4L2_PIX_FMT_SGRBG8 Bayer format.

The even lines should read BGBG, not RBRB.

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>
9 years ago[media] cx231xx: fix compiler warnings
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>
9 years ago[media] wl128x-radio really depends on TI_ST
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:

ERROR: "skb_queue_purge" [drivers/media/radio/wl128x/fm_drv.ko] undefined!
ERROR: "skb_push" [drivers/media/radio/wl128x/fm_drv.ko] undefined!
ERROR: "skb_pull" [drivers/media/radio/wl128x/fm_drv.ko] undefined!

Making the driver dependency explicit solves randconfig
build problems and makes it more obvious to the reader.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: fix compiler warning
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>
9 years ago[media] media: pci: cx23885: don't export static symbol
Julia Lawall [Wed, 11 Mar 2015 16:56:29 +0000 (13:56 -0300)]
[media] media: pci: cx23885: don't export static symbol

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
type T;
identifier f;
@@

static T f (...) { ... }

@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@

-EXPORT_SYMBOL(f);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: fix section IDs
Hans Verkuil [Wed, 11 Mar 2015 12:51:12 +0000 (09:51 -0300)]
[media] DocBook media: fix section IDs

The colorspace section IDs were assigned to the title instead of to the
section. Some links failed because of that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook v4l: update bytesperline handling
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>
9 years ago[media] MAINTAINERS: Update the maintainer mail address for stk1160
Ezequiel Garcia [Tue, 10 Mar 2015 14:43:20 +0000 (11:43 -0300)]
[media] MAINTAINERS: Update the maintainer mail address for stk1160

I'd rather use my work mail address to get patches, so let's update it.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stk1160: Make sure current buffer is released
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.

Cc: stable@vger.kernel.org
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: davinci: vpif_display: embed video_device struct in channel_obj
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.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: davinci: vpif_capture: embed video_device struct in channel_obj
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.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: blackfin: bfin_capture: embed video_device struct in bcap_device
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.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: blackfin: bfin_capture: drop bcap_get_unmapped_area()
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:52 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: drop bcap_get_unmapped_area()

this patch drops bcap_get_unmapped_area() and uses
vb2_fop_get_unmapped_area() helper provided by the vb2 core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: blackfin: bfin_capture: set v4l2 buffer sequence
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:51 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: set v4l2 buffer sequence

this patch adds support to set the v4l2 buffer sequence.

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>
9 years ago[media] media: blackfin: bfin_capture: add support for VIDIOC_EXPBUF
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:50 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: add support for VIDIOC_EXPBUF

this patch adds support for VIDIOC_EXPBUF.

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>
9 years ago[media] media: blackfin: bfin_capture: add support for VB2_DMABUF
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:49 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: add support for VB2_DMABUF

this patch adds support for VB2_DMABUF.

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>
9 years ago[media] media: blackfin: bfin_capture: add support for vidioc_create_bufs
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:48 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: add support for vidioc_create_bufs

this patch adds support for vidioc_create_bufs.

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>
9 years ago[media] media: blackfin: bfin_capture: return -ENODATA for *dv_timings calls
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:47 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: return -ENODATA for *dv_timings calls

this patch adds support to return -ENODATA for *dv_timings calls
if the current output does not support it.

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>
9 years ago[media] media: blackfin: bfin_capture: return -ENODATA for *std calls
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:46 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: return -ENODATA for *std calls

this patch adds supports to return -ENODATA to *_std calls
if the selected output does not support it.

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>
9 years ago[media] media: blackfin: bfin_capture: make sure all buffers are returned on stop_str...
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>
9 years ago[media] media: blackfin: bfin_capture: use vb2_ioctl_* helpers
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:44 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: use vb2_ioctl_* helpers

this patch adds support to vb2_ioctl_* helpers.

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>
9 years ago[media] media: blackfin: bfin_capture: use v4l2_fh_open and vb2_fop_release
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:43 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: use v4l2_fh_open and vb2_fop_release

this patch adds support to use v4l2_fh_open() and vb2_fop_release,
which allows to drop driver specific struct bcap_fh, as this is handled
by core.

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>
9 years ago[media] media: blackfin: bfin_capture: use vb2_fop_mmap/poll
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:42 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: use vb2_fop_mmap/poll

No need to reinvent the wheel. Just use the already existing
functions provided by vb2.

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>
9 years ago[media] media: blackfin: bfin_capture: improve queue_setup() callback
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:41 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: improve queue_setup() callback

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>
9 years ago[media] media: blackfin: bfin_capture: set vb2 buffer field
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:40 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: set vb2 buffer field

set the vb2 buffer field in buf_prepare() callback,
alongside drop local variable buf as we already have
a pointer to vb2 buffer.

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>
9 years ago[media] media: blackfin: bfin_capture: set min_buffers_needed
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>
9 years ago[media] media: blackfin: bfin_capture: release buffers in case start_streaming()...
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>
9 years ago[media] media: blackfin: bfin_capture: drop buf_init() callback
Lad, Prabhakar [Sun, 8 Mar 2015 14:40:37 +0000 (11:40 -0300)]
[media] media: blackfin: bfin_capture: drop buf_init() callback

this patch drops the buf_init() callback as init
of buf list is not required.

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>
9 years ago[media] vivid: BT.2020 R'G'B' is limited range
Hans Verkuil [Sun, 8 Mar 2015 07:53:33 +0000 (04:53 -0300)]
[media] vivid: BT.2020 R'G'B' is limited range

According to the standard the R'G'B' BT.2020 colorspace is limited
range, not full range. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] videodev2.h: fix comment
Hans Verkuil [Sun, 8 Mar 2015 07:53:32 +0000 (04:53 -0300)]
[media] videodev2.h: fix comment

The quantization comment in the header was incorrect w.r.t. BT.2020.
Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: BT.2020 RGB uses limited quantization range
Hans Verkuil [Sun, 8 Mar 2015 07:53:31 +0000 (04:53 -0300)]
[media] DocBook media: BT.2020 RGB uses limited quantization range

In contrast to all other colorspaces, the BT.2020 colorspace uses
limited range R'G'B' quantization as the default.

This was incorrected documented, so fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: fix xv601/709 formulas
Hans Verkuil [Sun, 8 Mar 2015 07:53:30 +0000 (04:53 -0300)]
[media] DocBook media: fix xv601/709 formulas

The denominator for the scaling and offsets is 256, not 255. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-ioctl: tidy up debug messages
Hans Verkuil [Sun, 8 Mar 2015 07:30:47 +0000 (04:30 -0300)]
[media] v4l2-ioctl: tidy up debug messages

Make sure the format fields are reported consistently.

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>
9 years ago[media] v4l2-framework.txt: debug -> dev_debug
Hans Verkuil [Sun, 8 Mar 2015 07:30:03 +0000 (04:30 -0300)]
[media] v4l2-framework.txt: debug -> dev_debug

The debug attribute was renamed to dev_debug. Update the doc accordingly.

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>
9 years ago[media] media: am437x-vpfe: embed video_device struct in vpfe_device
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.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: am437x-vpfe: return error in case memory allocation failure
Lad, Prabhakar [Sat, 7 Mar 2015 15:30:50 +0000 (12:30 -0300)]
[media] media: am437x-vpfe: return error in case memory allocation failure

return error in case devm_kzalloc() fails.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: am437x-vpfe: match the OF node/i2c addr instead of name
Lad, Prabhakar [Sat, 7 Mar 2015 15:30:49 +0000 (12:30 -0300)]
[media] media: am437x-vpfe: match the OF node/i2c addr instead of name

Instead of matching the subdevs with their name, match
it with OF node/ i2c address and adapter number.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] drivers: media: platform: vivid: Fix possible null derefrence
Tapasweni Pathak [Fri, 6 Mar 2015 02:39:40 +0000 (23:39 -0300)]
[media] drivers: media: platform: vivid: Fix possible null derefrence

Check for dev_fmt being null before derefrencing it, to assign it
to planes.

Found using Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] am437x: include linux/videodev2.h for expanding BASE_VIDIOC_PRIVATE
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.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2: check if vb2_fop_write/read is allowed
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>
9 years ago[media] media: am437x: Don't release OF node reference twice
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.

Fix the problem by removing the second call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Validate index during step-wise frame intervals enumeration
Laurent Pinchart [Fri, 6 Mar 2015 12:54:47 +0000 (09:54 -0300)]
[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>
9 years ago[media] uvcvideo: Recognize the Tasco USB microscope
Laurent Pinchart [Mon, 16 Feb 2015 18:30:10 +0000 (15:30 -0300)]
[media] uvcvideo: Recognize the Tasco USB microscope

The device is based on an Aveo chipset, implements UVC but advertises a
vendor-specific class on all interfaces.

Support it by listing the USB VID:PID explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Don't call vb2 mmap and get_unmapped_area with queue lock held
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.

Reported-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smiapp: Make pixel_order_str static
Sakari Ailus [Sun, 1 Feb 2015 00:11:46 +0000 (21:11 -0300)]
[media] smiapp: Make pixel_order_str static

pixel_order_str is only referred to in smiapp-core.c, it should be thus
static. Thanks to Hans Verkuil for pointing this out.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smiapp: Use of_property_read_u64_array() to read a 64-bit number array
Sakari Ailus [Sun, 30 Nov 2014 15:33:55 +0000 (12:33 -0300)]
[media] smiapp: Use of_property_read_u64_array() to read a 64-bit number array

of_property_read_u64_array() wasn't yet part of the kernel tree when the
functionality was needed. Do use it now.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF isn't...
Sakari Ailus [Mon, 16 Feb 2015 10:45:01 +0000 (07:45 -0300)]
[media] Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF isn't defined"

This reverts commit cb88d7384e5e05f90c1daa7750bdb467fd026261.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: s5p-mfc: fix broken pointer cast on 64bit arch
Marek Szyprowski [Wed, 4 Mar 2015 13:55:22 +0000 (10:55 -0300)]
[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]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: s5p-mfc: fix mmap support for 64bit arch
Marek Szyprowski [Wed, 4 Mar 2015 13:55:21 +0000 (10:55 -0300)]
[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).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Deprecate platform data support
Sakari Ailus [Wed, 25 Mar 2015 22:57:39 +0000 (19:57 -0300)]
[media] omap3isp: Deprecate platform data support

Print a warning when the driver is used with platform data. Existing
platform data users should move to DT now.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Add support for the Device Tree
Sakari Ailus [Wed, 25 Mar 2015 22:57:38 +0000 (19:57 -0300)]
[media] omap3isp: Add support for the Device Tree

Add the ISP device to omap3 DT include file and add support to the driver to
use it.

Also obtain information on the external entities and the ISP configuration
related to them through the Device Tree in addition to the platform data.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l: of: Read lane-polarities endpoint property
Sakari Ailus [Wed, 25 Mar 2015 22:57:37 +0000 (19:57 -0300)]
[media] v4l: of: Read lane-polarities endpoint property

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.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dt: bindings: Add lane-polarity property to endpoint nodes
Sakari Ailus [Wed, 25 Mar 2015 22:57:36 +0000 (19:57 -0300)]
[media] dt: bindings: Add lane-polarity property to endpoint nodes

Add lane-polarity property to endpoint nodes. This essentially tells that
the order of the differential signal wires is inverted.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Replace many MMIO regions by two
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>
9 years ago[media] omap3isp: Move the syscon register out of the ISP register maps
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>
9 years ago[media] omap3isp: Replace mmio_base_phys array with the histogram block base
Sakari Ailus [Wed, 25 Mar 2015 22:57:33 +0000 (19:57 -0300)]
[media] omap3isp: Replace mmio_base_phys array with the histogram block base

Only the histogram sub-block driver uses the physical address. Do not store
it for other sub-blocks.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Calculate vpclk_div for CSI-2
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.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Rename regulators to better suit the Device Tree
Sakari Ailus [Wed, 25 Mar 2015 22:57:31 +0000 (19:57 -0300)]
[media] omap3isp: Rename regulators to better suit the Device Tree

Rename VDD_CSIPHY1 as vdd-csiphy1 and VDD_CSIPHY2 as vdd-csiphy2.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Refactor device configuration structs for Device Tree
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>
9 years ago[media] omap3isp: Platform data could be NULL
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.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: DT support for clocks
Laurent Pinchart [Wed, 25 Mar 2015 22:57:28 +0000 (19:57 -0300)]
[media] omap3isp: DT support for clocks

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap3isp: Separate external link creation from platform data parsing
Sakari Ailus [Wed, 25 Mar 2015 22:57:27 +0000 (19:57 -0300)]
[media] omap3isp: Separate external link creation from platform data parsing

Move the code which connects the external entity to an ISP entity into a
separate function. This disconnects it from parsing the platform data.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>