platform/kernel/linux-rpi.git
2 years agomedia: Makefiles: sort entries where it fits
Mauro Carvalho Chehab [Wed, 9 Mar 2022 13:17:02 +0000 (14:17 +0100)]
media: Makefiles: sort entries where it fits

Alphabetically sort entries at the Makefiles per group,
in ASCII order, e. g., using the output of:

$ LC_ALL=C sort Makefile |grep obj-y
...
$ LC_ALL=C sort Makefile |grep obj.*CONFIG
...

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: Makefiles: remove extra spaces
Mauro Carvalho Chehab [Wed, 9 Mar 2022 13:25:35 +0000 (14:25 +0100)]
media: Makefiles: remove extra spaces

It is hard to keep all those options aligned as newer config
changes get added, and we really don't want to have patches adding
new options also touching already existing entries.

So, drop the extra spaces.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: xc2028: rename the driver from tuner-xc2028
Mauro Carvalho Chehab [Wed, 9 Mar 2022 13:59:01 +0000 (14:59 +0100)]
media: xc2028: rename the driver from tuner-xc2028

This is the only tuner driver that has "tuner-" on its name.

Rename it, in order to match all the other tuner drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agoMerge tag 'br-v5.18s' of git://linuxtv.org/hverkuil/media_tree into media_stage
Mauro Carvalho Chehab [Mon, 7 Mar 2022 16:38:29 +0000 (17:38 +0100)]
Merge tag 'br-v5.18s' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

* tag 'br-v5.18s' of git://linuxtv.org/hverkuil/media_tree:
  ivtv: fix incorrect device_caps for ivtvfb
  media: rcar-csi2: Drop comma after SoC match table sentinel
  media: camss: Replace hard coded value with parameter
  media: saa7134: fix incorrect use to determine if list is empty
  media: MAINTAINERS: update rksip1 maintainers info
  MAINTAINERS: update media vimc driver maintainers
  media: i2c: max2175: Use rbtree rather than flat register cache

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agoMerge tag 'br-v5.18r' of git://linuxtv.org/hverkuil/media_tree into media_stage
Mauro Carvalho Chehab [Mon, 7 Mar 2022 16:36:23 +0000 (17:36 +0100)]
Merge tag 'br-v5.18r' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

* tag 'br-v5.18r' of git://linuxtv.org/hverkuil/media_tree:
  media: amphion: add amphion vpu entry in Kconfig and Makefile
  MAINTAINERS: add AMPHION VPU CODEC V4L2 driver entry
  media: amphion: implement malone decoder rpc interface
  media: amphion: implement windsor encoder rpc interface
  media: amphion: add v4l2 m2m vpu decoder stateful driver
  media: amphion: add v4l2 m2m vpu encoder stateful driver
  media: amphion: add vpu v4l2 m2m support
  media: amphion: implement vpu core communication based on mailbox
  media: amphion: add vpu core driver
  media: amphion: add amphion vpu device driver
  media: add nv12m_8l128 and nv12m_10be_8l128 video format.
  dt-bindings: media: amphion: add amphion video codec bindings

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agoivtv: fix incorrect device_caps for ivtvfb
Hans Verkuil [Sun, 6 Mar 2022 11:29:11 +0000 (12:29 +0100)]
ivtv: fix incorrect device_caps for ivtvfb

The VIDIOC_G_FBUF and related overlay ioctls no longer worked (-ENOTTY was
returned).

The root cause was the introduction of the caps field in ivtv-driver.h.
While loading the ivtvfb module would update the video_device device_caps
field with V4L2_CAP_VIDEO_OUTPUT_OVERLAY it would not update that caps
field, and that's what the overlay ioctls would look at.

It's a bad idea to keep information in two places, so drop the caps field
and only use vdev.device_caps.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Martin Dauskardt <martin.dauskardt@gmx.de>
Fixes: 2161536516ed (media: media/pci: set device_caps in struct video_device)

2 years agomedia: rcar-csi2: Drop comma after SoC match table sentinel
Geert Uytterhoeven [Thu, 3 Mar 2022 12:43:57 +0000 (13:43 +0100)]
media: rcar-csi2: Drop comma after SoC match table sentinel

It does not make sense to have a comma after a sentinel, as any new
elements must be added before the sentinel.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: camss: Replace hard coded value with parameter
Souptick Joarder (HPE) [Tue, 1 Mar 2022 06:05:30 +0000 (11:35 +0530)]
media: camss: Replace hard coded value with parameter

Kernel test robot reported below warning ->
drivers/media/platform/qcom/camss/camss-csid-gen2.c:407:3:
warning: Value stored to 'val' is never read
[clang-analyzer-deadcode.DeadStores]

Replace hard coded value with val.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: saa7134: fix incorrect use to determine if list is empty
Jakob Koschel [Mon, 28 Feb 2022 14:26:26 +0000 (15:26 +0100)]
media: saa7134: fix incorrect use to determine if list is empty

'dev' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the
list is empty.

Instead of checking the pointer it should be checked if
the list is empty.

Fixes: 79dd0c69f05f ("V4L: 925: saa7134 alsa is now a standalone module")
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: MAINTAINERS: update rksip1 maintainers info
Dafna Hirschfeld [Sat, 26 Feb 2022 11:35:38 +0000 (13:35 +0200)]
media: MAINTAINERS: update rksip1 maintainers info

Due to changes in maintainers info/position

Signed-off-by: Dafna Hirschfeld <dafna@fastmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agoMAINTAINERS: update media vimc driver maintainers
Shuah Khan [Wed, 23 Feb 2022 00:48:01 +0000 (17:48 -0700)]
MAINTAINERS: update media vimc driver maintainers

Based on the dicussion with Hans Verkuil and others in the thread below,
vimc is need of a maintainer. I will start maintaining the driver with
help from Kieran Bingham as the reviewer.

Link: https://lore.kernel.org/linux-media/5d5dee88-9dbf-e4d0-4a91-11ff4ecd82ea@xs4all.nl/
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Helen Koike <helen@koikeco.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: i2c: max2175: Use rbtree rather than flat register cache
Mark Brown [Tue, 22 Feb 2022 21:52:44 +0000 (21:52 +0000)]
media: i2c: max2175: Use rbtree rather than flat register cache

The max2175 uses a flat register cache but supplies only a single default
value and has many volatile registers. This is a poor fit for a flat cache
since the cache will assume a default of zero for any register not yet
written which can lead to bugs for example when regmap_update_bits()
suppresses a noop write. A rbtree cache is a much better fit, this will
only cache default values and values that have been written to the device
with any reads of uncached values going to the hardware. Convert the driver
to use a rbtree cache.

Since the device is controlled via I2C the cost of manging the rbtree
should be immaterial compared to the cost of accessing the device.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add amphion vpu entry in Kconfig and Makefile
Ming Qian [Thu, 24 Feb 2022 03:10:13 +0000 (11:10 +0800)]
media: amphion: add amphion vpu entry in Kconfig and Makefile

Add V4L2 driver entry for the amphion vpu encoder/decoder.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agoMAINTAINERS: add AMPHION VPU CODEC V4L2 driver entry
Ming Qian [Thu, 24 Feb 2022 03:10:11 +0000 (11:10 +0800)]
MAINTAINERS: add AMPHION VPU CODEC V4L2 driver entry

