linux-2.6-microblaze.git
4 years agomedia: vimc: Make use of V4L2_CAP_IO_MC
Niklas Söderlund [Tue, 21 Apr 2020 13:57:43 +0000 (15:57 +0200)]
media: vimc: Make use of V4L2_CAP_IO_MC

Set the V4L2_CAP_IO_MC capability flag to report this vimc
inputs/outputs are controlled by the media graph.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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>
4 years agomedia: staging/intel-ipu3: Make use of V4L2_CAP_IO_MC
Niklas Söderlund [Tue, 21 Apr 2020 13:57:42 +0000 (15:57 +0200)]
media: staging/intel-ipu3: Make use of V4L2_CAP_IO_MC

Set the V4L2_CAP_IO_MC capability flag and remove the driver specific
vidioc_enum_{input,output}, vidioc_g_{input,output} and
vidioc_s_{input,output} callbacks.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-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>
4 years agomedia: rcar-vin: Make use of V4L2_CAP_IO_MC
Niklas Söderlund [Tue, 21 Apr 2020 13:57:41 +0000 (15:57 +0200)]
media: rcar-vin: Make use of V4L2_CAP_IO_MC

Set the V4L2_CAP_IO_MC capability flag and remove the driver specific
vidioc_enum_input, vidioc_g_input and vidioc_s_input callbacks for the
media controller enabled part of the driver. Also add support mbus_code
filtering for format enumeration.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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>
4 years agomedia: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices
Laurent Pinchart [Fri, 24 Apr 2020 13:43:31 +0000 (15:43 +0200)]
media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices

The VIDIOC_ENUM_FMT ioctl enumerates all formats supported by a video
node. For MC-centric devices, its behaviour has always been ill-defined,
with drivers implementing one of the following behaviours:

- No support for VIDIOC_ENUM_FMT at all
- Enumerating all formats supported by the video node, regardless of the
  configuration of the pipeline
- Enumerating formats supported by the video node for the active
  configuration of the connected subdevice

The first behaviour is obviously useless for applications. The second
behaviour provides the most information, but doesn't offer a way to find
what formats are compatible with a given pipeline configuration. The
third behaviour fixes that, but with the drawback that applications
can't enumerate all supported formats anymore, and have to modify the
active configuration of the pipeline to enumerate formats.

The situation is messy as none of the implemented behaviours are ideal,
and userspace can't predict what will happen as the behaviour is
driver-specific.

To fix this, let's extend the VIDIOC_ENUM_FMT with a missing capability:
enumerating pixel formats for a given media bus code. The media bus code
is passed through the v4l2_fmtdesc structure in a new mbus_code field
(repurposed from the reserved fields). With this capability in place,
applications can enumerate pixel formats for a given media bus code
without modifying the active configuration of the device.

The current behaviour of the ioctl is preserved when the new mbus_code
field is set to 0, ensuring compatibility with existing userspace. The
API extension is documented as mandatory for MC-centric devices (as
advertised through the V4L2_CAP_IO_MC capability), allowing applications
and compliance tools to easily determine the availability of the
VIDIOC_ENUM_FMT extension.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: pci: Fill v4l2_fmtdesc with designated initializers
Laurent Pinchart [Tue, 21 Apr 2020 13:57:39 +0000 (15:57 +0200)]
media: pci: Fill v4l2_fmtdesc with designated initializers

Replace initialization of static const v4l2_fmtdesc instances that
specify every struct member with designated initializers. This allows
not zeroing the reserved fields explicitly, and will avoid a need to
patch these drivers every time a reserved field is repurposed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-dev/ioctl: Add V4L2_CAP_IO_MC
Niklas Söderlund [Tue, 21 Apr 2020 13:57:38 +0000 (15:57 +0200)]
media: v4l2-dev/ioctl: Add V4L2_CAP_IO_MC

Add a video device capability flag to indicate that its inputs and/or
outputs are controlled by the Media Controller instead of the V4L2 API.
When this flag is set, ioctl for enum inputs and outputs are
automatically enabled and programmed to call a helper function.

Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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>
4 years agomedia: admin-guide: split cardlist.rst file
Mauro Carvalho Chehab [Wed, 22 Apr 2020 08:44:21 +0000 (10:44 +0200)]
media: admin-guide: split cardlist.rst file

After adding all cardlists, this file became too big. Split
it on smaller files, in order to make easier to maintain.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: make clear about PCI subsystem IDs
Mauro Carvalho Chehab [Wed, 22 Apr 2020 07:25:00 +0000 (09:25 +0200)]
media: admin-guide: make clear about PCI subsystem IDs

On several parts of the document, it mentions "PCI ID", when
it is actually referring to the subsystem's part of the PCI
ID.

Change the language to let it be clear.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cec: silence shift wrapping warning in __cec_s_log_addrs()
Dan Carpenter [Tue, 5 May 2020 08:25:56 +0000 (10:25 +0200)]
media: cec: silence shift wrapping warning in __cec_s_log_addrs()

The log_addrs->log_addr_type[i] value is a u8 which is controlled by
the user and comes from the ioctl.  If it's over 31 then that results in
undefined behavior (shift wrapping) and that leads to a Smatch static
checker warning.  We already cap the value later so we can silence the
warning just by re-ordering the existing checks.

I think the UBSan checker will also catch this bug at runtime and
generate a warning.  But otherwise the bug is harmless.

Fixes: 9881fe0ca187 ("[media] cec: add HDMI CEC framework (adapter)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: sun8i: Fix an error handling path in 'deinterlace_runtime_resume()'
Christophe JAILLET [Tue, 5 May 2020 07:50:34 +0000 (09:50 +0200)]
media: sun8i: Fix an error handling path in 'deinterlace_runtime_resume()'

It is spurious to call 'clk_disable_unprepare()' when
'clk_prepare_enable()' has not been called yet.
Re-order the error handling path to avoid it.

Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: err_exlusive_rate -> err_exclusive_rate]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vimc: deb: Add support for {RGB,BGR,GBR}888 bus formats on source pad
Nícolas F. R. A. Prado [Fri, 1 May 2020 13:11:23 +0000 (15:11 +0200)]
media: vimc: deb: Add support for {RGB,BGR,GBR}888 bus formats on source pad

Add support for RGB888_*, BGR888_* and GBR888_* media bus formats on
the source pad of debayer subdevices.

Acked-by: Helen Koike <helen.koike@collabora.com>
Co-developed-by: Vitor Massaru Iha <vitor@massaru.org>
Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vimc: Add missing {RGB,BGR,GBR}888 media bus codes
Nícolas F. R. A. Prado [Fri, 1 May 2020 13:11:12 +0000 (15:11 +0200)]
media: vimc: Add missing {RGB,BGR,GBR}888 media bus codes

