[media] omap3isp: preview: Fix the crop margins

Commit 3fdfedaaa "[media] omap3isp: preview: Lower the crop margins"
accidentally changed the previewer's cropping, causing the previewer
to miss four pixels on each line, thus corrupting the final image.
Restored the removed setting.

Cc: stable@vger.kernel.org
Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] omap3isp: Don't try to locate external subdev for mem-to-mem pipelines

Memory-to-memory pipelines have no external subdev, we shouldn't try to
locate one and validate its configuration. The driver currently works by
chance due to another bug that results in failure to locate the external
subdev being ignored.

This gets rid of the "omap3isp omap3isp: can't find source, failing now"
error message in the kernel log when operating on a memory-to-memory
pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Tested-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] omap3isp: Don't ignore failure to locate external subdev

A failure to locate the external subdev for a non memory-to-memory
pipeline is a fatal error, don't ignore it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Tested-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] ARM: omap2: cm-t35: Add regulators and clock for camera sensor

The camera sensor will soon require regulators and clocks. Register
fixed regulators for its VAA and VDD power supplies and a fixed rate
clock for its master clock.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9t001: Add regulator support

The sensor needs two power supplies, VAA and VDD. Require a regulator
for each of them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9t001: Add clock support

The sensor needs a master clock, handle it explictly in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9p031: Fix typo in comment

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9p031: Add support for PLL bypass

When the input clock frequency is out of bounds for the PLL, bypass the
PLL and just divide the input clock to achieve the requested output
frequency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9p031: Check return value of clk_prepare_enable/clk_set_rate

clk_set_rate(), clk_prepare_enable() functions can fail, so check the return
values to avoid surprises.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] mt9v032: Check return value of clk_prepare_enable/clk_set_rate

clk_set_rate(), clk_prepare_enable() functions can fail, so check the return
values to avoid surprises.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] uvcvideo: Simplify redundant check

x < constant implies x + unsigned < constant
That check just obfuscates the code

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] uvcvideo: Update uvc_endpoint_max_bpi to handle USB_SPEED_WIRELESS devices

Isochronous endpoints on devices with speed == USB_SPEED_WIRELESS can
have a max packet size ranging from 1-3584 bytes.  Add a case to
uvc_endpoint_max_bpi to handle USB_SPEED_WIRELESS.  Otherwise endpoints
for those devices will fall to the default case which masks off any
values > 2047.  This causes uvc_init_video to underestimate the
bandwidth available and fail to find a suitable alt setting for high
bandwidth video streams.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] uvcvideo: Remove duplicate check for number of buffers in queue_setup

videobuf2 already ensures that the number of buffers will not exceed
VIDEO_MAX_FRAME, which is equal to our arbitraty limit of
UVC_MAX_VIDEO_BUFFERS. Remove the duplicate check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] uvcvideo: Support allocating buffers larger than the current frame size

The queue_setup handler takes an optional format argument that can be
used to allocate buffers for a format different than the current format.
The uvcvideo driver doesn't support changing the format when buffers
have been allocated, but there's no reason not to support allocating
buffers larger than the minimum size.

When the format argument isn't NULL verify that the requested image size
is large enough for the current format and use it for the buffer size.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] uvcvideo: Enable VIDIOC_CREATE_BUFS

This patch enables the ioctl to create additional buffers on the
videobuf2 capture queue.

[laurent.pinchart@ideasonboard.com: Acquire privileges instead of just
checking them in VIDIOC_CREATE_BUFS implementation]

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] staging: davinci_vpfe: fix error check

The check would check the pointer, which is never less than 0.
According to the error message, the correct check would be
to check the return value of ipipe_mode. Check that instead.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Levente Kurusa <levex@linux.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] davinci: vpfe: remove deprecated IRQF_DISABLED

This patch proposes to remove the use of the IRQF_DISABLED flag

It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] s2255drv: removal of s2255_dmaqueue structure

Removal of unused and unnecessary s2255dma_queue structure.

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] s2255drv: refactoring s2255_channel to s2255_vc

Renaming s2255_channel and all instances of channel to vc (video channel).

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] s2255drv: buffer setup fix

Buffer setup should check if minimum number of buffers is used.

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>