Add AMPHION VPU CODEC v4l2 driver entry

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: implement malone decoder rpc interface
Ming Qian [Thu, 24 Feb 2022 03:10:08 +0000 (11:10 +0800)]
media: amphion: implement malone decoder rpc interface

This part implements the malone decoder rpc interface.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: implement windsor encoder rpc interface
Ming Qian [Thu, 24 Feb 2022 03:10:07 +0000 (11:10 +0800)]
media: amphion: implement windsor encoder rpc interface

This part implements the windsor encoder rpc interface.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add v4l2 m2m vpu decoder stateful driver
Ming Qian [Thu, 24 Feb 2022 03:10:06 +0000 (11:10 +0800)]
media: amphion: add v4l2 m2m vpu decoder stateful driver

This consists of video decoder implementation plus decoder controls.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add v4l2 m2m vpu encoder stateful driver
Ming Qian [Thu, 24 Feb 2022 03:10:05 +0000 (11:10 +0800)]
media: amphion: add v4l2 m2m vpu encoder stateful driver

This consists of video encoder implementation plus encoder controls.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add vpu v4l2 m2m support
Ming Qian [Thu, 24 Feb 2022 03:10:04 +0000 (11:10 +0800)]
media: amphion: add vpu v4l2 m2m support

vpu_v4l2.c implements the v4l2 m2m driver methods.
vpu_helpers.c implements the common helper functions
vpu_color.c converts the v4l2 colorspace with
the VUI parameters that specified by ITU-T | ISO/IEC

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: implement vpu core communication based on mailbox
Ming Qian [Thu, 24 Feb 2022 03:10:03 +0000 (11:10 +0800)]
media: amphion: implement vpu core communication based on mailbox

driver use mailbox to communicate with vpu core.
and there are a command buffer and a message buffer.
driver will write commands to the command buffer,
then trigger a vpu core interrupt
vpu core will write messages to the message buffer,
then trigger a cpu interrupt.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add vpu core driver
Ming Qian [Thu, 24 Feb 2022 03:10:02 +0000 (11:10 +0800)]
media: amphion: add vpu core driver

The vpu supports encoder and decoder.
it needs vpu core to handle it.
core will run either encoder or decoder firmware.

This driver is for support the vpu core.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: amphion: add amphion vpu device driver
Ming Qian [Thu, 24 Feb 2022 03:10:01 +0000 (11:10 +0800)]
media: amphion: add amphion vpu device driver

The amphion vpu codec ip contains encoder and decoder.
Windsor is the encoder, it supports to encode H.264.
Malone is the decoder, it features a powerful
video processing unit able to decode many formats,
such as H.264, HEVC, and other formats.

This Driver is for this IP that is based on the v4l2 mem2mem framework.

Supported SoCs are: IMX8QXP, IMX8QM

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: add nv12m_8l128 and nv12m_10be_8l128 video format.
Ming Qian [Thu, 24 Feb 2022 03:10:00 +0000 (11:10 +0800)]
media: add nv12m_8l128 and nv12m_10be_8l128 video format.

nv12m_8l128 is 8-bit tiled nv12 format used by amphion decoder.
nv12m_10be_8l128 is 10-bit tiled format used by amphion decoder.
The tile size is 8x128

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agodt-bindings: media: amphion: add amphion video codec bindings
Ming Qian [Thu, 24 Feb 2022 03:09:59 +0000 (11:09 +0800)]
dt-bindings: media: amphion: add amphion video codec bindings

Add devicetree binding documentation for amphion
Video Processing Unit IP presents on NXP i.MX8Q

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agoMerge tag 'for-5.18-2.6-signed' of git://linuxtv.org/sailus/media_tree into media_stage
Mauro Carvalho Chehab [Mon, 7 Mar 2022 15:43:02 +0000 (16:43 +0100)]
Merge tag 'for-5.18-2.6-signed' of git://linuxtv.org/sailus/media_tree into media_stage

Even yet more V4L2 patches for 5.18

* tag 'for-5.18-2.6-signed' of git://linuxtv.org/sailus/media_tree:
  media: i2c: Fix pixel array positions in ov8865
  media: adv7183: Convert to GPIO descriptors
  media: m5mols: Convert to use GPIO descriptors
  media: noon010p30: Convert to use GPIO descriptors
  media: mt9m111: Drop unused include
  media: adv7511: Drop unused include
  media: i2c: isl7998x: Add driver for Intersil ISL7998x
  media: dt-bindings: Add Intersil ISL79987 DT bindings
  media: media-entity: Clarify media_entity_cleanup() usage
  media: i2c: imx274: Drop surplus includes
  media: i2c: ccs: Drop unused include
  v4l: fwnode: Remove now-redundant loop from v4l2_fwnode_parse_reference()
  v4l: fwnode: Drop redunant -ENODATA check in property reference parsing
  media: media-entity: Simplify media_pipeline_start()
  media: media-entity: Add media_pad_is_streaming() helper function
  media: Add a driver for the og01a1b camera sensor
  media: i2c: ov5648: Fix lockdep error
  media: ov5640: Fix set format, v4l2_mbus_pixelcode not updated

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: gpio-ir-tx: fix transmit with long spaces on Orange Pi PC
Sean Young [Sun, 20 Feb 2022 14:28:24 +0000 (15:28 +0100)]
media: gpio-ir-tx: fix transmit with long spaces on Orange Pi PC

Calling udelay for than 1000us does not always yield the correct
results.

Cc: stable@vger.kernel.org
Reported-by: Михаил <vrserver1@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: lirc: remove unused feature LIRC_CAN_SET_REC_DUTY_CYCLE
Sean Young [Wed, 9 Feb 2022 16:03:12 +0000 (17:03 +0100)]
media: lirc: remove unused feature LIRC_CAN_SET_REC_DUTY_CYCLE

There is no hardware which can filter input on the duty cycle, so no
driver implements this. On top of that, LIRC_CAN_SET_REC_DUTY_CYCLE
has the same value as LIRC_CAN_MEASURE_CARRIER (0x02000000).

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agoMerge tag 'br-v5.18q' of git://linuxtv.org/hverkuil/media_tree into media_stage
Mauro Carvalho Chehab [Mon, 7 Mar 2022 15:26:54 +0000 (16:26 +0100)]
Merge tag 'br-v5.18q' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

* tag 'br-v5.18q' of git://linuxtv.org/hverkuil/media_tree:
  media: cec: seco: Drop pointless include
  media: hantro: sunxi: Fix VP9 steps
  media: imx: csis: Store pads format separately
  doc: media: Document VP9 reference_mode miss-placement
  doc: media: Document MM21 tiled format
  media: imx: imx8mq-mipi-csi2: Remove YUV422 2X8
  media: v4l2-core: Initialize h264 scaling matrix
  media: imx: imx-mipi-csis: Add output format
  media: imx: imx-mipi-csis: Add BGR888
  media: imx: imx-mipi-csis: Add RGB565_1X16
  media: imx: imx-mipi-csis: Set PIXEL_MODE for YUV422
  media: imx: imx7-media-csi: Use dual sampling for YUV 1X16
  media: imx: Rename imx7-mipi-csis.c to imx-mipi-csis.c
  media: imx: De-stage imx7-mipi-csis

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agoMerge tag 'br-v5.18l' of git://linuxtv.org/hverkuil/media_tree into media_stage
Mauro Carvalho Chehab [Mon, 7 Mar 2022 15:24:56 +0000 (16:24 +0100)]
Merge tag 'br-v5.18l' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

