linux-2.6-microblaze.git
3 years agomedia: rc: add keymap for KHAMSIN remote
Christian Hewitt [Wed, 25 Nov 2020 11:07:21 +0000 (12:07 +0100)]
media: rc: add keymap for KHAMSIN remote

This remote ships with the Amlogic SML-5442TW IPTV/VOD Set-Top Box
used by O2.cz. This keymap adds support for the default IR controls.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvb-usb: Add Hauppauge MAX S2's USB-IDs
Kai Muenz [Tue, 6 Oct 2020 18:13:09 +0000 (20:13 +0200)]
media: dvb-usb: Add Hauppauge MAX S2's USB-IDs

Hauppauge MAX S2 or WinTV NOVA HD USB2.0.

Signed-off-by: Kai Muenz <squ@tent.at>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: siano: fix memory leak of debugfs members in smsdvb_hotplug
Keita Suzuki [Wed, 9 Sep 2020 12:56:57 +0000 (14:56 +0200)]
media: siano: fix memory leak of debugfs members in smsdvb_hotplug

When dvb_create_media_graph fails, the debugfs kept inside client should
be released. However, the current implementation does not release them.

Fix this by adding a new goto label to call smsdvb_debugfs_release.

Fixes: 0d3ab8410dcb ("[media] dvb core: must check dvb_create_media_graph()")
Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rc: improve LIRC documentation
Mauro Carvalho Chehab [Thu, 26 Nov 2020 12:55:39 +0000 (13:55 +0100)]
media: rc: improve LIRC documentation

Add documentation for enum rc_proto and struct lirc_scancode
at the generated docs.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
3 years agomedia: docs: uAPI: rc: dual-license the docs with GPL v2
Mauro Carvalho Chehab [Thu, 26 Nov 2020 11:13:36 +0000 (12:13 +0100)]
media: docs: uAPI: rc: dual-license the docs with GPL v2

Make the license for those documents also compatible with GPLv2.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
3 years agomedia: camss: csiphy: Set rate on csiX_phy clock on SDM630/660
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:06 +0000 (19:47 +0200)]
media: camss: csiphy: Set rate on csiX_phy clock on SDM630/660

The SDM630/660 SoCs (and variants) have another clock source
for the PHY, which must be set to a rate that's equal or
greater than the CSI PHY timer clock: failing to do this
will produce PHY overflows when trying to get a stream from
a very high bandwidth camera sensor and outputting no frame
or a partial one.

Since I haven't found any usecase in which the csiX_phy
clock needs to be higher than the csiXphy_timer, let's just
set the same rate on both, which seems to work just perfect.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: csiphy-3ph: Add support for SDM630/660
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:04 +0000 (19:47 +0200)]
media: camss: csiphy-3ph: Add support for SDM630/660

The CSIPHY on SDM630/660 needs a slightly longer T_HS_CLK_MISS
configuration on lanes CFG4.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: Add support for SDM630/636/660 camera subsystem
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:03 +0000 (19:47 +0200)]
media: camss: Add support for SDM630/636/660 camera subsystem

Add support for the Qualcomm SDM630/636/660 and SDA variants' camera
subsystem. These SoCs are equipped with:
- 3x CSI PHY 3-Phase v1.0 (downstream csiphy-v3.5)
- 4x CSID v5.0
- 2x ISPIF v3.0
- 2x VFE 4.8
As a note, this camera subsystem is very similar to the one that
is found in the MSM8998/APQ8098 SoCs.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:05 +0000 (19:47 +0200)]
media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss

Add bindings for qcom,sdm660-camss in order to support the camera
subsystem on SDM630/660 and SDA variants.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: vfe: Add support for VFE 4.8
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:02 +0000 (19:47 +0200)]
media: camss: vfe: Add support for VFE 4.8

Add the support for VFE 4.8 in the camss-vfe-4-7 driver, as this one
really is a minor revision, requiring the very same management and
basically having the same register layout as VFE 4.7, but needing
a different QoS and DS configuration, using a different register to
enable the wm and habing the same UB size for both instances (instead
of a different size between instance 0 and 1).

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: vfe-4-7: Rename get_ub_size, set_qos, set_ds, wm_enable
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:01 +0000 (19:47 +0200)]
media: camss: vfe-4-7: Rename get_ub_size, set_qos, set_ds, wm_enable

In preparation to add support for VFE 4.8, rename these functions
by adding the vfe version that they are referred to (for example,
vfe_get_ub_size -> vfe47_get_ub_size), as these are the only ones
that will be different for the VFE version 4.8.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: ispif: Correctly reset based on the VFE ID
AngeloGioacchino Del Regno [Thu, 22 Oct 2020 17:47:00 +0000 (19:47 +0200)]
media: camss: ispif: Correctly reset based on the VFE ID

Resetting the ISPIF VFE0 context is wrong if we are using the VFE1
for dual-camera or simply because a secondary camera is connected
to it: in this case the reset will always happen on the VFE0 ctx
of the ISPIF, which is .. useless.

Fix this usecase by adding the ISPIF_RST_CMD_1 address and choose
where to do the (or what to) reset based on the VFE line id.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: lirc: ensure RC_PROTO_MAX has documentation
Sean Young [Wed, 18 Nov 2020 10:43:40 +0000 (11:43 +0100)]
media: lirc: ensure RC_PROTO_MAX has documentation

The enum rc_proto value RC_PROTO_MAX has no documentation, this is causing
a warning while building the documentation.

Fixes: 72e637fec558 ("media: rc: validate that "rc_proto" is reasonable")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: sunxi-cir: allow timeout to be set at runtime
Sean Young [Tue, 10 Nov 2020 08:30:38 +0000 (09:30 +0100)]
media: sunxi-cir: allow timeout to be set at runtime

This allows the timeout to be set with the LIRC_SET_REC_TIMEOUT ioctl.

