Sean Young [Fri, 22 Feb 2019 09:08:05 +0000 (04:08 -0500)]
media: Revert "media: rc: some events are dropped by userspace"
When an rc device is created, we do not know what key codes it will
support, since a new keymap might be loaded at some later point. So,
we set all keybit in the input device.
The uevent for the input device includes all the key codes, of which
there are now 768. This overflows the size of the uevent
(UEVENT_BUFFER_SIZE) and no event is generated.
Revert for now until we figure out a different solution.
drivers/staging/media/imx/imx7-media-csi.c: In function 'imx7_csi_enum_mbus_code':
drivers/staging/media/imx/imx7-media-csi.c:926:33: warning: variable 'in_cc' set but not used [-Wunused-but-set-variable]
const struct imx_media_pixfmt *in_cc;
^~~~~
media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7
Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a MIPI
CSI-2 interface.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: clean up some alignment warnings] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This add the media entity subdevice and control driver for the i.MX7
CMOS Sensor Interface.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: clean up some alignment warnings] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
media: staging/imx: rearrange group id to take in account IPU
Some imx system do not have IPU, so prepare the imx media drivers to
support this kind of devices. Rename the group ids to include an _IPU_
prefix, add a new group id to support systems with only a CSI without
IPU, and also rename the create internal links to make it clear that
only systems with IPU have internal subdevices.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
media: staging/imx: refactor imx media device probe
Refactor and move media device initialization code to a new common
module, so it can be used by other devices, this will allow for example
a near to introduce imx7 CSI driver, to use this media device.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Patrick Lerda [Thu, 24 Jan 2019 00:04:20 +0000 (19:04 -0500)]
media: smipcie: add universal ir capability
smipcie: switch to RC_DRIVER_IR_RAW.
Signed-off-by: Patrick Lerda <patrick9876@free.fr> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Matthias Reichl [Thu, 7 Feb 2019 09:29:12 +0000 (04:29 -0500)]
media: rc: ir-rc6-decoder: enable toggle bit for Zotac remotes
The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit
rc6 protocol and toggle bit 15 (0x8000) on repeated button presses,
like MCE remotes.
Add the customer code 0x80340000 to the 32-bit rc6 toggle
handling code to get proper scancodes and toggle reports.
Signed-off-by: Matthias Reichl <hias@horus.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Patrick Lerda [Thu, 17 Jan 2019 08:50:13 +0000 (03:50 -0500)]
media: rc: rcmm decoder and encoder
media: add support for RCMM infrared remote controls.
Signed-off-by: Patrick Lerda <patrick9876@free.fr> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Akinobu Mita [Sun, 17 Feb 2019 15:17:47 +0000 (10:17 -0500)]
media: ov7740: fix runtime pm initialization
The runtime PM of this device is enabled after v4l2_ctrl_handler_setup(),
and this makes this device's runtime PM usage count a negative value.
The ov7740_set_ctrl() tries to do something only if the device's runtime
PM usage counter is nonzero.
ov7740_set_ctrl()
{
if (!pm_runtime_get_if_in_use(&client->dev))
return 0;
<do something>;
pm_runtime_put(&client->dev);
return ret;
}
However, the ov7740_set_ctrl() is called by v4l2_ctrl_handler_setup()
while the runtime PM of this device is not yet enabled. In this case,
the pm_runtime_get_if_in_use() returns -EINVAL (!= 0).
Therefore we can't bail out of this function and the usage count is
decreased by pm_runtime_put() without increment.
This fixes this problem by enabling the runtime PM of this device before
v4l2_ctrl_handler_setup() so that the ov7740_set_ctrl() is always called
when the runtime PM is enabled.
Cc: Wenyou Yang <wenyou.yang@microchip.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Tested-by: Eugen Hristev <eugen.hristev@microchip.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Dafna Hirschfeld [Fri, 15 Feb 2019 20:58:53 +0000 (15:58 -0500)]
media: vicodec: Add a flag for I-frames in fwht header
Add a flag 'FWHT_FL_I_FRAME' that indicates that
this is an I-frame. This requires incrementing
to version 3
This flag is needed for the upcoming stateless FWHT
decoder since it has to know if an encoded frame is
an I or a P frame.
Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
[hverkuil-cisco@xs4all.nl: added the last paragraph of the commit msg] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
media: cedrus: Forbid setting new formats on busy queues
Check that our queues are not busy before setting the format or return
EBUSY if that's the case. This ensures that our format can't change
once buffers are allocated for the queue.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Colin Ian King [Wed, 13 Feb 2019 13:25:59 +0000 (08:25 -0500)]
media: exynos4-is: remove redundant check on type
The check to see if type is V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE is redundant
as this has been already checked at the start of the function and if
it's not that value then -ENOSYS is returned. Hence the sprintf can be
replaced by a simpler string copy.
Detected by CoverityScan, CID#1309450 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
In every case, the actual return type is a struct vb2_v4l2_buffer
pointer. Change the return type of the listed functions,
so type checking can be properly used.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: clean up line-too-long checkpatch warnings] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tim Harvey [Tue, 5 Feb 2019 16:23:36 +0000 (11:23 -0500)]
media: tda1997x: fix get_edid
set_edid never wrote the new EDID to state->edid.edid, it was only
written to the hardware. Since get_edid returned state->edid.edid,
it was never returning the right EDID.
Signed-off-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: added missing commit log] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Chen-Yu Tsai [Sun, 3 Feb 2019 16:03:58 +0000 (11:03 -0500)]
media: sun6i: Add support for JPEG media bus format
The CSI controller can take raw data from the data bus and output it
directly to capture buffers. This can be used to support the JPEG media
bus format.
While the controller can report minimum and maximum bytes per line, it
has no way to report how many lines were captured in the last frame.
Thus, even when the on-bus data is framed correctly, we have no way to
accertain the actual amount of data captured, unless we scan the buffer
for JPEG EOI markers, or sequential zeros. For now we leave bytesused
alone, and leave it up to userspace applications to parse the data.
Chen-Yu Tsai [Sun, 3 Feb 2019 16:03:57 +0000 (11:03 -0500)]
media: sun6i: Add support for RGB565 formats
The CSI controller can take raw data from the data bus and output RGB565
format. The controller does not distinguish between RGB565 LE and BE.
Instead this is determined by the media bus format, i.e. the format or
order the sensor is sending data in.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Chen-Yu Tsai [Sun, 3 Feb 2019 16:03:56 +0000 (11:03 -0500)]
media: sun6i: Fix CSI regmap's max_register
max_register is currently set to 0x1000. This is beyond the mapped
address range of the hardware, so attempts to dump the regmap from
debugfs would trigger a kernel exception.
Furthermore, the useful registers only occupy a small section at the
beginning of the full range. Change the value to 0x9c, the last known
register on the V3s and H3.
On the A31, the register range is extended to support additional
capture channels. Since this is not yet supported, ignore it for now.
Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s") Cc: <stable@vger.kernel.org> Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 09:13:36 +0000 (04:13 -0500)]
media: vsp1: Fix smatch warning
drivers/media/platform/vsp1/vsp1_drm.c: drivers/media/platform/vsp1/vsp1_drm.c:336 vsp1_du_pipeline_setup_brx() error: we previously assumed 'pipe->brx' could be null (see line 244)
smatch missed that if pipe->brx was NULL, then later on it will be
set with a non-NULL value. But it is easier to just use the brx pointer
so smatch doesn't get confused.
Hans Verkuil [Fri, 1 Feb 2019 09:57:31 +0000 (04:57 -0500)]
media: uvcvideo: Use usb_make_path to fill in usb_info
The uvc driver uses this function to fill in bus_info for VIDIOC_QUERYCAP,
so use the same function when filling in the bus_info for the media device.
The current implementation only fills in part of the info. E.g. if the full
bus_info is usb-0000:01:00.0-1.4.2, then the media bus_info only has 1.4.2.
Hans Verkuil [Thu, 7 Feb 2019 09:13:35 +0000 (04:13 -0500)]
media: uvcvideo: Fix smatch warning
drivers/media/usb/uvc/uvc_video.c: drivers/media/usb/uvc/uvc_video.c:1893 uvc_video_start_transfer() warn: argument 2 to %u specifier is cast from pointer
Jagan Teki [Mon, 28 Jan 2019 08:58:44 +0000 (03:58 -0500)]
media: sun6i: Add A64 CSI block support
CSI block in Allwinner A64 has similar features as like in H3,
but the default CSI_SCLK rate cannot work properly to drive the
connected sensor interface.
The tested mod cock rate is 300 MHz and BSP vfe media driver is also
using the same rate. Unfortunately there is no valid information about
clock rate in manual or any other sources except the BSP driver. so more
faith on BSP code, because same has tested in mainline.
So, add support for A64 CSI block by setting updated mod clock rate.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Fri, 8 Feb 2019 09:53:50 +0000 (10:53 +0100)]
extended-controls.rst: split up per control class
The extended-controls.rst file had become too big. Split it up: each
control class reference gets its own rst file, and this file just
describes the Extended Control API.
Each control class reference is also moved up one level into the
table of contents to make it easier to find e.g. the codec control
reference.
Finally I rearranged the order so that all camera-related control
classes are grouped together, ditto for codec/jpeg and fm-rx/tx.
The ext-ctrls-codec.rst is still pretty big and it is a candidate
to split up further in the future, possibly per codec.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:48 +0000 (06:49 -0500)]
media: dvb-core: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in dvb_demux_poll(), dvb_dvr_poll() and
dvb_ca_en50221_io_poll(). Fix this, otherwise epoll()
can timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:47 +0000 (06:49 -0500)]
media: videobuf: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in videobuf_poll_stream(). Fix this, otherwise
epoll() would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:45 +0000 (06:49 -0500)]
media: v4l2-mem2mem: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in v4l2_m2m_poll(). Fix this, otherwise
epoll() would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:44 +0000 (06:49 -0500)]
media: v4l2-ctrls.c: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in v4l2_ctrl_poll(). Fix this, otherwise epoll()
would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:43 +0000 (06:49 -0500)]
media: vb2: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in vb2_core_poll() and vb2_poll(). Fix this,
otherwise epoll() would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Yi Qingliang <niqingliang2003@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:42 +0000 (06:49 -0500)]
media: media-request: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in media_request_poll(). Fix this, otherwise
epoll() would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Thu, 7 Feb 2019 11:49:41 +0000 (06:49 -0500)]
media: cec: fix epoll() by calling poll_wait first
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in cec_poll(). Fix this, otherwise epoll()
would timeout when it shouldn't.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Hans Verkuil [Mon, 4 Feb 2019 10:11:33 +0000 (05:11 -0500)]
media: vb2: keep track of timestamp status
If a stream is stopped, or if a USERPTR/DMABUF buffer is queued
backed by a different user address or dmabuf fd, then the timestamp
should be skipped by vb2_find_timestamp since the memory it refers
to is no longer valid.
So keep track of a 'copied_timestamp' state: it is set when the
timestamp is copied from an output to a capture buffer, and is
cleared when it is no longer valid.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Vivek Kasireddy [Sat, 9 Feb 2019 01:38:18 +0000 (20:38 -0500)]
media: imx-pxp: Start using the format VUYA32 instead of YUV32 (v2)
Buffers generated with YUV32 format seems to be incorrect, hence use
VUYA32 instead.
Changes from v1:
Add both formats VUYA32 and VUYX32 but associate only VUYX32 to the
output queue as the alpha channel of buffers is ignored on this queue.
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Vivek Kasireddy [Fri, 8 Feb 2019 03:18:43 +0000 (22:18 -0500)]
media: v4l: Add 32-bit packed YUV formats
The formats added in this patch include:
V4L2_PIX_FMT_AYUV32
V4L2_PIX_FMT_XYUV32
V4L2_PIX_FMT_VUYA32
V4L2_PIX_FMT_VUYX32
These formats enable the trasmission of alpha channel data to other
drivers and userspace applications in addition to YUV data. For
example, buffers generated by drivers in one of these formats
can be used by the Weston compositor to display as a texture or
flipped directly onto the overlay planes with the help of a DRM
driver.
Cody P Schafer [Tue, 15 Jan 2019 00:14:24 +0000 (19:14 -0500)]
media: cx25840: mark pad sig_types to fix cx231xx init
Without this, we get failures like this when the kernel attempts to
initialize a cx231xx device:
[16046.153653] cx231xx 3-1.2:1.1: New device Hauppauge Hauppauge Device @ 480 Mbps (2040:c200) with 6 interfaces
[16046.153900] cx231xx 3-1.2:1.1: can't change interface 3 alt no. to 3: Max. Pkt size = 0
[16046.153907] cx231xx 3-1.2:1.1: Identified as Hauppauge USB Live 2 (card=9)
[16046.154350] i2c i2c-11: Added multiplexed i2c bus 13
[16046.154379] i2c i2c-11: Added multiplexed i2c bus 14
[16046.267194] cx25840 10-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
[16048.424551] cx25840 10-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[16048.463224] cx231xx 3-1.2:1.1: v4l2 driver version 0.0.3
[16048.567878] cx231xx 3-1.2:1.1: Registered video device video2 [v4l2]
[16048.568001] cx231xx 3-1.2:1.1: Registered VBI device vbi0
[16048.568419] cx231xx 3-1.2:1.1: audio EndPoint Addr 0x83, Alternate settings: 3
[16048.568425] cx231xx 3-1.2:1.1: video EndPoint Addr 0x84, Alternate settings: 5
[16048.568431] cx231xx 3-1.2:1.1: VBI EndPoint Addr 0x85, Alternate settings: 2
[16048.568436] cx231xx 3-1.2:1.1: sliced CC EndPoint Addr 0x86, Alternate settings: 2
[16048.568448] usb 3-1.2: couldn't get decoder output pad for V4L I/O
[16048.568453] cx231xx 3-1.2:1.1: V4L2 device vbi0 deregistered
[16048.568579] cx231xx 3-1.2:1.1: V4L2 device video2 deregistered
[16048.569001] cx231xx: probe of 3-1.2:1.1 failed with error -22
Likely a regession since Commit 9d6d20e652c0
("media: v4l2-mc: switch it to use the new approach to setup pipelines")
(v4.19-rc1-100-g9d6d20e652c0), which introduced the use of
PAD_SIGNAL_DV within v4l2_mc_create_media_graph().
This also modifies cx25840 to remove the VBI pad, matching the action
taken in Commit 092a37875a22 ("media: v4l2: remove VBI output pad").
Fixes: 9d6d20e652c0 ("media: v4l2-mc: switch it to use the new approach to setup pipelines") Cc: stable@vger.kernel.org Signed-off-by: Cody P Schafer <dev@codyps.com> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
There is a spelling mistake in a fmdbg debug message. Fix it.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Sakari Ailus [Thu, 7 Feb 2019 13:50:48 +0000 (08:50 -0500)]
media: soc_camera: Depend on BROKEN
This patch makes the SoC camera framework as well as effectively the few
remaining sensor drivers depend on BROKEN, rendering it uncompileable
without changes in Kconfig.
The purpose is to leave the code around if someone wishes to convert the
drivers to the modern day V4L2 sub-device framework without having to go
to see development history in git.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Loic Poulain [Wed, 30 Jan 2019 16:48:07 +0000 (11:48 -0500)]
media: i2c: ov5640: Fix post-reset delay
According to the ov5640 specification (2.7 power up sequence), host can
access the sensor's registers 20ms after reset. Trying to access them
before leads to undefined behavior and result in sporadic initialization
errors.
Jagan Teki [Thu, 24 Jan 2019 17:58:01 +0000 (12:58 -0500)]
media: ov5640: Fix set 15fps regression
The ov5640_try_frame_interval operation updates the FPS as per user
input based on default ov5640_frame_rate, OV5640_30_FPS which is failed
to update when user trigger 15fps.
So, initialize the default ov5640_frame_rate to OV5640_15_FPS so-that
it can satisfy to update all fps.
Fixes: 5a3ad937bc78 ("media: ov5640: Make the return rate type more explicit") Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
The register value lists for all the supported resolution settings all
include a register address/value pair for setting the JPEG compression
mode. With the exception of 1080p (which sets mode 2), all resolutions
use mode 3.
The only difference between mode 2 and mode 3 is that mode 2 may have
padding data on the last line, while mode 3 does not add padding data.
As these register values were from dumps of running systems, and the
difference between the modes is quite small, using mode 3 for all
configurations should be OK.
Chen-Yu Tsai [Fri, 18 Jan 2019 08:52:05 +0000 (03:52 -0500)]
media: ov5640: Set JPEG output timings when outputting JPEG data
When compression is turned on, the on-bus data is framed according to
the compression mode, and the height and width set in VFIFO_VSIZE and
VFIFO_HSIZE. If these are not updated correctly, the sensor will send
data framed in a manner unexpected by the capture interface, such as
having more bytes per line than expected, and having the extra data
dropped. This ultimately results in corrupted data.
Set the two values when the media bus is configured for JPEG data,
meaning the sensor would be in JPEG mode.
Chen-Yu Tsai [Fri, 18 Jan 2019 08:52:04 +0000 (03:52 -0500)]
media: ov5640: Add three more test patterns
The OV5640 driver currently supports a static color bar pattern with a
small vertical gamma gradient. The hardware also supports a color square
pattern, as well as having a rolling bar for dynamic sequences.
Add three more test patterns:
- color bars with a rolling bar (but without the gamma gradient)
- static color squares
- color squares with a rolling bar
Chen-Yu Tsai [Fri, 18 Jan 2019 08:52:03 +0000 (03:52 -0500)]
media: ov5640: Disable transparent feature for test pattern
The transparent feature for test patterns blends the test pattern with
an actual captured image. This makes the result non-static, subject to
changes in the sensor's field of view.
Test patterns should be predictable and deterministic, even if they are
dynamic patterns. Disable the transparent feature of the test pattern.
Chen-Yu Tsai [Fri, 18 Jan 2019 08:52:01 +0000 (03:52 -0500)]
media: ov5640: Move test_pattern_menu before ov5640_set_ctrl_test_pattern
The OV5640 has many options for generating test patterns. Unfortunately
there is only one V4L2 control for it. Thus the driver would need to
list some or all combinations.
Move the test_pattern_menu list before the ov5640_set_ctrl_test_pattern
function that programs the hardware. This would allow us to add a
matching list of values to program into the hardware, while keeping the
two lists together for ease of maintenance.
Jacopo Mondi [Thu, 10 Jan 2019 14:02:13 +0000 (09:02 -0500)]
media: adv748x: Implement TX link_setup callback
When the adv748x driver is informed about a link being created from HDMI or
AFE to a CSI-2 TX output, the 'link_setup()' callback is invoked. Make
sure to implement proper routing management at link setup time, to route
the selected video stream to the desired TX output.
Jacopo Mondi [Thu, 10 Jan 2019 14:02:12 +0000 (09:02 -0500)]
media: adv748x: Store the TX sink in HDMI/AFE
Both the AFE and HDMI s_stream routines (adv748x_afe_s_stream() and
adv748x_hdmi_s_stream()) have to enable the CSI-2 TX they are streaming video
data to.
With the introduction of dynamic routing between HDMI and AFE entities to
TXA, the video stream sink needs to be set at run time, and not statically
selected as the s_stream functions are currently doing.
To fix this, store a reference to the active CSI-2 TX sink for both HDMI and
AFE sources, and operate on it when starting/stopping the stream.
Jacopo Mondi [Thu, 10 Jan 2019 14:02:11 +0000 (09:02 -0500)]
media: adv748x: Store the source subdevice in TX
The power_up_tx() procedure needs to set a few registers conditionally to
the selected video source, but it currently checks for the provided tx to
be either TXA or TXB.
With the introduction of dynamic routing between HDMI and AFE entities to
TXA, checking which TX the function is operating on is not meaningful anymore.
To fix this, store the subdevice of the source providing video data to the
CSI-2 TX in the 'struct adv748x_csi2' representing the TX and check on it.
Jacopo Mondi [Thu, 10 Jan 2019 14:02:10 +0000 (09:02 -0500)]
media: adv748x: csi2: Link AFE with TXA and TXB
The ADV748x chip supports routing AFE output to either TXA or TXB.
In order to support run-time configuration of video stream path, create an
additional (not enabled) "AFE:8->TXA:0" link, and remove the IMMUTABLE flag
from existing ones.
Remove unused but set variables to clean up the code and avoid
warning.
Signed-off-by: Lucas A. M. Magalhães <lucmaga@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
media: imx: Set capture compose rectangle in capture_device_set_format
The capture compose rectangle was not getting updated when setting
the source subdevice's source pad format. This causes the compose window
to be zero (or not updated) at stream start unless the capture device
format was set explicitly at the capture device node.
Fix by moving the calculation of the capture compose rectangle to
imx_media_mbus_fmt_to_pix_fmt(), and pass the rectangle to
imx_media_capture_device_set_format().