* tag 'br-v5.18l' of git://linuxtv.org/hverkuil/media_tree: (39 commits)
  media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos
  media: meson-ir-tx: remove incorrect doc comment
  media: vivid: use time_is_after_jiffies() instead of open coding it
  media: wl128x: use time_is_before_jiffies() instead of open coding it
  media: tda8083: use time_is_after_jiffies() instead of open coding it
  media: stv0299: use time_is_before_jiffies() instead of open coding it
  media: si21xx: use time_is_before_jiffies() instead of open coding it
  media: cedrus: h264: Fix neighbour info buffer size
  media: cx88-mpeg: clear interrupt status register before streaming video
  media: cedrus: H265: Fix neighbour info buffer size
  media: fsl-viu: use GFP_KERNEL
  media: cx18: use GFP_KERNEL
  drivers: meson: vdec: add VP9 support to GXM
  stkwebcam: add new Asus laptop to upside_down table
  media: imx-jpeg: fix a bug of accessing array out of bounds
  media: sun6i-csi: fix colorspace in sun6i_video_try_fmt()
  media: usb: go7007: s2250-board: fix leak in probe()
  media: cedrus: Add watchdog for job completion
  pixfmt-yuv-planar.rst: fix typo: 'Cr, Cr' -> 'Cr, Cb'
  media: imx-jpeg: Remove unnecessary print function dev_err()
  ...

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: tegra-vde: De-stage driver
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:21 +0000 (21:46 +0100)]
media: staging: tegra-vde: De-stage driver

The TODO of tegra-vde driver has been completed, driver now supports
V4L2 stateless video decoding API. Relocate driver to drivers/media.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: tegra-vde: Bump BSEV DMA timeout
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:20 +0000 (21:46 +0100)]
media: staging: tegra-vde: Bump BSEV DMA timeout

BSEV DMA timeouts if VDE is downclocked by x10. Bump the timeout to allow
DMA to complete. We don't support freq scaling yet, this is just a minor
improvement which may become useful sometime later.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: tegra-vde: Remove legacy UAPI support
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:19 +0000 (21:46 +0100)]
media: staging: tegra-vde: Remove legacy UAPI support

The legacy UAPI became unnecessary with the V4L stateless decoder API
support addition to the Tegra decoder driver. Remove legacy UAPI support.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: tegra-vde: Support V4L stateless video decoder API
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:18 +0000 (21:46 +0100)]
media: staging: tegra-vde: Support V4L stateless video decoder API

Expose Tegra video decoder as a generic V4L M2M stateless video decoder.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: tegra-vde: Factor out H.264 code
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:17 +0000 (21:46 +0100)]
media: staging: tegra-vde: Factor out H.264 code

Factor out H.264 hardware programming code into separate source file in a
preparation to support V4L API by the Tegra video decoder driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags
Dmitry Osipenko [Sun, 20 Feb 2022 20:46:16 +0000 (21:46 +0100)]
media: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags

Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags that are needed by
NVIDIA Tegra video decoder. Userspace will have to set these flags in
accordance to the type of a decoded frame.

Reviewed-by: Nicolas Dufresne <nicolas@collabora.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: doc: pixfmt-rgb: Fix V4L2_PIX_FMT_BGR24 format description
Laurent Pinchart [Tue, 15 Feb 2022 11:20:32 +0000 (12:20 +0100)]
media: doc: pixfmt-rgb: Fix V4L2_PIX_FMT_BGR24 format description

The V4L2_PIX_FMT_BGR24 format is incorrectly described, with the B and G
components swapped. Fix it.

Fixes: 2ac9280cb459 ("media: doc: pixfmt-rgb: Make 8 bits per component table more compact")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: imx: imx8mq-mipi_csi2: Remove unneeded code
Muhammad Usama Anjum [Fri, 28 Jan 2022 17:07:22 +0000 (18:07 +0100)]
media: imx: imx8mq-mipi_csi2: Remove unneeded code

ret is constant in imx8mq_mipi_csi_pm_suspend(). This function cannot
return error. Remove the return variable. Simplify other functions which
are using this function.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dvb_frontends: make static read-only array fec_tab const
Colin Ian King [Sun, 23 Jan 2022 23:02:42 +0000 (00:02 +0100)]
media: dvb_frontends: make static read-only array fec_tab const

The static array fec_tab is read-only so it make sense to make
it const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dib7000p: make static read-only arrays notch and sine const
Colin Ian King [Sun, 23 Jan 2022 22:56:27 +0000 (23:56 +0100)]
media: dib7000p: make static read-only arrays notch and sine const

The static arrays notch and sine are read-only so it make sense
to make them const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dvb_frontend: make static read-only array DIB3000MC_I2C_ADDRESS const
Colin Ian King [Sun, 23 Jan 2022 22:52:56 +0000 (23:52 +0100)]
media: dvb_frontend: make static read-only array DIB3000MC_I2C_ADDRESS const

The static array DIB3000MC_I2C_ADDRESS is read-only so it make sense
to make it const. Also add spaces to clean up checkpatch warnings.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: renesas,csi2: Update data-lanes property
Lad Prabhakar [Fri, 21 Jan 2022 00:26:22 +0000 (01:26 +0100)]
media: dt-bindings: media: renesas,csi2: Update data-lanes property

CSI-2 (CSI4LNK0) on R-Car and RZ/G2 supports 4-lane mode which is already
handled by rcar-csi2.c driver. This patch updates the data-lanes property
to describe the same.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: Remove usage of the deprecated "pci-dma-compat.h" API
Christophe JAILLET [Thu, 6 Jan 2022 21:50:07 +0000 (22:50 +0100)]
media: Remove usage of the deprecated "pci-dma-compat.h" API

In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.

Some reasons why this API should be removed have been given by Julia
Lawall in [2].

A coccinelle script has been used to perform the needed transformation.
It can be found in [3].

[1]: https://lore.kernel.org/kernel-janitors/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/20200716192821.321233-1-christophe.jaillet@wanadoo.fr/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Remove duplicated include in mtk_vcodec_enc_drv.c
Yang Li [Tue, 25 Jan 2022 00:28:39 +0000 (01:28 +0100)]
media: mtk-vcodec: Remove duplicated include in mtk_vcodec_enc_drv.c

Fix following includecheck warning:
./drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c:
linux/pm_runtime.h is included more than once.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: hdpvr: initialize dev->worker at hdpvr_register_videodev
Dongliang Mu [Fri, 18 Feb 2022 09:41:30 +0000 (10:41 +0100)]
media: hdpvr: initialize dev->worker at hdpvr_register_videodev