Add missing RGB888_*, BGR888_* and GBR888_* media bus codes in the
vimc_pix_map_list. Since there is no GBR24 pixelformat, use the RGB24
pixelformat for MEDIA_BUS_FMT_GBR888_1X24.

Acked-by: Helen Koike <helen.koike@collabora.com>
Co-developed-by: Vitor Massaru Iha <vitor@massaru.org>
Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vimc: Support multiple media bus codes for each pixelformat
Nícolas F. R. A. Prado [Fri, 1 May 2020 13:11:02 +0000 (15:11 +0200)]
media: vimc: Support multiple media bus codes for each pixelformat

Change vimc_pix_map_list to allow multiple media bus codes to map to the
same pixelformat, making it possible to add media bus codes for which
there are no pixelformat.

Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix sparse warning: const u32 -> u32]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ti-vpe: avoid gcc-9 warning
Arnd Bergmann [Tue, 28 Apr 2020 21:34:19 +0000 (23:34 +0200)]
media: ti-vpe: avoid gcc-9 warning

gcc warns about empty array declarations, which we get in this driver
when compile-testing without CONFIG_OF:

drivers/media/platform/ti-vpe/cal.c:2194:34: warning: array 'cal_of_match' assumed to have one element
 2194 | static const struct of_device_id cal_of_match[];

Since all users of this driver do need CONFIG_OF anyway, there is no
point in making the array definition conditional to save space, so
just remove the #ifdef and move the array up a little.

Fixes: 343e89a792a5 ("[media] media: ti-vpe: Add CAL v4l2 camera capture driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: media: usbvision: usbvision-core Correct spelling
John Oldman [Tue, 28 Apr 2020 17:26:55 +0000 (19:26 +0200)]
media: staging: media: usbvision: usbvision-core Correct spelling

Correct spelling in comment

Signed-off-by: John Oldman <john.oldman@polehill.co.uk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: media: imx: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Tue, 28 Apr 2020 17:04:05 +0000 (19:04 +0200)]
media: staging: media: imx: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: MAINTAINERS: update the Amlogic VDEC driver maintainer entry
Neil Armstrong [Tue, 28 Apr 2020 12:50:36 +0000 (14:50 +0200)]
media: MAINTAINERS: update the Amlogic VDEC driver maintainer entry

Add myself as co-maintainer of the Amlogic VDEC driver, and add the
missing vdec DT yaml bindings.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: meson: vdec: enable mcrcc for VP9
Maxime Jourdan [Tue, 28 Apr 2020 12:50:34 +0000 (14:50 +0200)]
media: meson: vdec: enable mcrcc for VP9

The motion compensation reference cache controller allows caching
parts of reference frames for faster decoding.

Fixes: 00c43088aa68 ("media: meson: vdec: add VP9 decoder support")
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cx231xx: Remove unneeded semicolon
Zou Wei [Tue, 28 Apr 2020 12:08:09 +0000 (14:08 +0200)]
media: cx231xx: Remove unneeded semicolon

Fixes coccicheck warnings:

drivers/media/usb/cx231xx/cx231xx-avcore.c:610:3-4: Unneeded semicolon

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rcar-csi2: Fix comment of VCDT/VCDT2 register
Koji Matsuoka [Fri, 24 Apr 2020 10:39:45 +0000 (12:39 +0200)]
media: rcar-csi2: Fix comment of VCDT/VCDT2 register

According to latest H/W manual v1.50, the description of channel
number in the VCDT/VCDT2 register is decremented by one.
Therefore, this patch fixes it about comment.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Default colorspace to SRGB
Steve Longerbeam [Tue, 21 Apr 2020 16:29:40 +0000 (18:29 +0200)]
media: imx: utils: Default colorspace to SRGB

The function imx_media_init_mbus_fmt() initializes the imx subdevice
mbus colorimetry to some sane defaults when the subdevice is registered.
Currently it guesses at a colorspace based on the passed mbus pixel
format. If the format is RGB, it chooses colorspace V4L2_COLORSPACE_SRGB,
and if the format is YUV, it chooses V4L2_COLORSPACE_SMPTE170M.

While that might be a good guess, it's not necessarily true that a RGB
pixel format encoding uses a SRGB colorspace, or that a YUV encoding
uses a SMPTE170M colorspace. Instead of making this dubious guess,
just default the colorspace to SRGB.

Reported-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dt-bindings: media: rockchip-vpu: fix interrupt-names
Johan Jonker [Tue, 21 Apr 2020 15:51:31 +0000 (17:51 +0200)]
media: dt-bindings: media: rockchip-vpu: fix interrupt-names

A test with the command below gives for example this error:

arch/arm64/boot/dts/rockchip/rk3328-evb.dt.yaml: video-codec@ff350000:
interrupts: [[0, 9, 4]] is too short
arch/arm64/boot/dts/rockchip/rk3328-evb.dt.yaml: video-codec@ff350000:
interrupt-names: ['vdpu'] is too short
arch/arm64/boot/dts/rockchip/rk3328-evb.dt.yaml: video-codec@ff350000:
interrupt-names:0: 'vepu' was expected

With the conversion of rockchip-vpu.txt to yaml the correct
'interrupt-names' for rk3328 was not included, so add them now.
Also add 'minItems' to 'interrupts'for the completeness.

make ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-vpu.yaml

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: enable RGB capture format with YUV media bus
Dafna Hirschfeld [Sun, 12 Apr 2020 12:05:04 +0000 (14:05 +0200)]
media: staging: rkisp1: cap: enable RGB capture format with YUV media bus

In selfpath, RGB capture formats are received in the sink pad as YUV
and are converted to RGB only when writing to memory. So the validation
function should accept YUV bus formats with RGB capture encoding.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: rsz: change (hv)div only if capture format is YUV
Dafna Hirschfeld [Sun, 12 Apr 2020 12:05:03 +0000 (14:05 +0200)]
media: staging: rkisp1: rsz: change (hv)div only if capture format is YUV

RGB formats in selfpath should receive input format as YUV422.
The resizer input format is always YUV422 and therefore
if the capture format is RGB, the resizer should not change
the YUV rations.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: rsz: remove redundant if statement and add inline doc
Dafna Hirschfeld [Sun, 12 Apr 2020 12:05:02 +0000 (14:05 +0200)]
media: staging: rkisp1: rsz: remove redundant if statement and add inline doc