The timeout was hardcoded at just over 20ms, but returned 120ms when
queried with the LIRC_GET_REC_TIMEOUT ioctl.

This also ensures the idle threshold is set correctly with a base clock
other than 8Mhz.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: sunxi-cir: ensure IR is handled when it is continuous
Sean Young [Mon, 9 Nov 2020 22:16:52 +0000 (23:16 +0100)]
media: sunxi-cir: ensure IR is handled when it is continuous

If a user holds a button down on a remote, then no ir idle interrupt will
be generated until the user releases the button, depending on how quickly
the remote repeats. No IR is processed until that point, which means that
holding down a button may not do anything.

This also resolves an issue on a Cubieboard 1 where the IR receiver is
picking up ambient infrared as IR and spews out endless
"rc rc0: IR event FIFO is full!" messages unless you choose to live in
the dark.

Cc: stable@vger.kernel.org
Tested-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: imx219: Declare that the driver can create events
Dave Stevenson [Mon, 16 Nov 2020 15:42:38 +0000 (16:42 +0100)]
media: i2c: imx219: Declare that the driver can create events

The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
generate events. It can create events from the ctrl handler, therefore
this is required.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: imx7-mipi-csi2: convert bindings to yaml
Rui Miguel Silva [Wed, 21 Oct 2020 21:25:43 +0000 (23:25 +0200)]
media: dt-bindings: imx7-mipi-csi2: convert bindings to yaml

Convert imx7 mipi csi2 bindings documentation to yaml schema, remove
the textual document and update MAINTAINERS entry.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: imx7-csi: convert bindings to yaml
Rui Miguel Silva [Wed, 21 Oct 2020 21:25:42 +0000 (23:25 +0200)]
media: dt-bindings: imx7-csi: convert bindings to yaml

Convert imx7-csi bindings documentation to yaml schema, remove the
textual bindings document and update MAINTAINERS entry.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: ov2680: convert bindings to yaml
Rui Miguel Silva [Wed, 21 Oct 2020 21:25:41 +0000 (23:25 +0200)]
media: dt-bindings: ov2680: convert bindings to yaml

Convert ov2680 sensor bindings documentation to yaml schema, remove
the textual bindings document and update MAINTAINERS entry.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: fix trivial style warning
Nigel Christian [Sat, 31 Oct 2020 02:21:55 +0000 (03:21 +0100)]
media: ipu3-cio2: fix trivial style warning

Comment has 'the' repeated twice. Let's clean it up.
This patch reduces checkpatch warnings for this file to nil.

Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: mt9p031: Remove redundant null check before clk_disable_unprepare
Xu Wang [Wed, 4 Nov 2020 09:29:48 +0000 (10:29 +0100)]
media: i2c: mt9p031: Remove redundant null check before clk_disable_unprepare

Because clk_disable_unprepare() already checked NULL clock parameter,
so the additional check is unnecessary, just remove it.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ov2740: allow OTP data access during streaming
Bingbu Cao [Fri, 13 Nov 2020 03:06:58 +0000 (04:06 +0100)]
media: ov2740: allow OTP data access during streaming

OTP data access of ov2740 need enable the streaming mode to load
and it could be done in any time, so driver need allow the OTP
data access during streaming instead of return EBUSY, this patch
try to read the OTP data out in STREAMON if OTP data is not ready
before first time streaming start.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Qingwu Zhang <qingwu.zhang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ov2740: only do OTP data read on demand from user
Bingbu Cao [Fri, 13 Nov 2020 03:06:57 +0000 (04:06 +0100)]
media: ov2740: only do OTP data read on demand from user

OTP data access of ov2740 in probe need power up, it may cause
the camera flash LED blink during probe if the LED use same power
rail with camera, this patch move the OTP data access out of
probe, it will only occur on demand from user by nvmem sysfs.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Qingwu Zhang <qingwu.zhang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: stm32-dcmi: add support of BT656 bus
Hugues Fruchet [Wed, 4 Nov 2020 17:32:09 +0000 (18:32 +0100)]
media: stm32-dcmi: add support of BT656 bus

Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing
them with synchro codes embedded in data stream.
This bus type is only compatible with 8 bits width data bus.
Due to reserved values 0x00 & 0xff used for synchro codes, valid data vary
from 0x1 to 0xfe, this is up to sensor to clip accordingly pixel data. As
a consequence of this clipping, JPEG is not supported with this bus type.
DCMI crop feature is also not available with this bus type.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
Hugues Fruchet [Wed, 4 Nov 2020 17:32:10 +0000 (18:32 +0100)]
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus

Add support of BT656 embedded synchronization bus mode in DCMI driver.
Add "bus-type" property and make it required so that there is no
ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).
BT656 mode allows to save hardware synchro lines hsync & vsync by replacing
them with synchro codes embedded in data stream, hence hsync-active &
vsync-active properties are useless in this mode.
With DCMI, BT656 bus mode is only compatible with 8 bits width data bus.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: Add ov9734 image sensor driver
Tianshu Qiu [Thu, 29 Oct 2020 02:59:01 +0000 (03:59 +0100)]
media: i2c: Add ov9734 image sensor driver

Add a v4l2 sub-device driver for the OminiVision ov9734 image sensor
which can deliver maximum 720p image frames at 30 fps. This driver
also add vertical blanking, exposure, test pattern, digital and analog
gain control for the image sensor.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Use macros from mm.h
Andy Shevchenko [Wed, 28 Oct 2020 15:55:20 +0000 (16:55 +0100)]
media: ipu3-cio2: Use macros from mm.h

There are few nice macros in mm.h, some of which we may use here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-compat-ioctl32.c: add missing #ifdef CONFIG_COMPAT_32BIT_TIMEs
Hans Verkuil [Mon, 9 Nov 2020 08:47:44 +0000 (09:47 +0100)]
media: v4l2-compat-ioctl32.c: add missing #ifdef CONFIG_COMPAT_32BIT_TIMEs