hdpvr_register_videodev is responsible to initialize a worker in
hdpvr_device. However, the worker is only initialized at
hdpvr_start_streaming other than hdpvr_register_videodev.
When hdpvr_probe does not initialize its worker, the hdpvr_disconnect
will encounter one WARN in flush_work.The stack trace is as follows:

 hdpvr_disconnect+0xb8/0xf2 drivers/media/usb/hdpvr/hdpvr-core.c:425
 usb_unbind_interface+0xbf/0x3a0 drivers/usb/core/driver.c:458
 __device_release_driver drivers/base/dd.c:1206 [inline]
 device_release_driver_internal+0x22a/0x230 drivers/base/dd.c:1237
 bus_remove_device+0x108/0x160 drivers/base/bus.c:529
 device_del+0x1fe/0x510 drivers/base/core.c:3592
 usb_disable_device+0xd1/0x1d0 drivers/usb/core/message.c:1419
 usb_disconnect+0x109/0x330 drivers/usb/core/hub.c:2228

Fix this by moving the initialization of dev->worker to the starting of
hdpvr_register_videodev

Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Point sm8250 at the correct vdda regulators
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:12 +0000 (13:52 +0100)]
media: camss: Point sm8250 at the correct vdda regulators

Reviewing the RB5 schematic its clear that we have missed out on defining
both of the power-rails associated with the CSI PHY.

Other PHYs such as the UFS, PCIe and USB connect to these rails and define
each regulator individually.

This means if we were to switch off the other various PHYs which enable
these rails, the CAMSS would not appropriately power-on the CSI PHY.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Point sdm845 at the correct vdda regulators
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:11 +0000 (13:52 +0100)]
media: camss: Point sdm845 at the correct vdda regulators

Reviewing the RB3 schematic its clear that we have missed out on defining
one of the power-rails associated with the CSI PHY.

Other PHYs such as the UFS, PCIe and USB connect to these rails and define
each regulator individually.

This means if we were to switch off the other various PHYs which enable
these rails, the CAMSS would not appropriately power-on the CSI PHY.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Set unused regulators to the empty set
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:10 +0000 (13:52 +0100)]
media: camss: Set unused regulators to the empty set

If a CAMSS block has no regulator set the regulator array to the empty set
as opposed to setting the first element of the array to NULL.

Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Add regulator_bulk support
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:09 +0000 (13:52 +0100)]
media: camss: Add regulator_bulk support

Add the ability to enable or disable multiple regulators in bulk with
camss. This is useful for sm8250, sdm845 and it looks like sdm660 where we
have more than one CSI regulator to do at once.

It should just work for standalone existing vdda regulators and parts which
don't have an explicitly defined CSI regulator.

[hverkuil: fix camss-csid.c:163:13: warning: 'ret' may be used uninitialized in this function]

Reported-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: camss: Add vdda supply declarations sm8250
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:06 +0000 (13:52 +0100)]
media: dt-bindings: media: camss: Add vdda supply declarations sm8250

Add in missing vdda-phy-supply and vdda-pll-supply declarations. The
sm8250 USB, PCIe, UFS, DSI and CSI PHYs use a common set of vdda rails.
Define the CSI vdda regulators in the same way the qmp PHY does.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: camss: Fixup vdda regulator descriptions sdm845
Bryan O'Donoghue [Tue, 11 Jan 2022 12:52:05 +0000 (13:52 +0100)]
media: dt-bindings: media: camss: Fixup vdda regulator descriptions sdm845

If we review the schematic for RB3 Thundercomm document Turbox-845 we see
that the CAMSS CSI PHY has the same basic power-rail layout as UFS, PCIe
and USB PHYs.

We should therefore have two regulator declarations as is the case for UFS,
PCIe and USB.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: davinci: vpif: Use platform_get_irq_optional() to get the interrupt
Lad Prabhakar [Thu, 13 Jan 2022 10:44:15 +0000 (11:44 +0100)]
media: davinci: vpif: Use platform_get_irq_optional() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq_optional().

While at it, propagate error code in case devm_request_irq() fails
instead of returning -EINVAL.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: vidtv: Check for null return of vzalloc
Jiasheng Jiang [Fri, 14 Jan 2022 06:28:40 +0000 (07:28 +0100)]
media: vidtv: Check for null return of vzalloc

As the possible failure of the vzalloc(), e->encoder_buf might be NULL.
Therefore, it should be better to check it in order
to guarantee the success of the initialization.
If fails, we need to free not only 'e' but also 'e->name'.
Also, if the allocation for ctx fails, we need to free 'e->encoder_buf'
else.