The statement "if (rsz->fmt_type == V4L2_PIXEL_ENC_YUV)"
can be removed since the value of rsz->fmt_type is either
V4L2_PIXEL_ENC_YUV or V4L2_PIXEL_ENC_BAYER and the function
returns if it is bayer. In addition some doc with clarification
is added.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: rsz: get the capture format info from the capture struct
Dafna Hirschfeld [Sun, 12 Apr 2020 12:05:01 +0000 (14:05 +0200)]
media: staging: rkisp1: rsz: get the capture format info from the capture struct

Currently the format info of the capture is retrieved by calling
the function v4l2_format_info. This is not needed since it is
already saved in the capture object.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: ipu3-imgu: Add a sanity check for the parameter struct size
Sakari Ailus [Thu, 16 Apr 2020 07:45:07 +0000 (09:45 +0200)]
media: staging: ipu3-imgu: Add a sanity check for the parameter struct size

There have been cases where seemingly innocuous patches have broken the
uAPI by changing the memory layout of the parameter struct. Generally such
changes also introduce a change in the size of the entire struct. This
patch adds a sanity check to avoid such cases happening in the future.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Tested-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: ipu3-imgu: Move alignment attribute to field
Sakari Ailus [Wed, 15 Apr 2020 15:40:09 +0000 (17:40 +0200)]
media: staging: ipu3-imgu: Move alignment attribute to field

Move the alignment attribute of struct ipu3_uapi_awb_fr_config_s to the
field in struct ipu3_uapi_4a_config, the other location where the struct
is used.

Fixes: commit c9d52c114a9f ("media: staging: imgu: Address a compiler warning on alignment")
Reported-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Bingbu Cao <bingbu.cao@intel.com>
Cc: stable@vger.kernel.org # for v5.3 and up
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: Revert "staging: imgu: Address a compiler warning on alignment"
Sakari Ailus [Wed, 15 Apr 2020 15:34:05 +0000 (17:34 +0200)]
media: Revert "staging: imgu: Address a compiler warning on alignment"

This reverts commit c9d52c114a9fcc61c30512c7f810247a9f2812af.

The patch being reverted changed the memory layout of struct
ipu3_uapi_acc_param. Revert it, and address the compiler warning issues in
further patches.

Fixes: commit c9d52c114a9f ("media: staging: imgu: Address a compiler warning on alignment")
Reported-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Bingbu Cao <bingbu.cao@intel.com>
Cc: stable@vger.kernel.org # for v5.3 and up
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: MAINTAINERS: ipu3-imgu: Add Tian Shu and Bingbu as reviewers
Sakari Ailus [Wed, 22 Apr 2020 18:13:26 +0000 (20:13 +0200)]
media: MAINTAINERS: ipu3-imgu: Add Tian Shu and Bingbu as reviewers

Add Bingbu Cao and Tian Shu Qiu as reviewers for the IPU3 ImgU driver.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Bingbu Cao <bingbu.cao@intel.com>
Cc: Tian Shu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3.rst: add explanation for running mode
Bingbu Cao [Fri, 17 Apr 2020 09:34:33 +0000 (11:34 +0200)]
media: ipu3.rst: add explanation for running mode

Add some explanation of the ImgU running mode and add more information
about firmware selection and running mode usage.

Signed-off-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>
4 years agomedia: staging: ipu3: Fix stale list entries on parameter queue failure
Tomasz Figa [Sat, 11 Apr 2020 17:37:10 +0000 (19:37 +0200)]
media: staging: ipu3: Fix stale list entries on parameter queue failure

When queuing parameters fails, current code bails out without deleting
the corresponding vb2 buffer from the driver buffer list, but the buffer
is returned to vb2. This leads to stale list entries and a crash when
the driver stops streaming:

[  224.935561] ipu3-imgu 0000:00:05.0: set parameters failed.
[  224.998932] ipu3-imgu 0000:00:05.0: set parameters failed.
[  225.064430] ipu3-imgu 0000:00:05.0: set parameters failed.
[  225.128534] ipu3-imgu 0000:00:05.0: set parameters failed.
[  225.194945] ipu3-imgu 0000:00:05.0: set parameters failed.
[  225.360363] ------------[ cut here ]------------
[  225.360372] WARNING: CPU: 0 PID: 6704 at
drivers/media/common/videobuf2/videobuf2-core.c:927
vb2_buffer_done+0x20f/0x21a [videobuf2_common]
[  225.360374] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp
nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput
ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common
videobuf2_dma_sg videobuf2_memops ov13858 ov5670 v4l2_fwnode dw9714
acpi_als xt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring
cros_ec_light_prox cros_ec_sensors cros_ec_sensors_core
industrialio_triggered_buffer kfifo_buf industrialio
cros_ec_sensorsupport cdc_ether btusb btrtl btintel btbcm usbnet
bluetooth ecdh_generic ecc hid_google_hammer iwlmvm iwl7000_mac80211
r8152 mii lzo_rle lzo_compress iwlwifi zram cfg80211 joydev
[  225.360400] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G
C        5.4.30 #5
[  225.360402] Hardware name: HP Soraka/Soraka, BIOS
Google_Soraka.10431.106.0 12/03/2019
[  225.360405] RIP: 0010:vb2_buffer_done+0x20f/0x21a [videobuf2_common]
[  225.360408] Code: 5e 41 5f 5d e9 e0 16 5a d4 41 8b 55 08 48 c7 c7 8f
8b 5c c0 48 c7 c6 36 9a 5c c0 44 89 f9 31 c0 e8 a5 1c 5b d4 e9 53 fe ff
ff <0f> 0b eb a3 e8 12 d7 43 d4 eb 97 0f 1f 44 00 00 55 48 89 e5 41 56
[  225.360410] RSP: 0018:ffff9468ab32fba8 EFLAGS: 00010297
[  225.360412] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX:
ffff8aa7a51577a8
[  225.360414] RDX: 0000000000000000 RSI: 0000000000000006 RDI:
ffff8aa7a5157400
[  225.360416] RBP: ffff9468ab32fbd8 R08: ffff8aa64e47e600 R09:
0000000000000000
[  225.360418] R10: 0000000000000000 R11: ffffffffc06036e6 R12:
dead000000000100
[  225.360420] R13: ffff8aa7820f1940 R14: ffff8aa7a51577a8 R15:
0000000000000006
[  225.360422] FS:  00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000)
knlGS:0000000000000000
[  225.360424] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  225.360426] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4:
00000000003606f0
[  225.360427] Call Trace:
[  225.360434]  imgu_return_all_buffers+0x6f/0x8e [ipu3_imgu]
[  225.360438]  imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu]
[  225.360441]  __vb2_queue_cancel+0x33/0x22d [videobuf2_common]
[  225.360443]  vb2_core_streamoff+0x16/0x78 [videobuf2_common]
[  225.360448]  __video_do_ioctl+0x33d/0x42a
[  225.360452]  video_usercopy+0x34a/0x615
[  225.360455]  ? video_ioctl2+0x16/0x16
[  225.360458]  v4l2_ioctl+0x46/0x53
[  225.360462]  do_vfs_ioctl+0x50a/0x787
[  225.360465]  ksys_ioctl+0x58/0x83
[  225.360468]  __x64_sys_ioctl+0x1a/0x1e
[  225.360470]  do_syscall_64+0x54/0x68
[  225.360474]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  225.360476] RIP: 0033:0x7c118030f497
[  225.360479] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00
48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f
05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48
[  225.360480] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX:
0000000000000010
[  225.360483] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX:
00007c118030f497
[  225.360484] RDX: 00007c114001019c RSI: 0000000040045613 RDI:
000000000000004c
[  225.360486] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09:
0000000000000000
[  225.360488] R10: 0000000000000000 R11: 0000000000000246 R12:
00007c11400101b0
[  225.360489] R13: 00007c1140010200 R14: 00007c1140010048 R15:
0000000000000001
[  225.360492] ---[ end trace 73625ecfbd1c930e ]---
[  225.360498] general protection fault: 0000 [#1] PREEMPT SMP PTI
[  225.360501] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G
WC        5.4.30 #5
[  225.360502] Hardware name: HP Soraka/Soraka, BIOS
Google_Soraka.10431.106.0 12/03/2019
[  225.360505] RIP: 0010:imgu_return_all_buffers+0x52/0x8e [ipu3_imgu]
[  225.360507] Code: d4 49 8b 85 70 0a 00 00 49 81 c5 70 0a 00 00 49 39
c5 74 3b 49 bc 00 01 00 00 00 00 ad de 49 8d 5c 24 22 4c 8b 30 48 8b 48
08 <49> 89 4e 08 4c 89 31 4c 89 20 48 89 58 08 48 8d b8 58 fc ff ff 44
[  225.360509] RSP: 0018:ffff9468ab32fbe8 EFLAGS: 00010293
[  225.360511] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX:
dead000000000122
[  225.360512] RDX: 0000000000000000 RSI: 0000000000000006 RDI:
ffff8aa7a5157400
[  225.360514] RBP: ffff9468ab32fc18 R08: ffff8aa64e47e600 R09:
0000000000000000
[  225.360515] R10: 0000000000000000 R11: ffffffffc06036e6 R12:
dead000000000100
[  225.360517] R13: ffff8aa7820f1940 R14: dead000000000100 R15:
0000000000000006
[  225.360519] FS:  00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000)
knlGS:0000000000000000
[  225.360521] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  225.360523] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4:
00000000003606f0
[  225.360525] Call Trace:
[  225.360528]  imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu]
[  225.360531]  __vb2_queue_cancel+0x33/0x22d [videobuf2_common]
[  225.360534]  vb2_core_streamoff+0x16/0x78 [videobuf2_common]
[  225.360537]  __video_do_ioctl+0x33d/0x42a
[  225.360540]  video_usercopy+0x34a/0x615
[  225.360542]  ? video_ioctl2+0x16/0x16
[  225.360546]  v4l2_ioctl+0x46/0x53
[  225.360548]  do_vfs_ioctl+0x50a/0x787
[  225.360551]  ksys_ioctl+0x58/0x83
[  225.360554]  __x64_sys_ioctl+0x1a/0x1e
[  225.360556]  do_syscall_64+0x54/0x68
[  225.360559]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  225.360561] RIP: 0033:0x7c118030f497
[  225.360563] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00
48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f
05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48
[  225.360565] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX:
0000000000000010
[  225.360567] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX:
00007c118030f497
[  225.360569] RDX: 00007c114001019c RSI: 0000000040045613 RDI:
000000000000004c
[  225.360570] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09:
0000000000000000
[  225.360572] R10: 0000000000000000 R11: 0000000000000246 R12:
00007c11400101b0
[  225.360574] R13: 00007c1140010200 R14: 00007c1140010048 R15:
0000000000000001
[  225.360576] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp
nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput
ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common
videobuf2_dma_sg videobuf2_memops ov13858 ov567

Fix this by moving the list_del() call just below the list_first_entry()
call when the buffer no longer needs to be in the list.

Fixes: 8ecc7c9da013 ("media: staging/intel-ipu3: parameter buffer refactoring")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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>
4 years agomedia: venus: venc,vdec: Return EBUSY on S_FMT while streaming
Stanimir Varbanov [Sat, 18 Apr 2020 09:06:22 +0000 (11:06 +0200)]
media: venus: venc,vdec: Return EBUSY on S_FMT while streaming

According to the v4l spec s_fmt must return EBUSY while the
particular queue is streaming. Add such check in encoder and
decoder s_fmt methods.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: Mark last capture buffer
Stanimir Varbanov [Fri, 3 Apr 2020 15:56:29 +0000 (17:56 +0200)]
media: venus: Mark last capture buffer

According to stateful Codec API the decoder will process all
remaining buffers from before the source change event in
dynamic-resolution-change state and mark the last buffer with
V4L2_BUF_FLAG_LAST.

In Venus case the firmware doesn't mark that last buffer and
some mechanism have to be created in v4l decoder driver.
Fortunately the firmware interface (HFI) claims that the
decoder output buffers will be returned to v4l decoder
driver before it send the insufficient event.

In order to do that we save last queued in the driver capture
buffer in the event_notify and issue flush on output firmware
buffers queue. Once the saved buffer is returned (as a result of
flush command) we mark it as LAST. For all that possible we
extend HFI flush command with one more argument and one more
flush_done HFI driver callback.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: vdec: Init registered list unconditionally
Stanimir Varbanov [Fri, 3 Apr 2020 13:10:13 +0000 (15:10 +0200)]
media: venus: vdec: Init registered list unconditionally

Presently the list initialization is done only in
dynamic-resolution-change state, which leads to list corruptions
and use-after-free. Init list_head unconditionally in
vdec_stop_capture called by vb2 stop_streaming without takeing
into account current codec state.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: vdec: Mark flushed buffers with error state
Stanimir Varbanov [Tue, 31 Mar 2020 16:19:51 +0000 (18:19 +0200)]
media: venus: vdec: Mark flushed buffers with error state

Once the hfi_session_flush is issued by the vdec all queued
buffers to firmware should be returned to the v4l driver. Some
of those buffers are not processed at the time of flush command,
those buffers has filled len zero (no data). Catch that in
buffer_done callback and mark not filled capture buffers with
error state so that client can discard them.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: helpers: Done buffers per queue type
Stanimir Varbanov [Tue, 31 Mar 2020 15:47:38 +0000 (17:47 +0200)]
media: venus: helpers: Done buffers per queue type