In two places time32 structures were defined, but they are not
used if CONFIG_COMPAT_32BIT_TIME is not set. Put these two structs
under #ifdef CONFIG_COMPAT_32BIT_TIME as well to clearly indicate
that they are only used if that config option is set.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: solo6x10: fix missing snd_card_free in error handling case
Qinglang Miao [Wed, 11 Nov 2020 03:22:01 +0000 (04:22 +0100)]
media: solo6x10: fix missing snd_card_free in error handling case

Fix to goto snd_error in error handling case when fails
to do snd_ctl_add, as done elsewhere in this function.

Fixes: 28cae868cd24 ("[media] solo6x10: move out of staging into drivers/media/pci.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: saa7134: improve f->fmt.win.clips NULL check
Hans Verkuil [Tue, 10 Nov 2020 08:10:51 +0000 (09:10 +0100)]
media: saa7134: improve f->fmt.win.clips NULL check

Fix this smatch error:

saa7134-video.c:1286 saa7134_g_fmt_vid_overlay() error: we previously assumed 'f->fmt.win.clips' could be null (see line 1279)

This is actually a false error since if f->fmt.win.clips is NULL, clipcount
will be set to 0, so the clips array won't be touched, but it doesn't hurt
to make this explicit in the code.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cx231xx: Use snd_card_free_when_closed() instead of snd_card_free().
Zebediah Figura [Tue, 10 Nov 2020 03:04:03 +0000 (04:04 +0100)]
media: cx231xx: Use snd_card_free_when_closed() instead of snd_card_free().

cx231xx_close_extension and hence cx231xx_audio_fini() are called with the
cx231xx device lock held, but snd_cx231xx_pcm_close() also grabs that mutex
when closing the file on behalf of arecord. There seems to be no reason to
wait for sound card resources to be released, so let the release be
asynchronous.

Tested with a Hauppauge 955Q (2040:b123) and Linux 5.9.6; the hang
described in the bug no longer occurs and disconnecting the device
correctly terminates arecord with ENODEV.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=204087
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vim2m: Register video device after setting up internals
Sakari Ailus [Mon, 9 Nov 2020 23:07:22 +0000 (00:07 +0100)]
media: vim2m: Register video device after setting up internals

Prevent NULL (or close to NULL) pointer dereference in various places by
registering the video device only when the V4L2 m2m framework has been set
up.

Fixes: commit 96d8eab5d0a1 ("V4L/DVB: [v5,2/2] v4l: Add a mem-to-mem videobuf framework test device")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-ctrls: allow V4L2_CTRL_TYPE_BUTTON with request api
Dikshita Agarwal [Tue, 3 Nov 2020 06:57:37 +0000 (07:57 +0100)]
media: v4l2-ctrls: allow V4L2_CTRL_TYPE_BUTTON with request api

remove check for V4L2_CTRL_TYPE_BUTTON from
v4l2_ctrl_request_clone and v4l2_ctrl_request_setup().

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rockchip: rkisp1: destage Rockchip ISP1 driver
Helen Koike [Fri, 6 Nov 2020 12:19:37 +0000 (13:19 +0100)]
media: rockchip: rkisp1: destage Rockchip ISP1 driver

All the items in the TODO list were addressed, uapi was reviewed,
documentation written, checkpatch errors fixed, several bugs fixed.

There is no big reason to keep this driver in staging, so move it out.

Dt-bindings Verified with:
make ARCH=arm64 dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml

Fields of MAINTAINERS file sorted according to output of
./scripts/parse-maintainers.pl --input=MAINTAINERS --output=MAINTAINERS
--order

[dt-bindings: media: rkisp1: move rockchip-isp1 bindings out of staging]
[dt-bindings: media: rkisp1: move rockchip-isp1 bindings out of staging]
[hverkuil: fix various checkpatch alignment warnings]

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Shunqian Zheng [Fri, 6 Nov 2020 12:19:36 +0000 (13:19 +0100)]
media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format

Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMS and metadata format
V4L2_META_FMT_RK_ISP1_STAT_3A for 3A.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: cap: fix timeout when stopping the stream
Helen Koike [Fri, 6 Nov 2020 23:02:36 +0000 (00:02 +0100)]
media: staging: rkisp1: cap: fix timeout when stopping the stream

The dma engine should be stopped first.
The driver waits for an interrupt to stop the stream in a known state
after a frame.
If rkisp1_cap_stream_disable() is called after stopping the rest of the
pipeline, then most likely the interrupt won't arrive, we'll get a
timeout and debugfs variables mp_stop_timeout or sp_stop_timeout will
be incremented.

Fixes: 37db540bb9d1f ("media: staging: rkisp1: cap: refactor enable/disable stream to allow multistreaming")
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvbdev: Fix memleak in dvb_register_device
Dinghao Liu [Mon, 24 Aug 2020 12:27:46 +0000 (14:27 +0200)]
media: dvbdev: Fix memleak in dvb_register_device

When device_create() fails, dvbdev and dvbdevfops should
be freed just like when dvb_register_media_device() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: usb: dvb-usb-v2: zd1301: fix missing platform_device_unregister()
Qinglang Miao [Fri, 30 Oct 2020 01:34:25 +0000 (02:34 +0100)]
media: usb: dvb-usb-v2: zd1301: fix missing platform_device_unregister()

Add the missing platform_device_unregister() before return
from zd1301_frontend_attach in the error handling case when
pdev->dev.driver is empty.

There's an error handling route named err_platform_device_unregister,
so just reuse it.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rc: validate that "rc_proto" is reasonable
Dan Carpenter [Fri, 30 Oct 2020 11:52:30 +0000 (12:52 +0100)]
media: rc: validate that "rc_proto" is reasonable

Smatch complains that "rc_proto" comes from the user and it can result
in shift wrapping in ir_raw_encode_scancode()

    drivers/media/rc/rc-ir-raw.c:526 ir_raw_encode_scancode()
    error: undefined (user controlled) shift '1 << protocol'

This is true, but I reviewed the surrounding code and it appears
harmless. Anyway, let's verify that "rc_proto" is valid as a kernel
hardening measure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: add shutdown callback for venus
Mansur Alisha Shaik [Thu, 24 Sep 2020 06:59:46 +0000 (08:59 +0200)]
media: venus: core: add shutdown callback for venus

After the SMMU translation is disabled in the
arm-smmu shutdown callback during reboot, if
any subsystem are still alive then IOVAs they
are using will become PAs on bus, which may
lead to crash.

So implemented shutdown callback, which detach iommu maps.

Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: handle use after free for iommu_map/iommu_unmap
Mansur Alisha Shaik [Thu, 24 Sep 2020 06:59:45 +0000 (08:59 +0200)]
media: venus: handle use after free for iommu_map/iommu_unmap

In concurrency usecase and reboot scenario we are seeing muliple
crashes related to iommu_map/iommu_unamp of core->fw.iommu_domain.

In one case we are seeing "Unable to handle kernel NULL pointer
dereference at virtual address 0000000000000008" crash, this is
because of core->fw.iommu_domain in venus_firmware_deinit() and
trying to map in venus_boot() during venus_sys_error_handler()

Call trace:
 __iommu_map+0x4c/0x348
 iommu_map+0x5c/0x70
 venus_boot+0x184/0x230 [venus_core]
 venus_sys_error_handler+0xa0/0x14c [venus_core]
 process_one_work+0x210/0x3d0
 worker_thread+0x248/0x3f4
 kthread+0x11c/0x12c
 ret_from_fork+0x10/0x18

In second case we are seeing "Unable to handle kernel paging request
at virtual address 006b6b6b6b6b6b9b" crash, this is because of
unmapping iommu domain which is already unmapped.

Call trace:
 venus_remove+0xf8/0x108 [venus_core]
 venus_core_shutdown+0x1c/0x34 [venus_core]
 platform_drv_shutdown+0x28/0x34
 device_shutdown+0x154/0x1fc
 kernel_restart_prepare+0x40/0x4c
 kernel_restart+0x1c/0x64
 __arm64_sys_reboot+0x190/0x238
 el0_svc_common+0xa4/0x154
 el0_svc_compat_handler+0x2c/0x38
 el0_svc_compat+0x8/0x10

Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: handle race condititon for core ops
Mansur Alisha Shaik [Thu, 24 Sep 2020 06:59:44 +0000 (08:59 +0200)]
media: venus: core: handle race condititon for core ops

For core ops we are having only write protect but there
is no read protect, because of this in multithreading
and concurrency, one CPU core is reading without wait
which is causing the NULL pointer dereferece crash.

one such scenario is as show below, where in one CPU
core, core->ops becoming NULL and in another CPU core
calling core->ops->session_init().

CPU: core-7:
Call trace:
 hfi_session_init+0x180/0x1dc [venus_core]
 vdec_queue_setup+0x9c/0x364 [venus_dec]
 vb2_core_reqbufs+0x1e4/0x368 [videobuf2_common]
 vb2_reqbufs+0x4c/0x64 [videobuf2_v4l2]
 v4l2_m2m_reqbufs+0x50/0x84 [v4l2_mem2mem]
 v4l2_m2m_ioctl_reqbufs+0x2c/0x38 [v4l2_mem2mem]
 v4l_reqbufs+0x4c/0x5c
__video_do_ioctl+0x2b0/0x39c

CPU: core-0:
Call trace:
 venus_shutdown+0x98/0xfc [venus_core]
 venus_sys_error_handler+0x64/0x148 [venus_core]
 process_one_work+0x210/0x3d0
 worker_thread+0x248/0x3f4
 kthread+0x11c/0x12c

Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: fix calculating mbps in calculate_inst_freq()
Mansur Alisha Shaik [Mon, 2 Nov 2020 10:31:37 +0000 (11:31 +0100)]
media: venus: fix calculating mbps in calculate_inst_freq()

Currently in calculate_inst_freq(), video driver is calculating
macro blocks per frame instead of macro blocks per second(mpbs).
Which results frequency is always setting to lower frequency (150MHz)
as per frequency table for sc7180. Hence the playback is not smooth.

Corrected this by correcting the mbps calculation in calculate_inst_freq().

Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: put dummy vote on video-mem path after last session release
Mansur Alisha Shaik [Mon, 19 Oct 2020 04:18:14 +0000 (06:18 +0200)]
media: venus: put dummy vote on video-mem path after last session release

As per current implementation, video driver is unvoting "videom-mem" path
for last video session during vdec_session_release().
While video playback when we try to suspend device, we see video clock
warnings since votes are already removed during vdec_session_release().

corrected this by putting dummy vote on "video-mem" after last video
session release and unvoting it during suspend.

suspend")

Fixes: 07f8f22a33a9e ("media: venus: core: remove CNOC voting while device
Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: vote with average bandwidth and peak bandwidth as zero
Mansur Alisha Shaik [Mon, 19 Oct 2020 04:18:13 +0000 (06:18 +0200)]
media: venus: core: vote with average bandwidth and peak bandwidth as zero

As per bandwidth table video driver is voting with average bandwidth
for "video-mem" and "cpu-cfg" paths as peak bandwidth is zero
in bandwidth table.

suspend")

Fixes: 07f8f22a33a9e ("media: venus: core: remove CNOC voting while device
Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: vote for video-mem path
Mansur Alisha Shaik [Mon, 19 Oct 2020 04:18:12 +0000 (06:18 +0200)]
media: venus: core: vote for video-mem path

Currently video driver is voting for venus0-ebi path during buffer
processing with an average bandwidth of all the instances and
unvoting during session release.

While video streaming when we try to do XO-SD using the command
"echo mem > /sys/power/state command" , device is not entering
to suspend state and from interconnect summary seeing votes for venus0-ebi

Corrected this by voting for venus0-ebi path in venus_runtime_resume()
and unvote during venus_runtime_suspend().

suspend")

Fixes: 07f8f22a33a9e ("media: venus: core: remove CNOC voting while device
Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: change clk enable and disable order in resume and suspend
Mansur Alisha Shaik [Mon, 19 Oct 2020 04:18:11 +0000 (06:18 +0200)]
media: venus: core: change clk enable and disable order in resume and suspend

Currently video driver is voting after clk enable and un voting
before clk disable. This is incorrect, video driver should vote
before clk enable and unvote after clk disable.

Corrected this by changing the order of clk enable and clk disable.

suspend")

Fixes: 07f8f22a33a9e ("media: venus: core: remove CNOC voting while device
Signed-off-by: Mansur Alisha Shaik <mansur@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: vdec: return parsed crop information from stream
Alexandre Courbot [Wed, 21 Oct 2020 00:09:43 +0000 (02:09 +0200)]
media: venus: vdec: return parsed crop information from stream

Per the stateful codec specification, VIDIOC_G_SELECTION with a target
of V4L2_SEL_TGT_COMPOSE is supposed to return the crop area of capture
buffers containing the decoded frame. Until now the driver did not get
that information from the firmware and just returned the dimensions of
CAPTURE buffers.

The firmware unfortunately does not always provide the crop information
from the stream ; also make sure to detect when that happens and
fallback to providing the coded size in these cases.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: venc: Fix default capture format
Stanimir Varbanov [Sat, 24 Oct 2020 16:35:09 +0000 (18:35 +0200)]
media: venus: venc: Fix default capture format

The default codec after driver open is set to be H264 but the
instance format for capture is wrongly set to H263. Correct this
to H264.

For regular applications this is not a big issue because they set
the format through S_FMT but for example v4l2-compliance does not.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: fix kernel-doc markups
Mauro Carvalho Chehab [Fri, 23 Oct 2020 14:08:10 +0000 (16:08 +0200)]
media: fix kernel-doc markups

Some identifiers have different names between their prototypes
and the kernel-doc markup. Seome seems to be due to cut-and-paste
related issues.

Others need to be fixed, as kernel-doc markups should use this format:
        identifier - description

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> # IPU3 and V4L2
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: add missing put_device() call in mtk_jpeg_probe() and mtk_jpeg_remove()
Yu Kuai [Wed, 4 Nov 2020 12:41:36 +0000 (13:41 +0100)]
media: platform: add missing put_device() call in mtk_jpeg_probe() and mtk_jpeg_remove()

if mtk_jpeg_clk_init() succeed, mtk_jpeg_probe() and mtk_jpeg_remove()
doesn't have a corresponding put_device(). Thus add a new helper
mtk_jpeg_clk_release() to fix it.

Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cedrus: Add support for R40
Jernej Skrabec [Tue, 25 Aug 2020 17:35:22 +0000 (19:35 +0200)]
media: cedrus: Add support for R40

Video engine in R40 is very similar to that in A33 but it runs on lower
speed, at least according to OS images released by board designer.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: allwinner,sun4i-a10-video-engine: Add R40 compatible
Jernej Skrabec [Tue, 25 Aug 2020 17:35:21 +0000 (19:35 +0200)]
media: dt-bindings: media: allwinner,sun4i-a10-video-engine: Add R40 compatible

Allwinner R40 SoC contains video engine. Add compatible for it.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: coda: Add a V4L2 user for control error macroblocks count
Ezequiel Garcia [Wed, 4 Nov 2020 17:43:11 +0000 (18:43 +0100)]
media: coda: Add a V4L2 user for control error macroblocks count

To avoid potentially overflowing the kernel logs in the case
of corrupted streams, this commit replaces an error message with
a per-stream counter to be read through a driver-specific
control.

Applications can read the per-stream accumulated
error macroblocks count.

The old error message is replaced by a rate-limited debug message.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: coda: coda_buffer_meta housekeeping fix
Ezequiel Garcia [Tue, 3 Nov 2020 21:32:37 +0000 (22:32 +0100)]
media: coda: coda_buffer_meta housekeeping fix

It's possible that the VPU was initialized using just one buffer,
containing only codec headers.

In this case, right after the initialization and after updating
the FIFO read pointer, we need to iterate through all the coda_buffer_meta
and release any metas that have been already used by the VPU.

This issue is affecting indirectly the bitstream buffer fill
threshold, which depends on the meta end position of the first
queued meta, which is passed to coda_bitstream_can_fetch_past().

Without this fix, it's possible that for certain videos, the
bitstream buffer level is not filled properly, resulting in a PIC_RUN
timeout.

Reported-by: Benjamin Bara <benjamin.bara@skidata.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.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+huawei@kernel.org>
3 years agomedia: staging: rkisp1: isp: set metadata pads to MEDIA_BUS_FMT_METADATA_FIXED
Dafna Hirschfeld [Fri, 30 Oct 2020 13:46:09 +0000 (14:46 +0100)]
media: staging: rkisp1: isp: set metadata pads to MEDIA_BUS_FMT_METADATA_FIXED

Set the code of the metadata pads of the isp entity to
MEDIA_BUS_FMT_METADATA_FIXED and set the width and
height of their formats to 0. This solves the TODO
item:
"Fix pad format size for statistics and parameters entities."

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.
Dafna Hirschfeld [Fri, 30 Oct 2020 13:46:08 +0000 (14:46 +0100)]
media: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.

MEDIA_BUS_FMT_METADATA_FIXED should be used when
the same driver handles both sides of the link and
the bus format is a fixed metadata format that is
not configurable from userspace.
The width and height will be set to 0 for this format.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
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+huawei@kernel.org>
3 years agomedia: cedrus: fix reference leak in cedrus_start_streaming
Zhang Qilong [Mon, 2 Nov 2020 14:26:22 +0000 (15:26 +0100)]
media: cedrus: fix reference leak in cedrus_start_streaming

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in cedrus_start_streaming. We should fix it.

Fixes: d5aecd289babf ("media: cedrus: Implement runtime PM")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: cap: fix runtime PM imbalance on error
Zhang Qilong [Mon, 2 Nov 2020 14:28:52 +0000 (15:28 +0100)]
media: staging: rkisp1: cap: fix runtime PM imbalance on error

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference imbalance in rkisp1_vb2_start_streaming, so we
should fix it.

Fixes: 56e3b29f9f6b2 ("media: staging: rkisp1: add streaming paths")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/pci: simplify the return expression of verify_window_lock
Liu Shixin [Mon, 21 Sep 2020 08:24:39 +0000 (10:24 +0200)]
media: media/pci: simplify the return expression of verify_window_lock

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mtk-vcodec: remove allocated dma_parms
Hsin-Yi Wang [Thu, 3 Sep 2020 05:48:33 +0000 (07:48 +0200)]
media: mtk-vcodec: remove allocated dma_parms

Commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms for
platform devices") included dma_parms in platform_device. There's no need
to allocate again.

Fixes: 13483fc2f20f ("media: mtk-vcodec: set dma max segment size")
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: isif: reset global state
Evgeny Novikov [Tue, 14 Jul 2020 17:20:49 +0000 (19:20 +0200)]
media: isif: reset global state

isif_probe() invokes iounmap() on error handling paths, but it does not
reset the global state. So, later it can invoke iounmap() even when
ioremap() fails. This is the case also for isif_remove(). The patch
resets the global state after invoking iounmap() to avoid this.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx258: Remove Jason Chen's e-mail
Sakari Ailus [Wed, 28 Oct 2020 10:03:57 +0000 (11:03 +0100)]
media: imx258: Remove Jason Chen's e-mail

Remove Jason Chen's e-mail address for it no longer works.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ov5640: fix support of BT656 bus mode
Hugues Fruchet [Tue, 13 Oct 2020 09:02:23 +0000 (11:02 +0200)]
media: ov5640: fix support of BT656 bus mode

Fix PCLK polarity not being taken into account.
Add comments about BT656 register control.
Remove useless ov5640_set_stream_bt656() function.
Refine comments about MIPI IO register control.

Fixes: 4039b03720f7 ("media: i2c: ov5640: Add support for BT656 mode")
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Use v4l2_get_link_freq helper
Sakari Ailus [Tue, 13 Oct 2020 15:01:10 +0000 (17:01 +0200)]
media: ipu3-cio2: Use v4l2_get_link_freq helper

Use v4l2_get_link_freq helper and add support for sensor drivers
implementing only V4L2_CID_PIXEL_RATE.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l: Add a helper for obtaining the link frequency
Sakari Ailus [Tue, 13 Oct 2020 14:54:00 +0000 (16:54 +0200)]
media: v4l: Add a helper for obtaining the link frequency

Add a helper for obtaining the link frequency from transmitter drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: Documentation: v4l: Document required controls on camera sensors
Sakari Ailus [Tue, 13 Oct 2020 14:02:27 +0000 (16:02 +0200)]
media: Documentation: v4l: Document required controls on camera sensors

Raw camera sensors connected to parallel or CSI-2 busses need to implement
V4L2_CID_LINK_FREQ control so receiver drivers can configure the hardware
accordingly.

Document this. Also say V4L2_CID_PIXEL_RATE is recommended for such
hardware.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: Documentation: v4l: Fix language
Sakari Ailus [Tue, 13 Oct 2020 13:11:37 +0000 (15:11 +0200)]
media: Documentation: v4l: Fix language

Remove extra "is" from sentence explaining V4L2_CID_PIXEL_RATE may be used
to tell the pixel rate used by a transmitter driver. Also call
V4L2_CID_PIXEL_RATE a control.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Check receved the size against payload size, not buffer size
Sakari Ailus [Tue, 13 Oct 2020 12:12:02 +0000 (14:12 +0200)]
media: ipu3-cio2: Check receved the size against payload size, not buffer size

Compare the received size of the payload size, not the allocated size of
the buffer that is page aligned. This way also images that aren't aligned
to page size are not warned about.

Also wrap a line over 80 characters.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ov7670: do not aggregate returns
Tom Rix [Tue, 6 Oct 2020 20:38:17 +0000 (22:38 +0200)]
media: ov7670: do not aggregate returns

Adding muliple status together loses individual failures.
Check each status separately.

Clean up some other returns for consistency.

Fixed several coding style problems by running
the file through checkpatch.pl --fix-inplace

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: stm32-dcmi: add 8-bit Bayer formats support
Alain Volmat [Wed, 7 Oct 2020 16:08:25 +0000 (18:08 +0200)]
media: stm32-dcmi: add 8-bit Bayer formats support

Add BA81, GBRG, GRBG, RGGB formats in the list of
supported capture formats.

Signed-off-by: Alain Volmat <alain.volmat@st.com>
Acked-by: Hugues FRUCHET <hugues.fruchet@st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: stm32-dcmi: remove deprecated dmaengine_terminate_all()
Hugues Fruchet [Wed, 7 Oct 2020 16:05:52 +0000 (18:05 +0200)]
media: stm32-dcmi: remove deprecated dmaengine_terminate_all()

Replace dmaengine_terminate_all() by dmaengine_terminate_sync()
to ensure that all pending dma operations are really finished.
This is not ensured by dmaengine_terminate_all() and this API
is deprecated, so better to use the _sync() variant.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: stm32-dcmi: don't print an error on probe deferral
Etienne Carriere [Wed, 7 Oct 2020 16:02:10 +0000 (18:02 +0200)]
media: stm32-dcmi: don't print an error on probe deferral

Change stm32-dcmi driver to not print an error message when the
device probe operation is deferred.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ov5640: add support of 160x120 resolution
Hugues Fruchet [Thu, 8 Oct 2020 08:29:16 +0000 (10:29 +0200)]
media: ov5640: add support of 160x120 resolution

Add support of 160x120 resolution.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Remove traces of returned buffers
Sakari Ailus [Mon, 12 Oct 2020 15:25:28 +0000 (17:25 +0200)]
media: ipu3-cio2: Remove traces of returned buffers

If starting a video buffer queue fails, the buffers are returned to
videobuf2. Remove the reference to the buffer from the driver's queue as
well.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: stable@vger.kernel.org # v4.16 and up
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Rename CIO2_IMAGE_MAX_LENGTH as CIO2_IMAGE_MAX_HEIGHT
Sakari Ailus [Mon, 12 Oct 2020 11:52:46 +0000 (13:52 +0200)]
media: ipu3-cio2: Rename CIO2_IMAGE_MAX_LENGTH as CIO2_IMAGE_MAX_HEIGHT

CIO2_IMAGE_MAX_LENGTH is the maximum height of the image. Rename it as
"CIO2_IMAGE_MAX_HEIGHT" in order to better describe what it is.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Remove explicit type from frame size checks
Sakari Ailus [Mon, 12 Oct 2020 09:34:30 +0000 (11:34 +0200)]
media: ipu3-cio2: Remove explicit type from frame size checks

Now that the values are unsigned, we can remove the explicit cast to u32.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Use unsigned values where appropriate
Sakari Ailus [Fri, 9 Oct 2020 10:02:41 +0000 (12:02 +0200)]
media: ipu3-cio2: Use unsigned values where appropriate

Use unsigned values for width, height, bit shifts and registers,
effectively for all definitions that are not signed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Make the field on subdev format V4L2_FIELD_NONE
Sakari Ailus [Fri, 9 Oct 2020 13:56:05 +0000 (15:56 +0200)]
media: ipu3-cio2: Make the field on subdev format V4L2_FIELD_NONE

The ipu3-cio2 doesn't make use of the field and this is reflected in V4L2
buffers as well as the try format. Do this in active format, too.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Validate mbus format in setting subdev format
Sakari Ailus [Thu, 8 Oct 2020 19:33:26 +0000 (21:33 +0200)]
media: ipu3-cio2: Validate mbus format in setting subdev format

Validate media bus code, width and height when setting the subdev format.

This effectively reworks how setting subdev format is implemented in the
driver.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Serialise access to pad format
Sakari Ailus [Thu, 8 Oct 2020 19:29:38 +0000 (21:29 +0200)]
media: ipu3-cio2: Serialise access to pad format

Pad format can be accessed from user space. Serialise access to it.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ipu3-cio2: Return actual subdev format
Sakari Ailus [Thu, 8 Oct 2020 19:06:28 +0000 (21:06 +0200)]
media: ipu3-cio2: Return actual subdev format

Return actual subdev format on ipu3-cio2 subdev pads. The earlier
implementation was based on an infinite recursion that exhausted the
stack.

Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l: subdev: Improve link format validation debug messages
Sakari Ailus [Tue, 5 Jul 2016 09:41:15 +0000 (11:41 +0200)]
media: v4l: subdev: Improve link format validation debug messages

The existing link format validation failure debug message in media-entity.c
helped to pinpoint the point of failure but provided no additional
information what's wrong. Tell the user exactly why the validation failed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: ov772x: Add test pattern control
Lad Prabhakar [Fri, 2 Oct 2020 22:23:23 +0000 (00:23 +0200)]
media: i2c: ov772x: Add test pattern control

Add support for test pattern control supported by the sensor.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: ov772x: Add support for BT.656 mode
Lad Prabhakar [Fri, 2 Oct 2020 22:23:22 +0000 (00:23 +0200)]
media: i2c: ov772x: Add support for BT.656 mode

Add support to read the bus-type for V4L2_MBUS_BT656 and enable BT.656
mode in the sensor if needed.

For backward compatibility with older DTS where the bus-type property was
not mandatory, assume V4L2_MBUS_PARALLEL as it was the only supported bus
at the time. v4l2_fwnode_endpoint_alloc_parse() will not fail if
'bus-type' is not specified.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: ov772x: Parse endpoint properties
Lad Prabhakar [Fri, 2 Oct 2020 22:23:21 +0000 (00:23 +0200)]
media: i2c: ov772x: Parse endpoint properties

Parse endpoint properties using v4l2_fwnode_endpoint_alloc_parse()
to determine the bus type and store it in the driver structure.

Set bus_type to V4L2_MBUS_PARALLEL as it's the only supported one

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rcar-csi2: Set bus type when parsing fwnode
Niklas Söderlund [Mon, 14 Sep 2020 21:50:11 +0000 (23:50 +0200)]
media: rcar-csi2: Set bus type when parsing fwnode

The only supported bus for the R-Car CSI-2 driver is CSI-2 DPHY, specify
this before parsing the fwnode.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rcar-csi2: Switch to using fwnode instead of OF
Niklas Söderlund [Mon, 14 Sep 2020 21:50:10 +0000 (23:50 +0200)]
media: rcar-csi2: Switch to using fwnode instead of OF

Use the fwnode_graph_get_endpoint_by_id() interface instead of
of_graph_get_endpoint_by_regs() to fetch the fwnode. This saves
translating between a device_node and fwnode_handle.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Add ADV7604 bindings documentation
Niklas Söderlund [Tue, 15 Sep 2020 18:19:44 +0000 (20:19 +0200)]
media: MAINTAINERS: Add ADV7604 bindings documentation

Add the YAML dt-bindings document for ADV7604.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: adv7604: Convert bindings to json-schema
Niklas Söderlund [Tue, 15 Sep 2020 18:19:43 +0000 (20:19 +0200)]
media: dt-bindings: adv7604: Convert bindings to json-schema

Convert ADV7604 video decoder documentation to json-schema.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: adv7604: Fix documentation for hpd-gpios
Niklas Söderlund [Tue, 15 Sep 2020 18:19:42 +0000 (20:19 +0200)]
media: dt-bindings: adv7604: Fix documentation for hpd-gpios

As of [1] the hpd-gpios property is optional, document it as such.

1. commit 269bd1324fbfaa52 ("[media] media: adv7604: improve usage of gpiod API")

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-fwnode: Say it's fine to use v4l2_fwnode_endpoint_parse
Sakari Ailus [Wed, 30 Sep 2020 14:34:43 +0000 (16:34 +0200)]
media: v4l2-fwnode: Say it's fine to use v4l2_fwnode_endpoint_parse

Earlier it was expected that there would be more variable size endpoint
properties and that most if not all drivers would need them. For that
reason it was expected also that v4l2_fwnode_endpoint_parse would no
longer be needed.

What actually happened that not all drivers require "link-frequencies",
the only variable size media endpoint property without a small upper
limit. Therefore drivers that do not need that information are fine using
v4l2_fwnode_endpoint_parse. So don't tell drivers to use
v4l2_fwnode_endpoint_alloc_parse in all cases.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-fwnode: Rework v4l2_fwnode_endpoint_parse documentation
Sakari Ailus [Wed, 30 Sep 2020 14:28:49 +0000 (16:28 +0200)]
media: v4l2-fwnode: Rework v4l2_fwnode_endpoint_parse documentation

Rework the documentation of v4l2_fwnode_endpoint_parse for better
readability, usefulness and correctness.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-fwnode: Don't zero parts of struct v4l2_fwnode_endpoint anymore
Sakari Ailus [Wed, 30 Sep 2020 12:28:54 +0000 (14:28 +0200)]
media: v4l2-fwnode: Don't zero parts of struct v4l2_fwnode_endpoint anymore

Don't zero parts of the vep argument to v4l2_fwnode_endpoint_parse()
anymore as this can no longer be done while still supporting defaults on
multiple bus types.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-fwnode: v4l2_fwnode_endpoint_parse caller must init vep argument
Sakari Ailus [Wed, 30 Sep 2020 12:08:03 +0000 (14:08 +0200)]
media: v4l2-fwnode: v4l2_fwnode_endpoint_parse caller must init vep argument

Document that the caller of v4l2_fwnode_endpoint_parse() must init the
fields of struct v4l2_fwnode_endpoint (vep argument) fields.

It used to be that the fields were zeroed by v4l2_fwnode_endpoint_parse
when bus type was set to V4L2_MBUS_UNKNOWN but with recent changes (Fixes:
line below) that no longer makes sense.

Fixes: bb4bba9232fc ("media: v4l2-fwnode: Make bus configuration a struct")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: adv748x: Zero entire struct v4l2_fwnode_endpoint
Sakari Ailus [Wed, 30 Sep 2020 11:49:15 +0000 (13:49 +0200)]
media: adv748x: Zero entire struct v4l2_fwnode_endpoint

The v4l2_fwnode_parse_endpoint() function can make use of defaults in
multiple bus types. To use this feature, all callers must zero the rest of
the fields of this struct, too. All other drivers appear to do that
already apart from this one.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: convert CODA VPU bindings to yaml
Philipp Zabel [Wed, 23 Sep 2020 08:21:12 +0000 (10:21 +0200)]
media: dt-bindings: convert CODA VPU bindings to yaml

Convert to YAML and add generic IP core compatibles "cnm,codadx6",
"cnm,codahx4", "cnm,coda7541", and "cnm,coda960" in addition to the SoC
specific compatibles. The new generic compatibles are already used in
the SoC device trees and replace the free form comments. For example:

- compatible : should be "fsl,<chip>-src" for i.MX SoCs:
  (a) "fsl,imx27-vpu" for CodaDx6 present in i.MX27

turns into:

properties:
  compatible:
    oneOf:
      - items:
          - const: fsl,imx27-vpu
          - const: cnm,codadx6

This allows to properly specify the secondary JPEG unit interrupt that
is only present on cnm,coda960.

Also add the missing "fsl,imx6dl-vpu", "cnm,coda960" compatible.
The AXI bus connection to the internal SRAM is different between i.MX6Q
and i.MX6DL, which requires the driver to load a different firmware
depending on the SoC.

Further, specify the power-domain property for i.MX6 and change the
clock order from "ahb", "per" to "per", "ahb". This order is currently
used in all SoC device trees.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: ov772x: Document endpoint props
Jacopo Mondi [Thu, 10 Sep 2020 16:20:55 +0000 (18:20 +0200)]
media: dt-bindings: media: ov772x: Document endpoint props

Document endpoint properties for the parallel bus type and
add them to the example.

Specify a few constraints:
- If the bus type is BT.656 no hsync or vsync polarities can be
  specified.
- If the bus width is 10 bits, not data-shift can be applied.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: ov772x: Make bus-type mandatory
Jacopo Mondi [Thu, 10 Sep 2020 16:20:54 +0000 (18:20 +0200)]
media: dt-bindings: media: ov772x: Make bus-type mandatory

In order to establish required properties based on the selected
bus type, make the 'bus-type' property mandatory. As this change
documents an endpoint property, also document the 'remote-endpoint'
one now that the 'endpoint' schema has been expanded.

Binary compatibility with existing DTB is kept as the driver does not
enforce the property to be present, and shall fall-back to default
parallel bus configuration, which was the only supported bus type, if
the property is not specified.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: ov772x: Convert to json-schema
Jacopo Mondi [Thu, 10 Sep 2020 16:20:53 +0000 (18:20 +0200)]
media: dt-bindings: media: ov772x: Convert to json-schema

Convert the ov772x binding document to json-schema and update
the MAINTAINERS file accordingly.

Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>