Fixes: f90cf6079bf6 ("media: vidtv: add a bridge driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-mdp: Remove redundant 'flush_workqueue()' calls
Xu Wang [Fri, 14 Jan 2022 08:22:14 +0000 (09:22 +0100)]
media: mtk-mdp: Remove redundant 'flush_workqueue()' calls

'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: videobuf2-dma-contig: Invalidate vmap range before DMA range
Sergey Senozhatsky [Wed, 19 Jan 2022 08:14:17 +0000 (09:14 +0100)]
media: videobuf2-dma-contig: Invalidate vmap range before DMA range

Christoph suggests [1] that invalidating vmap range before
direct mapping range makes more sense.

[1]: https://lore.kernel.org/all/20220111085958.GA22795@lst.de/

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: stk1160: use dma_alloc_noncontiguous API
Dafna Hirschfeld [Tue, 25 Jan 2022 08:02:13 +0000 (09:02 +0100)]
media: stk1160: use dma_alloc_noncontiguous API

Replace the urb buffers allocation to use the noncontiguous API.

This improves performance on ARM platforms where DMA coherent allocations
produce uncached mappings. Note that the noncontiguous API
requires the driver to handle synchronization.

This commit is similar to this one for the uvc driver:

  https://lkml.org/lkml/2021/3/12/1506

Performance tests on rock-pi4 (Arm64) shows about 15x
improvements:

== DMA NONCONTIGUOUS ==
total durations: 20.63678480 sec
urb processing durations: 0.286864889 sec
uS/qty: 286864/2508 avg: 114.379 min: 0.583 max: 155.461 (uS)
FPS: 24.92
lost: 0 done: 500
raw decode speed: 11.603 Gbits/s
bytes 414831228.000
bytes/urb: 165403

== DMA COHERENT ==
total durations: 20.73551767 sec
urb processing durations: 4.541559160 sec
uS/qty: 4541559/2509 avg: 1810.107 min: 0.583 max: 2113.163 (uS)
FPS: 24.90
lost: 0 done: 500
raw decode speed: 730.738 Mbits/s
bytes 414785444.000
bytes/urb: 165319

Performance tests on x86 laptop show no significant
difference:

== DMA NONCONTIGUOUS ==
total durations: 20.220590102 sec
urb processing durations: 0.63021818 sec
uS/qty: 63021/2512 avg: 25.088 min: 0.138 max: 146.750 (uS)
FPS: 24.72
lost: 0 done: 500
raw decode speed: 52.751 Gbits/s
bytes 415421032.000
bytes/urb: 165374

== DMA COHERENT ==
total durations: 20.220475614 sec
urb processing durations: 0.64751972 sec
uS/qty: 64751/2512 avg: 25.777 min: 0.168 max: 132.250 (uS)
FPS: 24.72
lost: 0 done: 500
raw decode speed: 51.927 Gbits/s
bytes 415422794.000
bytes/urb: 165375

[hverkuil: incorporated Ezequiel's suggestions from his review]

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: stk1160: move transfer_buffer and urb to same struct 'stk1160_urb'
Dafna Hirschfeld [Tue, 25 Jan 2022 08:02:12 +0000 (09:02 +0100)]
media: stk1160: move transfer_buffer and urb to same struct 'stk1160_urb'

Instead of having two separated arrays, one for the urbs and
one for their buffers, have one array of a struct containing both.
In addition, the array is just 16 pointers, no need to dynamically
allocate it.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: stk1160: If start stream fails, return buffers with VB2_BUF_STATE_QUEUED
Dafna Hirschfeld [Tue, 25 Jan 2022 08:02:11 +0000 (09:02 +0100)]
media: stk1160: If start stream fails, return buffers with VB2_BUF_STATE_QUEUED

If the callback 'start_streaming' fails, then all
queued buffers in the driver should be returned with
state 'VB2_BUF_STATE_QUEUED'. Currently, they are
returned with 'VB2_BUF_STATE_ERROR' which is wrong.
Fix this. This also fixes the warning:

[   65.583633] WARNING: CPU: 5 PID: 593 at drivers/media/common/videobuf2/videobuf2-core.c:1612 vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.585027] Modules linked in: snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_soc_hdmi_codec dw_hdmi_i2s_audio saa7115 stk1160 videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc crct10dif_ce panfrost snd_soc_simple_card snd_soc_audio_graph_card snd_soc_spdif_tx snd_soc_simple_card_utils gpu_sched phy_rockchip_pcie snd_soc_rockchip_i2s rockchipdrm analogix_dp dw_mipi_dsi dw_hdmi cec drm_kms_helper drm rtc_rk808 rockchip_saradc industrialio_triggered_buffer kfifo_buf rockchip_thermal pcie_rockchip_host ip_tables x_tables ipv6
[   65.589383] CPU: 5 PID: 593 Comm: v4l2src0:src Tainted: G        W         5.16.0-rc4-62408-g32447129cb30-dirty #14
[   65.590293] Hardware name: Radxa ROCK Pi 4B (DT)
[   65.590696] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   65.591304] pc : vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.591850] lr : vb2_start_streaming+0x6c/0x160 [videobuf2_common]
[   65.592395] sp : ffff800012bc3ad0
[   65.592685] x29: ffff800012bc3ad0 x28: 0000000000000000 x27: ffff800012bc3cd8
[   65.593312] x26: 0000000000000000 x25: ffff00000d8a7800 x24: 0000000040045612
[   65.593938] x23: ffff800011323000 x22: ffff800012bc3cd8 x21: ffff00000908a8b0
[   65.594562] x20: ffff00000908a8c8 x19: 00000000fffffff4 x18: ffffffffffffffff
[   65.595188] x17: 000000040044ffff x16: 00400034b5503510 x15: ffff800011323f78
[   65.595813] x14: ffff000013163886 x13: ffff000013163885 x12: 00000000000002ce
[   65.596439] x11: 0000000000000028 x10: 0000000000000001 x9 : 0000000000000228
[   65.597064] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff726c5e78
[   65.597690] x5 : ffff800012bc3990 x4 : 0000000000000000 x3 : ffff000009a34880
[   65.598315] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000007cd99f0
[   65.598940] Call trace:
[   65.599155]  vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.599672]  vb2_core_streamon+0x17c/0x1a8 [videobuf2_common]
[   65.600179]  vb2_streamon+0x54/0x88 [videobuf2_v4l2]
[   65.600619]  vb2_ioctl_streamon+0x54/0x60 [videobuf2_v4l2]
[   65.601103]  v4l_streamon+0x3c/0x50 [videodev]
[   65.601521]  __video_do_ioctl+0x1a4/0x428 [videodev]
[   65.601977]  video_usercopy+0x320/0x828 [videodev]
[   65.602419]  video_ioctl2+0x3c/0x58 [videodev]
[   65.602830]  v4l2_ioctl+0x60/0x90 [videodev]
[   65.603227]  __arm64_sys_ioctl+0xa8/0xe0
[   65.603576]  invoke_syscall+0x54/0x118
[   65.603911]  el0_svc_common.constprop.3+0x84/0x100
[   65.604332]  do_el0_svc+0x34/0xa0
[   65.604625]  el0_svc+0x1c/0x50
[   65.604897]  el0t_64_sync_handler+0x88/0xb0
[   65.605264]  el0t_64_sync+0x16c/0x170
[   65.605587] ---[ end trace 578e0ba07742170d ]---

Fixes: 8ac456495a33d ("[media] stk1160: Stop device and unqueue buffers when start_streaming() fails")
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: stk1160: fix number of buffers in case not all buffers are created
Dafna Hirschfeld [Tue, 25 Jan 2022 08:02:10 +0000 (09:02 +0100)]
media: stk1160: fix number of buffers in case not all buffers are created

In case we fail to allocate a transfer_buffer then we
break the buffers creation loop and update the number of
buffers to the number of successfully allocated which should
be 'i' and not 'i - 1' nor 'i + 1'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: hantro: Add support for i.MX8MM Hantro-G1
Adam Ford [Tue, 25 Jan 2022 17:11:27 +0000 (18:11 +0100)]
media: hantro: Add support for i.MX8MM Hantro-G1

The i.MX8MM has a Hantro G1 video decoder similar to the
imx8mq but lacks the post-processor present in the imx8mq.
Add support in the driver for it with the post-processing
removed.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: nxp, imx8mq-vpu: Add support for G1 on imx8mm
Adam Ford [Tue, 25 Jan 2022 17:11:26 +0000 (18:11 +0100)]
media: dt-bindings: media: nxp, imx8mq-vpu: Add support for G1 on imx8mm

The i.MX8M mini appears to have a similar G1 decoder but the
post-processing isn't present, so different compatible flag is required.
Since all the other parameters are the same with imx8mq, just add
the new compatible flag to nxp,imx8mq-vpu.yaml.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: hantro: Allow i.MX8MQ G1 and G2 to run independently
Adam Ford [Tue, 25 Jan 2022 17:11:23 +0000 (18:11 +0100)]
media: hantro: Allow i.MX8MQ G1 and G2 to run independently

The VPU in the i.MX8MQ is really the combination of Hantro G1 and
Hantro G2. With the updated vpu-blk-ctrl, the power domains system
can enable and disable them separately as well as pull them out of
reset. This simplifies the code and lets them run independently
while still retaining backwards compatibility with older device
trees for those using G1.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: nxp, imx8mq-vpu: Split G1 and G2 nodes
Adam Ford [Tue, 25 Jan 2022 17:11:22 +0000 (18:11 +0100)]
media: dt-bindings: media: nxp, imx8mq-vpu: Split G1 and G2 nodes

The G1 and G2 are independent and separate decoder blocks
that are enabled by the vpu-blk-ctrl power-domain controller,
which now has a proper driver.

Because these blocks only share the power-domain, and can be
independently fused out, update the bindings to support separate
nodes for the G1 and G2 decoders with vpu-blk-ctrl power-domain
support.

The new DT + old kernel isn't a supported configuration.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: cec: seco: add newlines in debug messages
Ettore Chimenti [Tue, 15 Feb 2022 18:13:13 +0000 (19:13 +0100)]
media: cec: seco: add newlines in debug messages