Currently calling venus_helper_buffers_done() will return buffers to
user for both capture and output queues in the same call. This is
wrong because both queues are really separate and calling
stop_streaming on one queue shouldn't return buffers for the other.
Solve this by add a new queue type argument and fix the clients of
the helper function.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: core: Constify codec frequency data array
Stanimir Varbanov [Tue, 31 Mar 2020 15:42:52 +0000 (17:42 +0200)]
media: venus: core: Constify codec frequency data array

The array is not changed in the code, so make it const.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: core: Fix mutex destroy in remove
Stanimir Varbanov [Tue, 31 Mar 2020 15:37:02 +0000 (17:37 +0200)]
media: venus: core: Fix mutex destroy in remove

The hfi_destroy function is called too early in remove method. It
destroys a mutex which is used later in the .remove from pmruntime.
Solve the issue by moving hfi_destroy after last usage of the mutex.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: core: Add missing mutex destroy
Stanimir Varbanov [Tue, 31 Mar 2020 14:54:28 +0000 (16:54 +0200)]
media: venus: core: Add missing mutex destroy

This adds missing mutex_destroy in remove method of venus core driver.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls.h: clarify the p_def argument of v4l2_ctrl_new_std_compound
Hans Verkuil [Thu, 23 Apr 2020 11:42:32 +0000 (13:42 +0200)]
media: v4l2-ctrls.h: clarify the p_def argument of v4l2_ctrl_new_std_compound

It was not sufficiently clear how to create and use p_def.
Improve the documentation.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cec-gpio: handle gpiod_get_value errors correctly
Hans Verkuil [Tue, 21 Apr 2020 09:23:41 +0000 (11:23 +0200)]
media: cec-gpio: handle gpiod_get_value errors correctly

gpiod_get_value() can return negative values if an error occurs.
In several places this error code was ignored.

Ensure that errors codes are handled correctly throughout the CEC
pin framework and CEC pin drivers.

The return code of the cec_pin_ops read() callback had to be changed
from 'bool' to 'int', which mean the prototype of that callback in the
sun4i drm driver also had to be changed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidioc-reqbufs/create-bufs.rst: fix typo
Hans Verkuil [Mon, 20 Apr 2020 12:57:38 +0000 (14:57 +0200)]
media: vidioc-reqbufs/create-bufs.rst: fix typo

any others capabilities -> any other capabilities

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: MAINTAINERS: adjust entries to moving CEC USB drivers
Lukas Bulwahn [Sat, 18 Apr 2020 09:45:46 +0000 (11:45 +0200)]
media: MAINTAINERS: adjust entries to moving CEC USB drivers

Commit a81068181aad ("media: move CEC USB drivers to a separate directory")
moved drivers/media/usb/{pulse8,rainshadow}-cec to
drivers/media/cec/usb/{rainshadow,pulse8}, but did not adjust the entries
in MAINTAINERS.