Newlines were missing in almost all regular and debug printk.

Signed-off-by: Ettore Chimenti <ek5.chimenti@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: Revert "media: em28xx: add missing em28xx_close_extension"
Pavel Skripkin [Thu, 20 Jan 2022 19:37:30 +0000 (20:37 +0100)]
media: Revert "media: em28xx: add missing em28xx_close_extension"

This reverts commit 2c98b8a3458df03abdc6945bbef67ef91d181938.

Reverted patch causes problems with Hauppauge WinTV dualHD as Maximilian
reported [1]. Since quick solution didn't come up let's just revert it
to make this device work with upstream kernels.

Link: https://lore.kernel.org/all/6a72a37b-e972-187d-0322-16336e12bdc5@elbmurf.de/
Reported-by: Maximilian Böhm <maximilian.boehm@elbmurf.de>
Tested-by: Maximilian Böhm <maximilian.boehm@elbmurf.de>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: venus: hfi_cmds: List HDR10 property as unsupported for v1 and v3
Stanimir Varbanov [Tue, 1 Feb 2022 15:51:29 +0000 (16:51 +0100)]
media: venus: hfi_cmds: List HDR10 property as unsupported for v1 and v3

The HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI HFI property is not supported
on Venus v1 and v3.

cc: stable@vger.kernel.org # 5.13+
Fixes: 9172652d72f8 ("media: venus: venc: Add support for CLL and Mastering display controls")
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: venus: venc: Fix h264 8x8 transform control
Stanimir Varbanov [Tue, 8 Feb 2022 01:18:16 +0000 (02:18 +0100)]
media: venus: venc: Fix h264 8x8 transform control

During encoder driver open controls are initialized via a call
to v4l2_ctrl_handler_setup which returns EINVAL error for
V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM v4l2 control. The control
default value is disabled and because of firmware limitations
8x8 transform cannot be disabled for the supported HIGH and
CONSTRAINED_HIGH profiles.

To fix the issue change the control default value to enabled
(this is fine because the firmware enables 8x8 transform for
high and constrained_high profiles by default). Also, correct
the checking of profile ids in s_ctrl from hfi to v4l2 ids.

cc: stable@vger.kernel.org # 5.15+
Fixes: bfee75f73c37 ("media: venus: venc: add support for V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM control")
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: venus: vdec: fixed possible memory leak issue
Ameer Hamza [Mon, 6 Dec 2021 10:43:15 +0000 (11:43 +0100)]
media: venus: vdec: fixed possible memory leak issue

The venus_helper_alloc_dpb_bufs() implementation allows an early return
on an error path when checking the id from ida_alloc_min() which would
not release the earlier buffer allocation.

Move the direct kfree() from the error checking of dma_alloc_attrs() to
the common fail path to ensure that allocations are released on all
error paths in this function.

Addresses-Coverity: 1494120 ("Resource leak")

cc: stable@vger.kernel.org # 5.16+
Fixes: 40d87aafee29 ("media: venus: vdec: decoded picture buffer handling during reconfig sequence")
Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: venus: core: Fix kerneldoc warnings
Stanimir Varbanov [Wed, 24 Nov 2021 22:25:12 +0000 (23:25 +0100)]
media: venus: core: Fix kerneldoc warnings

Describe missing structure members:

core.h: warning: Function parameter or member
'sys_err_done' not described in 'venus_core'
'fw_min_cnt' not described in 'venus_inst'
'flags' not described in 'venus_inst'
'dpb_ids' not described in 'venus_inst'

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: i2c: Fix pixel array positions in ov8865
Daniel Scally [Wed, 2 Mar 2022 22:24:48 +0000 (22:24 +0000)]
media: i2c: Fix pixel array positions in ov8865

The ov8865's datasheet gives the pixel array as 3296x2528, and the
active portion as the centre 3264x2448. This makes for a top offset
of 40 and a left offset of 16, not 32 and 80.

Fixes: acd25e220921 ("media: i2c: Add .get_selection() support to ov8865")

Reported-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: adv7183: Convert to GPIO descriptors
Linus Walleij [Wed, 23 Feb 2022 00:34:16 +0000 (01:34 +0100)]
media: adv7183: Convert to GPIO descriptors

This driver is using two GPIO numbers passed as platform data.

No board file in the kernel defines this however, so we can
just change the mechanism without side effects.

Let's just switch it to use GPIO descriptors and add some
comments on how to provide these.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: m5mols: Convert to use GPIO descriptors
Linus Walleij [Thu, 24 Feb 2022 00:13:07 +0000 (01:13 +0100)]
media: m5mols: Convert to use GPIO descriptors

The Fujitsu M5MOLS sensor driver is using a reset GPIO number
passed from platform data.

No machine/board descriptor file in the kernel is using this so
let's replace it with a GPIO descriptor.

Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Heungjun Kim <riverful.kim@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: noon010p30: Convert to use GPIO descriptors
Linus Walleij [Thu, 24 Feb 2022 00:11:29 +0000 (01:11 +0100)]
media: noon010p30: Convert to use GPIO descriptors

The noon010pc30 sensor driver is using legacy gpio numbers passed
through platform data and open coding reverse polarity on the
GPIOs used for reset and standby.

Nothing in the kernel defines any platform data for this driver
so we can just convert the driver to use GPIO descriptors and
requires that these specify the correct polarity instead.

Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: mt9m111: Drop unused include
Linus Walleij [Wed, 23 Feb 2022 23:50:11 +0000 (00:50 +0100)]
media: mt9m111: Drop unused include

This driver includes <linux/gpio.h> but does not use any
symbols from this file. Drop the include.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: adv7511: Drop unused include
Linus Walleij [Wed, 23 Feb 2022 17:28:16 +0000 (18:28 +0100)]
media: adv7511: Drop unused include

The adv7511 driver includes the legacy GPIO header <linux/gpio.h>
yet fails to use any symbols from it.

Drop the include.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: i2c: isl7998x: Add driver for Intersil ISL7998x
Marek Vasut [Thu, 17 Feb 2022 15:44:07 +0000 (16:44 +0100)]
media: i2c: isl7998x: Add driver for Intersil ISL7998x

Add driver for the Intersil ISL7998x Analog to MIPI CSI-2/BT656 decoder.
This chip supports 1/2/4 analog video inputs and converts them into
1/2/4 VCs in MIPI CSI2 stream.

This driver currently supports ISL79987 and both 720x480 and 720x576
resolutions, however as per specification, all inputs must use the
same resolution and standard. The only supported pixel format is now
YUYV/YUV422. The chip should support RGB565 on the CSI2 as well, but
this is currently unsupported.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
To: linux-media@vger.kernel.org
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[Sakari Ailus: Always call pm_runtime_get_and_resume in pre_streamon]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: dt-bindings: Add Intersil ISL79987 DT bindings
Marek Vasut [Thu, 17 Feb 2022 15:44:06 +0000 (16:44 +0100)]
media: dt-bindings: Add Intersil ISL79987 DT bindings

Add bindings for the Intersil ISL79987 analog to MIPI CSI-2 decoder.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
To: linux-media@vger.kernel.org
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: media-entity: Clarify media_entity_cleanup() usage
Laurent Pinchart [Thu, 24 Feb 2022 12:57:47 +0000 (14:57 +0200)]
media: media-entity: Clarify media_entity_cleanup() usage

Being able to call cleanup functions on objects that haven't been
initialized but whose memory has been zeroed simplifies error handling.
The media_entity_cleanup() function documentation doesn't tell whether
this is allowed or not, and inspection of its implementation doesn't
provide any clue as the function is currently empty. Update the
documentation to explicitly allow this usage pattern.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: i2c: imx274: Drop surplus includes
Linus Walleij [Wed, 23 Feb 2022 17:33:43 +0000 (18:33 +0100)]
media: i2c: imx274: Drop surplus includes

The driver already includes <linux/gpio/consumer.h> which is what
it uses, drop the legacy <linux/gpio.h> and <linux/of_gpio.h>
includes.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: i2c: ccs: Drop unused include
Linus Walleij [Wed, 23 Feb 2022 17:31:17 +0000 (18:31 +0100)]
media: i2c: ccs: Drop unused include

The driver already includes <linux/gpio/consumer.h> which is what
it uses, drop the legacy <linux/gpio.h> include.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agov4l: fwnode: Remove now-redundant loop from v4l2_fwnode_parse_reference()
Sakari Ailus [Fri, 28 Jan 2022 22:26:07 +0000 (00:26 +0200)]
v4l: fwnode: Remove now-redundant loop from v4l2_fwnode_parse_reference()

v4l2_fwnode_parse_reference() relied on counting the number of references
for async array memory allocation. The array is long gone so remove
counting the references now.

This also changes how the function arrives in different unsuccessful
return values but the functionality remains unchanged.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2 years agov4l: fwnode: Drop redunant -ENODATA check in property reference parsing
Sakari Ailus [Wed, 23 Feb 2022 11:47:48 +0000 (13:47 +0200)]
v4l: fwnode: Drop redunant -ENODATA check in property reference parsing

The check of -ENODATA return value from
fwnode_property_get_reference_args() was made redundant by commit
c343bc2ce2c6 ("ACPI: properties: Align return codes of
__acpi_node_get_property_reference()"). -ENOENT remains to be used to
signal there are no further entries.

Remove the check for -ENODATA.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2 years agomedia: media-entity: Simplify media_pipeline_start()
Laurent Pinchart [Thu, 13 Jan 2022 15:00:42 +0000 (17:00 +0200)]
media: media-entity: Simplify media_pipeline_start()

The media_pipeline_start() function has two purposes: it constructs a
pipeline by recording the entities that are part of it, gathered from a
graph walk, and validate the media links. The pipeline pointer is stored
in the media_entity structure as part of this process, and the entity's
stream count is increased, to record that the entity is streaming.

When multiple video nodes are present in a pipeline,
media_pipeline_start() is typically called on all of them, with the same
pipeline pointer. This is taken into account in media_pipeline_start()
by skipping validation for entities that are already part of the
pipeline, while returning an error if an entity is part of a different
pipeline.

It turns out that this process is overly complicated. When
media_pipeline_start() is called for the first time, it constructs the
full pipeline, adding all entities and validating all the links.
Subsequent calls to media_pipeline_start() are then nearly no-ops, they
only increase the stream count on the pipeline and on all entities.

The media_entity stream_count field is used for two purposes: checking
if the entity is streaming, and detecting when a call to
media_pipeline_stop() balances needs to reset the entity pipe pointer to
NULL. The former can easily be replaced by a check of the pipe pointer.

Simplify media_pipeline_start() by avoiding the pipeline walk on all
calls but the first one, and drop the media_entity stream_count field.
media_pipeline_stop() is updated accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Sakari Ailus: Drop redundant '!= NULL' as discussed]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: media-entity: Add media_pad_is_streaming() helper function
Laurent Pinchart [Thu, 13 Jan 2022 15:00:41 +0000 (17:00 +0200)]
media: media-entity: Add media_pad_is_streaming() helper function

Add a function to test if a pad is part of a pipeline currently
streaming, and use it through drivers to replace direct access to the
stream_count field. This will help reworking pipeline start/stop without
disturbing drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: Add a driver for the og01a1b camera sensor
Shawn Tu [Tue, 15 Feb 2022 15:13:45 +0000 (23:13 +0800)]
media: Add a driver for the og01a1b camera sensor

Add a V4L2 sub-device driver for Omnivision og01a1b b&w
image sensor. This is a camera sensor using the I2C bus
for control and the CSI-2 bus for data.

This driver supports following features:
- manual exposure and analog/digital gain control support
- vblank/hblank control support
- test pattern support
- media controller support
- runtime PM support
- support following resolutions:
  + 1280x1024 at 120FPS

Signed-off-by: Shawn Tu <shawnx.tu@intel.com>
[Sakari Ailus: Update according to recent v4l2-async API changes]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: i2c: ov5648: Fix lockdep error
Hans de Goede [Thu, 3 Feb 2022 12:33:12 +0000 (13:33 +0100)]
media: i2c: ov5648: Fix lockdep error

ov5648_state_init() calls ov5648_state_mipi_configure() which uses
__v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which
is also sensor->ctrls.handler.lock) must be locked before calling
ov5648_state_init().

ov5648_state_mipi_configure() is also used in other places where
the lock is already held so it cannot be changed itself.

Note this is based on an identical (tested) fix for the ov8865 driver,
this has only been compile-tested.

Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: ov5640: Fix set format, v4l2_mbus_pixelcode not updated
Mirela Rabulea [Mon, 1 Nov 2021 19:52:51 +0000 (21:52 +0200)]
media: ov5640: Fix set format, v4l2_mbus_pixelcode not updated

In ov5640_set_fmt, pending_fmt_change will always be false, because the
sensor format is saved before comparing it with the previous format:
fmt = &sensor->fmt;...
*fmt = *mbus_fmt;...
if (mbus_fmt->code != sensor->fmt.code)
sensor->pending_fmt_change = true;
This causes the sensor to capture with the previous pixelcode.

Also, changes might happen even for V4L2_SUBDEV_FORMAT_TRY, so fix that.

Basically, revert back to the state before
commit 071154499193 ("media: ov5640: Fix set format regression")
as it was more clear, and then update format even when pixelcode does
not change, as resolution might change.

Fixes: 071154499193 ("media: ov5640: Fix set format regression")
Fixes: 6949d864776e ("media: ov5640: do not change mode if format or frame interval is unchanged")
Fixes: fb98e29ff1ea5 ("media: ov5640: fix mode change regression")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2 years agomedia: cec: seco: Drop pointless include
Linus Walleij [Tue, 22 Feb 2022 22:23:31 +0000 (23:23 +0100)]
media: cec: seco: Drop pointless include

This driver uses GPIO descriptors not the old legacy GPIO
API so stop including <linux/gpio.h>.

Fix a bug using a completely unrelated legacy API flag
GPIOF_IN by switching to the actually desired flag
GPIOD_IN.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: hantro: sunxi: Fix VP9 steps
Jernej Skrabec [Tue, 22 Feb 2022 18:03:28 +0000 (19:03 +0100)]
media: hantro: sunxi: Fix VP9 steps

It turns out that postproc on Allwinner H6 needs width and height to be
multiple of 32.