Since then, ./scripts/get_maintainer.pl --self-test=patterns complains:

  warning: no file matches F: drivers/media/usb/pulse8-cec/*
  warning: no file matches F: drivers/media/usb/rainshadow-cec/*

Update the MAINTAINERS entries to the new file locations.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vimc: cap: Report a colorspace
Niklas Söderlund [Fri, 17 Apr 2020 15:09:29 +0000 (17:09 +0200)]
media: vimc: cap: Report a colorspace

The colorspace reported by a video nodes should not be
V4L2_COLORSPACE_DEFAULT. Instead a default colorspace should be picked
by the driver if V4L2_COLORSPACE_DEFAULT is given by userspace to
{G,S,TRY}_FMT.

The colorspace V4L2_COLORSPACE_SRGB is arbitrary chosen as the vimc
default format to report as it's used for most webcams.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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>
4 years agomedia: si2157: ensure wait_status is initialized
Sean Young [Wed, 22 Apr 2020 19:16:46 +0000 (21:16 +0200)]
media: si2157: ensure wait_status is initialized

smatch reports wait_status is uninitialized, because smatch cannot assume
the loop body is ever executed.

Clarify the code so that wait_status is retrieved at least once.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rc: no need for decoder state if decoder not enabled
Sean Young [Tue, 21 Apr 2020 10:19:27 +0000 (12:19 +0200)]
media: rc: no need for decoder state if decoder not enabled

One struct ir_raw_event_ctrl is allocated per raw IR device; reduce the
amount allocated if not all decoders are enabled.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: m88ds3103: error in set_frontend is swallowed and not reported
Sean Young [Thu, 16 Apr 2020 14:22:15 +0000 (16:22 +0200)]
media: m88ds3103: error in set_frontend is swallowed and not reported

Bail out if registers can not be updated.

Addresses-Coverity-ID: 1461655 ("Code maintainability issues")

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Fixes: e6089feca460 ("media: m88ds3103: Add support for ds3103b demod")
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: Kconfig: fix some dvb-usb-v2 dependencies
Mauro Carvalho Chehab [Thu, 23 Apr 2020 15:58:13 +0000 (17:58 +0200)]
media: Kconfig: fix some dvb-usb-v2 dependencies

There are some tuners used by a few pure DVB boards that use
internally V4L2 function calls. Due to that, such drivers now
depends on v4l2 core support, and can't be auto-selected
if !VIDEO_V4L2:

WARNING: unmet direct dependencies detected for DVB_RTL2832_SDR
  Depends on [n]: MEDIA_SUPPORT [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_CORE [=y] && I2C [=y] && I2C_MUX [=y] && VIDEO_V4L2 [=n] && MEDIA_SDR_SUPPORT [=y] && USB [=y]
  Selected by [y]:
  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y] && MEDIA_SDR_SUPPORT [=y]

WARNING: unmet direct dependencies detected for MEDIA_TUNER_E4000
  Depends on [n]: (MEDIA_ANALOG_TV_SUPPORT [=y] || MEDIA_DIGITAL_TV_SUPPORT [=y] || MEDIA_RADIO_SUPPORT [=y] || MEDIA_SDR_SUPPORT [=y]) && MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
  Selected by [y]:
  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y]

WARNING: unmet direct dependencies detected for MEDIA_TUNER_FC2580
  Depends on [n]: (MEDIA_ANALOG_TV_SUPPORT [=y] || MEDIA_DIGITAL_TV_SUPPORT [=y] || MEDIA_RADIO_SUPPORT [=y] || MEDIA_SDR_SUPPORT [=y]) && MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
  Selected by [y]:
  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y]

Detected via randconfig builds.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: platform: fix VIA_CAMERA dependencies
Mauro Carvalho Chehab [Thu, 23 Apr 2020 14:46:07 +0000 (16:46 +0200)]
media: platform: fix VIA_CAMERA dependencies

As detected by a randconfig:

WARNING: unmet direct dependencies detected for VIDEO_OV7670
  Depends on [n]: MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
  Selected by [y]:
  - VIDEO_VIA_CAMERA [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && V4L_PLATFORM_DRIVERS [=y] && FB_VIA [=y]

There's a missing dependency on VIDEO_V4L2 for VIA_CAMERA.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: tuners: Kconfig: add some missing VIDEO_V4L2 dependencies
Mauro Carvalho Chehab [Wed, 22 Apr 2020 20:53:12 +0000 (22:53 +0200)]
media: tuners: Kconfig: add some missing VIDEO_V4L2 dependencies

There are three tuners that depend on some functions inside
V4L2 core:

$ git grep -l -E 'v4l2_[0-9a-zA-Z_]+\(' drivers/media/tuners/
drivers/media/tuners/e4000.c
drivers/media/tuners/fc2580.c
drivers/media/tuners/msi001.c

Make them dependent of VIDEO_V4L2, as otherwise, this would happen:

on x86_64:
CONFIG_VIDEO_V4L2=m
CONFIG_MEDIA_TUNER_E4000=y

ld: drivers/media/tuners/e4000.o: in function `e4000_remove':
e4000.c:(.text+0x34): undefined reference to `v4l2_ctrl_handler_free'
ld: drivers/media/tuners/e4000.o: in function `e4000_probe':
e4000.c:(.text+0x16c1): undefined reference to `v4l2_ctrl_handler_init_class'
ld: e4000.c:(.text+0x16eb): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x1731): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x1762): undefined reference to `v4l2_ctrl_auto_cluster'
ld: e4000.c:(.text+0x178c): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x17d6): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x1804): undefined reference to `v4l2_ctrl_auto_cluster'
ld: e4000.c:(.text+0x182e): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x1878): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x18a6): undefined reference to `v4l2_ctrl_auto_cluster'
ld: e4000.c:(.text+0x18d0): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x191a): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x1948): undefined reference to `v4l2_ctrl_auto_cluster'
ld: e4000.c:(.text+0x1972): undefined reference to `v4l2_ctrl_new_std'
ld: e4000.c:(.text+0x19a6): undefined reference to `v4l2_ctrl_handler_free'
ld: e4000.c:(.text+0x1a2a): undefined reference to `v4l2_i2c_subdev_init'

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agoMAINTAINERS: reorder media attributes
Mauro Carvalho Chehab [Wed, 22 Apr 2020 13:59:54 +0000 (15:59 +0200)]
MAINTAINERS: reorder media attributes

Some media entry attributes got out of the order after the
bug was split into 3. Also, as reported by Johan, the
Rockchip VPU entry also had their attributes at the wrong
order.

As those entries weren't merged yet upstream, let's reorder
them with:

./scripts/parse-maintainers.pl --input=MAINTAINERS --output=MAINTAINERS --order

Reported-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: MAINTAINERS: Fix Hantro, Rga and Rkvdec entries
Ezequiel Garcia [Wed, 22 Apr 2020 11:14:03 +0000 (13:14 +0200)]
media: MAINTAINERS: Fix Hantro, Rga and Rkvdec entries

It seems recent merges introduced a couple issues
here, so let's fix them all. Also, reorder Rockchip
video decoder as per parse-maintainers.pl script
and add linux-rockchip mailing list.

Reported-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rkisp1: fix missing mbus.type -> mbus_type conversion
Hans Verkuil [Wed, 22 Apr 2020 11:14:21 +0000 (13:14 +0200)]
media: rkisp1: fix missing mbus.type -> mbus_type conversion

There was one missing sensor->mbus.type to sensor->mbus_type
conversion which broke the build.

I suspect this was due to a merge conflict that was incorrectly resolved.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: split driver-specific indexes to new files
Mauro Carvalho Chehab [Sat, 18 Apr 2020 10:07:11 +0000 (12:07 +0200)]
media: admin-guide: split driver-specific indexes to new files

In order to better organize the main admin-guide index,
place the driver-specific indexes on separate files.

This ensures a more consistent numbering at the main index.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: reorganize the guide
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:59:24 +0000 (11:59 +0200)]
media: admin-guide: reorganize the guide

Separate the generic documentation from the driver-specific
parts, and use a better title for the documentation.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: bt8xx.rst: fix a broken cross-reference
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:59:20 +0000 (11:59 +0200)]
media: admin-guide: bt8xx.rst: fix a broken cross-reference

The old cards.rst file doesn't exist anymore. Also, it is not
the right reference there, as it should be pointing to the
bttv-specific cardlist.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add test-drivers
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:15:06 +0000 (11:15 +0200)]
media: admin-guide: add test-drivers

While test drivers is probably something that normal users
won't bother, it doesn't hurt to add them to the card list.

This way, all drivers, except for the ones under staging,
would be listed there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add card lists for radio and firewire
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:13:58 +0000 (11:13 +0200)]
media: admin-guide: add card lists for radio and firewire

Document the supported radio devices, plus document the
firewire driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add SPI cards to platform drivers
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:13:58 +0000 (11:13 +0200)]
media: admin-guide: add SPI cards to platform drivers

The SPI cards are also under the concept of "platform" drivers
as defined at the section introduction.

So, add a SPI card list there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a list of I2C drivers
Mauro Carvalho Chehab [Sat, 18 Apr 2020 09:08:54 +0000 (11:08 +0200)]
media: admin-guide: add a list of I2C drivers

For completeness, let's add a list of I2C drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a list of platform drivers
Mauro Carvalho Chehab [Sat, 18 Apr 2020 08:56:34 +0000 (10:56 +0200)]
media: admin-guide: add a list of platform drivers

There's no reason why to keep platform drivers out of the
card list. Add them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a table with USB drivers
Mauro Carvalho Chehab [Sat, 18 Apr 2020 08:48:04 +0000 (10:48 +0200)]
media: admin-guide: add a table with USB drivers

Having a table with a list of all USB drivers seems worth,
and it comes almost for free, as we can just use Kconfig
descriptions (with some adjustments).

So, add a table for that.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a list of media PCI cards
Mauro Carvalho Chehab [Sat, 18 Apr 2020 08:23:29 +0000 (10:23 +0200)]
media: admin-guide: add a list of media PCI cards

Instead of listing "other" PCI card list, just add a list with
the existing drivers (not including sub-drivers).

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: replace the frontend drivers list
Mauro Carvalho Chehab [Sat, 18 Apr 2020 08:16:06 +0000 (10:16 +0200)]
media: admin-guide: replace the frontend drivers list

The frontend drivers list is incomplete. Update it from
what's there at the Kernel Kconfig files.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: split DVB cards.rst
Mauro Carvalho Chehab [Sat, 18 Apr 2020 06:40:57 +0000 (08:40 +0200)]
media: admin-guide: split DVB cards.rst

The DVB cards.rst file is old and outdated. It also contains
data that are contained on other cardlists. Remove the
duplicated information and split frontends and PCI cards on
separate files.

As all USB cards already have their own card lists, just drop
the old USB data there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a cardlist for all other USB cards
Mauro Carvalho Chehab [Fri, 17 Apr 2020 15:58:04 +0000 (17:58 +0200)]
media: admin-guide: add a cardlist for all other USB cards

There are several other USB cards. Most of them support just
one device. The only exception is the "pwc" driver. But, as
updates to it are not frequent, let's just place everything
manually into a single file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a card list for the Siano driver
Mauro Carvalho Chehab [Fri, 17 Apr 2020 16:42:24 +0000 (18:42 +0200)]
media: admin-guide: add a card list for the Siano driver

The siano driver looks like em28xx, except that its cards
are split on 3 drivers.

Add a card list for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add support for the remaining dvb-usb boards
Mauro Carvalho Chehab [Fri, 17 Apr 2020 10:36:51 +0000 (12:36 +0200)]
media: admin-guide: add support for the remaining dvb-usb boards

Add documentation for the remaining dvb-usb boards.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add dibusb-mb and dibusb-mc card lists
Mauro Carvalho Chehab [Fri, 17 Apr 2020 08:58:43 +0000 (10:58 +0200)]
media: admin-guide: add dibusb-mb and dibusb-mc card lists

Document the supported dib0300 boards.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add cardlist for dib0700 driver
Mauro Carvalho Chehab [Thu, 16 Apr 2020 15:07:03 +0000 (17:07 +0200)]
media: admin-guide: add cardlist for dib0700 driver

Document the cards supported by dib0700 driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add dvb-usb-v2 card lists
Mauro Carvalho Chehab [Thu, 16 Apr 2020 13:17:06 +0000 (15:17 +0200)]
media: admin-guide: add dvb-usb-v2 card lists

Include cardlist documentation for the sub-drivers supported by
dvb-usb-v2 core.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: improve cardlist.rst documentation
Mauro Carvalho Chehab [Thu, 16 Apr 2020 12:20:54 +0000 (14:20 +0200)]
media: admin-guide: improve cardlist.rst documentation

The cardlist section is important for some boards, because they
may require extra modprobe parameters.

Improve the docs to mention that.

Thanks-to: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for providing me some PCI IDs
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a generic building guide
Mauro Carvalho Chehab [Thu, 16 Apr 2020 11:31:50 +0000 (13:31 +0200)]
media: admin-guide: add a generic building guide

Several of the existing documents under the media admin-guide
contain build procedures.

Add an specific chapter describing it. This document was
partially inspired on the modifications I made to the bttv.rst
file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: Add an introduction chapter
Mauro Carvalho Chehab [Thu, 16 Apr 2020 11:31:40 +0000 (13:31 +0200)]
media: admin-guide: Add an introduction chapter

The media's admin guide is currently just a group of
not-connected docs.

Add an introduction chapter for it to start making sense
to a random reader.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: update em28xx cardlist
Mauro Carvalho Chehab [Thu, 16 Apr 2020 10:37:23 +0000 (12:37 +0200)]
media: admin-guide: update em28xx cardlist

A new em28xx card was added upstream. Update cards list
accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: admin-guide: add a card list for cx231xx boards
Mauro Carvalho Chehab [Thu, 16 Apr 2020 10:24:02 +0000 (12:24 +0200)]
media: admin-guide: add a card list for cx231xx boards

It is interesting to have a card list also for cx231xx
driver, as it currently supports 27 different boards.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: pwc-if: place USB device list on numberical order
Mauro Carvalho Chehab [Fri, 17 Apr 2020 15:29:40 +0000 (17:29 +0200)]
media: pwc-if: place USB device list on numberical order

It seems easier to maintain the list if the USB_DEVICE
is ordered.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: pwc-if.c: Update comments about each pwc supported model
Mauro Carvalho Chehab [Fri, 17 Apr 2020 15:26:56 +0000 (17:26 +0200)]
media: pwc-if.c: Update comments about each pwc supported model

The USB_DEVICE() list contain some of the product names, but
some are missing, and others are different than the message
printed during device detection.

Update the comments in order to match what the driver prints.

That makes easier to discover what model matches what physical
device.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dvb-usb-v2: use DVB_USB_DEVICE() macro
Mauro Carvalho Chehab [Thu, 16 Apr 2020 14:11:52 +0000 (16:11 +0200)]
media: dvb-usb-v2: use DVB_USB_DEVICE() macro

Instead of using USB_DEVICE() macro directly, use the
DVB_USB_DEVICE() one, as other dvb-usb-v2 devices.

The usage of the new macro makes cleaner and easier to
parse the supported device names in a way that it would
be easily parseable to generate cardlists.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dvb-usb-ids.h: fix an USB PID name
Mauro Carvalho Chehab [Thu, 16 Apr 2020 13:58:55 +0000 (15:58 +0200)]
media: dvb-usb-ids.h: fix an USB PID name

The USB_PID_ALINK_DTU is a Product ID, not a vendor ID.

Fix that.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dt-bindings: media: rockchip-rga: add power-domains property
Johan Jonker [Fri, 3 Apr 2020 13:06:07 +0000 (15:06 +0200)]
media: dt-bindings: media: rockchip-rga: add power-domains property

In the old txt situation we add/describe only properties that are used
by the driver/hardware itself. With yaml it also filters things in a
node that are used by other drivers like 'power-domains' for rk3399,
so add it to 'rockchip-rga.yaml'.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-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>
4 years agomedia: dt-bindings: media: convert rockchip rga bindings to yaml
Johan Jonker [Fri, 3 Apr 2020 13:06:06 +0000 (15:06 +0200)]
media: dt-bindings: media: convert rockchip rga bindings to yaml

Current dts files for Rockchip with 'rga' nodes
are manually verified. In order to automate this process
rockchip-rga.txt has to be converted to yaml.

Changed:
  Add missing reg property

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-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>
4 years agomedia: staging: rkisp1: cap: support uv swapped planar formats
Dafna Hirschfeld [Sat, 11 Apr 2020 16:06:01 +0000 (18:06 +0200)]
media: staging: rkisp1: cap: support uv swapped planar formats

Planar formats with the u and v planes swapped can be
supported by swapping the address of the cb and cr buffers.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@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>
4 years agomedia: staging: rkisp1: cap: support uv swap only for semiplanar formats
Dafna Hirschfeld [Sat, 11 Apr 2020 16:06:00 +0000 (18:06 +0200)]
media: staging: rkisp1: cap: support uv swap only for semiplanar formats

The register RKISP1_CIF_MI_XTD_FORMAT_CTRL is relevant only
for semiplanar formats, therefore the uv swap can be supported
through this register only for semiplanar formats.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@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>
4 years agomedia: staging: rkisp1: cap: change the logic for writing to uv swap register
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:59 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: change the logic for writing to uv swap register

The register RKISP1_CIF_MI_XTD_FORMAT_CTRL is currently written
with "on" only if the u,v streams need to be swapped. This patch
also write to it with "off" if they don't need to be swapped.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@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>
4 years agomedia: staging: rkisp1: cap: fix value written to uv swap register in selfpath
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:58 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: fix value written to uv swap register in selfpath

The value RKISP1_CIF_MI_XTD_FMT_CTRL_SP_CB_CR_SWAP should be
set to the register instead of masking with ~BIT(1)

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>
4 years agomedia: staging: rkisp1: cap: cleanup in mainpath config for uv swap format
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:57 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: cleanup in mainpath config for uv swap format

The value RKISP1_CIF_MI_XTD_FMT_CTRL_MP_CB_CR_SWAP equals BIT(0),
Therefore when writing it to the register there is no need to mask
it first with ~BIT(0).

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-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>
4 years agomedia: v4l2-image-sizes: add HD and Full-HD definitions
Marco Felsch [Thu, 2 Apr 2020 08:49:57 +0000 (10:49 +0200)]
media: v4l2-image-sizes: add HD and Full-HD definitions

Add common (Full-)HD definitions also known as 720p and 1080p.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: coda: add RC enable controls
Philipp Zabel [Wed, 18 Mar 2020 18:36:49 +0000 (19:36 +0100)]
media: coda: add RC enable controls

Currently the encoder enables the rate control algorithms if the bitrate
control is non-zero. Implement the V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE
and V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE controls to allow userspace to
choose frame-level or macroblock-level rate control updates, or to
explicitly disable rate control. Both controls are initially enabled to
keep the current behavior.

Signed-off-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>
4 years agomedia: staging: rkisp1: replace the call to v4l2_async_notifier_parse_fwnode_endpoint...
Dafna Hirschfeld [Tue, 17 Mar 2020 18:07:01 +0000 (19:07 +0100)]
media: staging: rkisp1: replace the call to v4l2_async_notifier_parse_fwnode_endpoints_by_port

don't call 'v4l2_async_notifier_parse_fwnode_endpoints_by_port'
in order to register async subdevices. Instead call
'v4l2_fwnode_endpoint_parse' to parse the remote endpoints
and then register each async subdev with
'v4l2_async_notifier_add_fwnode_remote_subdev'

Also remove the relevant item in the TODO file

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>
4 years agomedia: staging: rkisp1: remove mbus field from rkisp1_sensor_async
Dafna Hirschfeld [Tue, 17 Mar 2020 18:07:00 +0000 (19:07 +0100)]
media: staging: rkisp1: remove mbus field from rkisp1_sensor_async

'struct v4l2_mbus_config' is a legacy struct that should not be used
in new drivers. So replace it with the fields:

enum v4l2_mbus_type mbus_type;
unsigned int mbus_flags;

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>
4 years agomedia: staging: rkisp1: cap: serialize start/stop stream
Helen Koike [Mon, 16 Mar 2020 21:00:44 +0000 (22:00 +0100)]
media: staging: rkisp1: cap: serialize start/stop stream

In order to support simultaneous streaming from both capture devices,
start/stop vb2 calls need to be serialized to allow multiple concurrent
calls.

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>
4 years agomedia: staging: rkisp1: cap: fix return values from pm functions
Helen Koike [Mon, 16 Mar 2020 21:00:43 +0000 (22:00 +0100)]
media: staging: rkisp1: cap: fix return values from pm functions

If no errors occurs, pm functions return usage counters, so they can
return positive numbers.
This happens when streaming from multiple capture devices (mainpath and
selfpath).

Fix simultaneous streaming from mainpath and selfpath by not failing
when pm usage counters returns a positive number.

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>
4 years agomedia: v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
Hans Verkuil [Tue, 3 Mar 2020 11:02:00 +0000 (12:02 +0100)]
media: v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()

Rather than creating new compound control helpers for each new
type, create one generic function and just create defines on
top.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON
Hans Verkuil [Tue, 3 Mar 2020 11:01:59 +0000 (12:01 +0100)]
media: v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON

If the v4l2_ctrl_g_ctrl*() or __v4l2_ctrl_s_ctrl*() functions
are called for the wrong control type then they call WARN_ON
since that is a driver error. But they still continue, potentially
overwriting data. Change this to return an error (s_ctrl) or 0
(g_ctrl), just to be safe.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: iguanair: rc drivers no longer need to do locking
Sean Young [Wed, 15 Apr 2020 11:47:38 +0000 (13:47 +0200)]
media: iguanair: rc drivers no longer need to do locking

Since commit 4957133fe32f ("media: lirc: improve locking"), drivers
do not need to do any of their own locking.

During suspend and resume, no processes are running so no locking is
needed.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cx25840: Register labeling, chip specific correction
Brad Love [Thu, 14 Nov 2019 20:04:08 +0000 (21:04 +0100)]
media: cx25840: Register labeling, chip specific correction

Remove vbi_regs_offset from a group of registers that are 888 specific,
include those registers names. Sources used for reference are 885 and 888
datasheets.

Add labels to some undocumented registers.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: lgdt3306a: Add CNR v5 stat
Brad Love [Thu, 14 Nov 2019 20:04:07 +0000 (21:04 +0100)]
media: lgdt3306a: Add CNR v5 stat

The CNR is already calculated, so populate DVBv5 CNR stat
during read_status.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: add on-demand rf strength func
Brad Love [Thu, 14 Nov 2019 20:04:06 +0000 (21:04 +0100)]
media: si2157: add on-demand rf strength func

Add get_rf_strength callback to get RSSI from the tuner. DVBv5
stat cache is updated. get_rf_strength is called by tuner_core
for analog tuners and is also used by some bridge drivers to
obtain RSSI directly from the tuner.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>