Fixes: 86790a4fdf4b ("media: hantro: Add support for Allwinner H6")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: csis: Store pads format separately
Jacopo Mondi [Tue, 22 Feb 2022 21:46:43 +0000 (22:46 +0100)]
media: imx: csis: Store pads format separately

As the formats on the sink and source pad might be different store
them separately.

The pad format is used to configure the image width and height in
mipi_csis_system_enable(). As the csis cannot downscale, using the sink
or the source one isn't relevant.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agodoc: media: Document VP9 reference_mode miss-placement
Nicolas Dufresne [Mon, 21 Feb 2022 19:37:27 +0000 (14:37 -0500)]
doc: media: Document VP9 reference_mode miss-placement

The reference_mode derived syntax is part of the compressed headers and
should have been moved into the corresponding control structure. Document
this mistake. The value can be set to 0 if the driver does not require
compressed headers information.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: fix small typo in comment]

2 years agodoc: media: Document MM21 tiled format
Nicolas Dufresne [Mon, 21 Feb 2022 19:12:01 +0000 (14:12 -0500)]
doc: media: Document MM21 tiled format

MM21 has been documented through two software implementation [0] in libyuv
and [2] GStreamer. This format is similar to other tiled format, though it
uses uneven tile sizes. The luma tiles are 16x32 while the chroma tile have
a subsampled size of 16x16. This is the uncompressed cousin of
V4L2_PIX_FMT_MT21C and shares its tiling pattern and alignment.

[0] https://chromium.googlesource.com/libyuv/libyuv/+/b4ddbaf549a1bf5572bf703fd2862d1eb7380c6a
[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/c9b127dae3af4b3fe78468e697cb491902425254

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx8mq-mipi-csi2: Remove YUV422 2X8
Jacopo Mondi [Mon, 21 Feb 2022 18:17:08 +0000 (19:17 +0100)]
media: imx: imx8mq-mipi-csi2: Remove YUV422 2X8

The 2X8 variants of MEDIA_BUS_FMT_YUYV8_2X8 does not apply to serial
busses.

Drop it and while at it also add the canonical UYVY wire format for
packed YUV422 when transmitted on the CSI-2 serial bus.

Also beautify a little the formats declaration list by putting the
opening curly brace after the comment.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: v4l2-core: Initialize h264 scaling matrix
Nicolas Dufresne [Fri, 18 Feb 2022 18:42:07 +0000 (13:42 -0500)]
media: v4l2-core: Initialize h264 scaling matrix

In the final H264 API, it is not required to set scaling matrix if
they are not present in the bitstream. A flag was added in order to let
the driver know. The downside is that it leaves the default control
value to 0, which isn't valid. As per the spec (see formulas 7-8/7-9),
when the scaling matrix are absent from the bitstream, flat values
of 16 should be used. This improves this control semantic in a way
that the control value are always valid. Drivers can then use
the scaling_matrix control values without having to check its presence.
Same method was employed for MPEG2_QUANTISATION.

This fixes issues with MTK VCODEC H264 decoder when using GStreamer.
GStreamer does not set this control if its not present in the bitstream.
As MTK VDCODEC was using the initialized to 0 values, the frames ended
up completely gray.

Fixes: 54889c51b833d236 ("media: uapi: h264: Rename and clarify PPS_FLAG_SCALING_MATRIX_PRESENT")
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx-mipi-csis: Add output format
Jacopo Mondi [Mon, 21 Feb 2022 17:47:27 +0000 (18:47 +0100)]
media: imx: imx-mipi-csis: Add output format

Due to how pixel components are transmitted on the CSI-2 serial bus
and how they are deserialized by the CSI-2 receiver, the component
ordering might change and the image formats on the sink and source pads
of the receiver should reflect it.

For RGB24, in example, the component ordering on the wire as described by
the CSI-2 specification matches the BGR888 format, while once
deserialized by the CSIS receiver it matches the RGB888 format.

Add an additional .output field to struct csis_pix_format to allow
propagating the correct format to the source pad after a format
configuration on the sink.

The change is only relevant for RGB24 but paves the way for further
format translations in future.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx-mipi-csis: Add BGR888
Jacopo Mondi [Mon, 21 Feb 2022 17:47:26 +0000 (18:47 +0100)]
media: imx: imx-mipi-csis: Add BGR888

Add support for the BGR888_1X24 image format.

No existing media bus codes describe exactly the way data is transferred
on the CSI-2 bus. This is not a new issue, the CSI-2 YUV422 8-bit format
is described by MEDIA_BUS_FMT_UYVY8_1X16 which is an arbitrary
convention and not an exact match. Use the MEDIA_BUS_FMT_BGR888_1X24 to
follow the same convention, based on the order in which bits are
transmitted over the CSI-2 bus.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx-mipi-csis: Add RGB565_1X16
Jacopo Mondi [Mon, 21 Feb 2022 17:47:25 +0000 (18:47 +0100)]
media: imx: imx-mipi-csis: Add RGB565_1X16

Add RGB565_1X16 to the enumeration of supported image formats.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx-mipi-csis: Set PIXEL_MODE for YUV422
Jacopo Mondi [Mon, 21 Feb 2022 17:47:24 +0000 (18:47 +0100)]
media: imx: imx-mipi-csis: Set PIXEL_MODE for YUV422

Bits 13 and 12 of the ISP_CONFIGn register configure the PIXEL_MODE
which specifies the sampling size, in pixel component units, on the
CSI-2 output data interface when data are transferred to memory.

The register description in the chip manual specifies that DUAL mode
should be used for YUV422 data.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: imx7-media-csi: Use dual sampling for YUV 1X16
Jacopo Mondi [Mon, 21 Feb 2022 17:47:23 +0000 (18:47 +0100)]
media: imx: imx7-media-csi: Use dual sampling for YUV 1X16

The CSI bridge should operate in dual components mode when it is
connected to a pixel transmitter that transfers two components at a time
in YUV 422 formats (16 bits, Y + U/V).

Use the image format variants to determine if single or dual component mode
should be used.

Add a note to the TODO file to record that the list of supported formats
should be restricted to the SoC model the CSI bridge is integrated on
to avoid potential pipeline mis-configurations.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: Rename imx7-mipi-csis.c to imx-mipi-csis.c
Jacopo Mondi [Mon, 21 Feb 2022 17:47:22 +0000 (18:47 +0100)]
media: imx: Rename imx7-mipi-csis.c to imx-mipi-csis.c

Rename the imx7-mipi-csis.c driver to remove the reference to i.MX7.

The driver is for an IP core found on i.MX7 and i.MX8 SoC, so do not
specify a SoC version number in the driver name.

Remove the references to the i.MX7 SoC in the driver symbols and expand
the driver's header with more information about the IP core the driver
controls.

Also rename the associated bindings documentation.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2 years agomedia: imx: De-stage imx7-mipi-csis
Jacopo Mondi [Mon, 21 Feb 2022 17:47:21 +0000 (18:47 +0100)]
media: imx: De-stage imx7-mipi-csis

The imx7-mipi-csis driver is in a good state and can be destaged.

Move the imx7-mipi-csis.c driver to the newly created
drivers/media/platform/imx directory and plumb the related
options in Kconfig and in Makefile.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>