platform/kernel/linux-rpi.git
3 years agomedia: imx: imx7-media-csi: Disable legacy video node API
Laurent Pinchart [Mon, 15 Feb 2021 04:26:53 +0000 (05:26 +0100)]
media: imx: imx7-media-csi: Disable legacy video node API

Support for the MC-centric API has been tested on the i.MX7. Enable it
for that platform. i.MX6 should be converted next.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Expose V4L2_CAP_IO_MC for the MC-centric API
Laurent Pinchart [Mon, 15 Feb 2021 04:26:52 +0000 (05:26 +0100)]
media: imx: capture: Expose V4L2_CAP_IO_MC for the MC-centric API

Report to userspace that the MC-centric API is MC-centric by exposing
the V4L2_CAP_IO_MC. This requires adding support for mbus code filtering
in format enumeration, as required by V4L2_CAP_IO_MC.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Decouple video node from source with MC-centric API
Laurent Pinchart [Mon, 15 Feb 2021 04:26:51 +0000 (05:26 +0100)]
media: imx: capture: Decouple video node from source with MC-centric API

When operating in MC-centric mode, the behaviour of video nodes shall
not be influenced by the active configuration of the source subdev. Add
a set of ioctl handlers that implement this mode, and select them when
support for the legacy API is not requested.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Simplify __capture_legacy_try_fmt()
Laurent Pinchart [Mon, 15 Feb 2021 04:26:50 +0000 (05:26 +0100)]
media: imx: capture: Simplify __capture_legacy_try_fmt()

The __capture_legacy_try_fmt() function returns two values through
pointer arguments. One is a compose rectangle, which duplicates
informationr returned through the subdev format argument, and can thus
be removed. The other is the imx_media_pixfmt, which can be returned
by value instead.

Simplify the implementation of __capture_legacy_try_fmt() by dropping
the retcc and compose arguments, and returning the imx_media_pixfmt by
value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-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>
3 years agomedia: imx: capture: Simplify capture_validate_fmt() implementation
Laurent Pinchart [Mon, 15 Feb 2021 04:26:49 +0000 (05:26 +0100)]
media: imx: capture: Simplify capture_validate_fmt() implementation

capture_validate_fmt() delegates the media bus format to pixel format
conversion to __capture_legacy_try_fmt(). It turns out that this can be
simplified quite a lot:

- The format lookup from media bus code can be performed by the recently
  added capture_find_format() function instead of receiving the
  information from a side effect of __capture_legacy_try_fmt().

- The validation of the pixel format size isn't needed, as they
  duplicate the validation of the compose rectangle. The pixel format
  size is directly derived from the size of the incoming stream, which
  is stored in the compose rectangle. If the compose rectangle is valid,
  the pixel format size will be valid too.

By removing the validation of the pixel format size and using
capture_find_format() to lookup the format, we can stop using
__capture_legacy_try_fmt() and simplify capture_validate_fmt().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Extract format lookup from __capture_legacy_try_fmt
Laurent Pinchart [Mon, 15 Feb 2021 04:26:48 +0000 (05:26 +0100)]
media: imx: capture: Extract format lookup from __capture_legacy_try_fmt

Extract the format lookup code from __capture_legacy_try_fmt() to a
separate function, it will be reused when validating the video node
format at stream start time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()
Laurent Pinchart [Mon, 15 Feb 2021 04:26:47 +0000 (05:26 +0100)]
media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()

The correct return code to report an invalid pipeline configuration is
-EPIPE. Return it instead of -EINVAL from __capture_legacy_try_fmt()
when the capture format doesn't match the media bus format of the
connected subdev.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Pass v4l2_pix_format to __capture_legacy_try_fmt()
Laurent Pinchart [Mon, 15 Feb 2021 04:26:46 +0000 (05:26 +0100)]
media: imx: capture: Pass v4l2_pix_format to __capture_legacy_try_fmt()

The __capture_legacy_try_fmt() function only needs the v4l2_pix_format
embedded in the v4l2_format argument it receives. Pass it the
v4l2_pix_format directly, allowing on caller to allocate a smaller
structure on the stack.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-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>
3 years agomedia: imx: capture: Remove unneeded variable in __capture_legacy_try_fmt
Laurent Pinchart [Mon, 15 Feb 2021 04:26:45 +0000 (05:26 +0100)]
media: imx: capture: Remove unneeded variable in __capture_legacy_try_fmt

The __capture_legacy_try_fmt() function doesn't need two
imx_media_pixfmt pointer variables. Remove one of them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-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>
3 years agomedia: imx: capture: Add a mechanism to disable control inheritance
Laurent Pinchart [Mon, 15 Feb 2021 04:26:44 +0000 (05:26 +0100)]
media: imx: capture: Add a mechanism to disable control inheritance

Add a parameter to the imx_media_capture_device_init() function to
select between the legacy and MC-centric API. When selecting the
MC-centric API, the video node doesn't inherit controls from subdevs
anymore. All callers are updated to use the legacy API for now,
preserving the existing behaviour.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Rename ioctl operations with legacy prefix
Laurent Pinchart [Mon, 15 Feb 2021 04:26:43 +0000 (05:26 +0100)]
media: imx: capture: Rename ioctl operations with legacy prefix

The i.MX media drivers implement a legacy video node API, where the
format of the video node is influenced by the active format of the
connected subdev (both for enumeration and for the get, set and try
format ioctls), and where controls exposed by the subdevs in the
pipeline are inherited by the video node.

At the same time, the drivers implement the media controller API and
expose subdev video nodes to userspace. Those two modes of operation are
incompatible and should not be exposed together. Furthermore, the legacy
API gets in the way of proper enumeration of pixel formats on the video
node, as it prevents compliance with the V4L2 specification.

As a first step towards fixing this, rename all V4L2 video node ioctl
handlers with a legacy prefix. This will allow implementing a new set of
ioctls in parallel and gradually switching drivers. Add a task to the
TODO file for the removal of the legacy API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Rename querycap handler to capture_querycap
Laurent Pinchart [Mon, 15 Feb 2021 04:26:42 +0000 (05:26 +0100)]
media: imx: capture: Rename querycap handler to capture_querycap

For consistency with all the other ioctl handlers, rename
vidioc_querycap() to capture_querycap().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-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>
3 years agomedia: imx: capture: Move default format init to a separate function
Laurent Pinchart [Mon, 15 Feb 2021 04:26:41 +0000 (05:26 +0100)]
media: imx: capture: Move default format init to a separate function

To prepare for more complex default format initialization and keep
imx_media_capture_device_register() simple, extract the format
initialization code to a separate function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Store v4l2_pix_format in imx_media_video_dev
Laurent Pinchart [Mon, 15 Feb 2021 04:26:40 +0000 (05:26 +0100)]
media: imx: capture: Store v4l2_pix_format in imx_media_video_dev

The imx_media_video_dev structure stores the active format on the video
node in an instance of v4l2_format. This wastes memory when all we need
is the information contained in the smaller v4l2_pix_format
sub-structure. Replace v4l2_format by v4l2_pix_format to save memory.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Register the video device after completing init
Laurent Pinchart [Mon, 15 Feb 2021 04:26:39 +0000 (05:26 +0100)]
media: imx: capture: Register the video device after completing init

When the video device is registered, it can get used by userspace
immediately. Its initialization must thus be fully complete. Ensure this
by registering the video device after all initialization steps.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Initialize video_device programmatically
Laurent Pinchart [Mon, 15 Feb 2021 04:26:38 +0000 (05:26 +0100)]
media: imx: capture: Initialize video_device programmatically

Overwriting the whole video_device isn't future-proof as it would
overwrite any field initialized by video_device_alloc(). Furthermore,
the current implementation modifies the global template video_device as
if it were a per-instance structure, which is bad practice. To fix all
this, initialize the video device programmatically in
imx_media_capture_device_init().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Move queue and ctrl handler init to init function
Laurent Pinchart [Mon, 15 Feb 2021 04:26:37 +0000 (05:26 +0100)]
media: imx: capture: Move queue and ctrl handler init to init function

Move the initialization of the vb2 queue and the control handler to the
imx_media_capture_device_init() function. There's no need to delay them
until the registration time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Remove capture_priv stop field
Laurent Pinchart [Mon, 15 Feb 2021 04:26:36 +0000 (05:26 +0100)]
media: imx: capture: Remove capture_priv stop field

The stop field in the capture_priv structure is only set, never read.
Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Clean up capture_priv structure
Laurent Pinchart [Mon, 15 Feb 2021 04:26:35 +0000 (05:26 +0100)]
media: imx: capture: Clean up capture_priv structure

Document all the fields of the capture_priv structure and group them by
purpose.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: capture: Handle errors from v4l2_fh_open()
Laurent Pinchart [Mon, 15 Feb 2021 04:26:34 +0000 (05:26 +0100)]
media: imx: capture: Handle errors from v4l2_fh_open()

If the call to v4l2_fh_open() fails, return the error code instead of
proceeding normally as if nothing happened.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Remove forward declaration of capture_qops
Laurent Pinchart [Mon, 15 Feb 2021 04:26:33 +0000 (05:26 +0100)]
media: imx: capture: Remove forward declaration of capture_qops

The forward declaration of capture_qops isn't needed, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Use device name to construct bus_info
Laurent Pinchart [Mon, 15 Feb 2021 04:26:32 +0000 (05:26 +0100)]
media: imx: capture: Use device name to construct bus_info

The v4l2_capability bus_info field is meant to locate the device in the
system. Using a subdev name isn't a good fit, the device name is a much
better option. Use it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: capture: Use dev_* instead of v4l2_* to log messages
Laurent Pinchart [Mon, 15 Feb 2021 04:26:31 +0000 (05:26 +0100)]
media: imx: capture: Use dev_* instead of v4l2_* to log messages

The imx-media-capture helpers operate a video device node, but abuse the
v4l2_* subdev print functions to log messages. We have a struct device
pointer available, use it instead with the dev_* functions. This reduces
dependencies from imx-media-capture to the connected subdev.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: utils: Add ability to filter pixel formats by mbus code
Laurent Pinchart [Mon, 15 Feb 2021 04:26:30 +0000 (05:26 +0100)]
media: imx: utils: Add ability to filter pixel formats by mbus code

Add a media bus code argument to the imx_media_enum_pixel_formats(). If
set to a non-zero value, the function will only consider pixel formats
that match the given media bus code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: Set default sizes through macros in all drivers
Laurent Pinchart [Mon, 15 Feb 2021 04:26:29 +0000 (05:26 +0100)]
media: imx: Set default sizes through macros in all drivers

All drivers use 640x480 as the default size, but they all hardcode those
values. Create two global macros named IMX_MEDIA_DEF_PIX_WIDTH and
IMX_MEDIA_DEF_PIX_HEIGHT to store the default size, and use them through
the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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>
3 years agomedia: imx: Compile imx6-media-objs only for CONFIG_VIDEO_IMX_CSI
Laurent Pinchart [Mon, 15 Feb 2021 04:26:28 +0000 (05:26 +0100)]
media: imx: Compile imx6-media-objs only for CONFIG_VIDEO_IMX_CSI

imx6-media-objs contains a set of objects that are specific to the i.MX6
IPU-based media subsystem. They're not needed for the i.MX7 CSI. Only
compile them if CONFIG_VIDEO_IMX_CSI is selected.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: Drop manual dependency on VIDEO_IMX_MEDIA
Laurent Pinchart [Mon, 15 Feb 2021 04:26:27 +0000 (05:26 +0100)]
media: imx: Drop manual dependency on VIDEO_IMX_MEDIA

The VIDEO_IMX_CSI and VIDEO_IMX7_CSI symbols are defined in a section
guarded by VIDEO_IMX_MEDIA. There's no need to duplicate that with a
"depends on" statement. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: Move dependency on VIDEO_DEV to common Kconfig symbol
Laurent Pinchart [Mon, 15 Feb 2021 04:26:26 +0000 (05:26 +0100)]
media: imx: Move dependency on VIDEO_DEV to common Kconfig symbol

All the i.MX staging media drivers depend on VIDEO_DEV. Move the
dependency to the common VIDEO_IMX_MEDIA symbol to avoid repeating it.

While at it, sort the dependencies and selections alphabetically.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: imx: Drop dependency on I2C
Laurent Pinchart [Mon, 15 Feb 2021 04:26:25 +0000 (05:26 +0100)]
media: imx: Drop dependency on I2C

The i.MX staging media drivers don't depend on I2C. Drop the dependency
from Kconfig.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ngene: switch from 'pci_' to 'dma_' API
Christophe JAILLET [Sat, 30 Jan 2021 06:32:00 +0000 (07:32 +0100)]
media: ngene: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below and has been
hand modified to replace GFP_ with a correct flag.
It has been compile tested.

When memory is allocated, GFP_KERNEL can be used because in all cases,
it is called from a probe function and no lock is taken in the between.

The call chain is:
  ngene_probe                       (probe function, used in ngene-cards.c)
    --> ngene_get_buffers
      --> AllocCommonBuffers                  (call dma_alloc_coherent)
        --> create_ring_buffer                (call dma_alloc_coherent)
        --> AllocateRingBuffers               (call dma_alloc_coherent)

@@
@@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL

@@
@@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE

@@
@@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE

@@
@@
-    PCI_DMA_NONE
+    DMA_NONE

@@
expression e1, e2, e3;
@@
-    pci_alloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
-    pci_zalloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
-    pci_free_consistent(e1, e2, e3, e4)
+    dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
-    pci_map_page(e1, e2, e3, e4, e5)
+    dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_page(e1, e2, e3, e4)
+    dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_sg(e1, e2, e3, e4)
+    dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_sg(e1, e2, e3, e4)
+    dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_device(e1, e2, e3, e4)
+    dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_consistent_dma_mask(e1, e2)
+    dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drxj: remove redundant assignments to variable image_to_select
Colin Ian King [Thu, 28 Jan 2021 16:59:11 +0000 (17:59 +0100)]
media: drxj: remove redundant assignments to variable image_to_select

The variable image_to_select is being initialized with a value that
is never read and it is being updated later with a new value.  The
initialization is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: adv7511: remove open coded version of SMBus block read
Wolfram Sang [Wed, 27 Jan 2021 10:33:57 +0000 (11:33 +0100)]
media: i2c: adv7511: remove open coded version of SMBus block read

The open coded version differs from the one in the core in one way: the
buffer will be always copied back, even when the transfer failed. Be
more robust: use the block read from the I2C core and propagate a
potential errno further to the sanity checks.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cx23885: Fix various Hauppauge device analog capture inputs
Brad Love [Tue, 26 Jan 2021 04:52:06 +0000 (05:52 +0100)]
media: cx23885: Fix various Hauppauge device analog capture inputs

Reports indicated S-Video capture did not work on HVR1265_K4, so all
devices on hand were audited and corrected to become fully
functional.

ImpactVCB-e
- Remove extraneous composite inputs
- Fix S-Video inputs

HVR5525
- Add routing and config for composite capture
- Add routing and config for S-Video capture
- Add routing for audio on both composite/S-Video

HVR1265_K4
- Remove non-existent composite capture
- Add routing and config for S-Video capture

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cx23885: add more quirks for reset DMA on some AMD IOMMU
Brad Love [Tue, 26 Jan 2021 04:52:05 +0000 (05:52 +0100)]
media: cx23885: add more quirks for reset DMA on some AMD IOMMU

The folowing AMD IOMMU are affected by the RiSC engine stall, requiring a
reset to maintain continual operation. After being added to the
broken_dev_id list the systems are functional long term.

0x1481 is the PCI ID for the IOMMU found on Starship/Matisse

0x1419 is the PCI ID for the IOMMU found on 15h (Models 10h-1fh) family

0x5a23 is the PCI ID for the IOMMU found on RD890S/RD990

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvbdev: Switch to new kerneldoc syntax for named variable macro argument
Jonathan Neuschäfer [Fri, 1 Jan 2021 16:02:11 +0000 (17:02 +0100)]
media: dvbdev: Switch to new kerneldoc syntax for named variable macro argument

The syntax without dots is available since commit 43756e347f21
("scripts/kernel-doc: Add support for named variable macro arguments").

The same HTML output is produced with and without this patch.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: aspeed: fix clock handling logic
Jae Hyun Yoo [Mon, 21 Dec 2020 22:32:25 +0000 (23:32 +0100)]
media: aspeed: fix clock handling logic

Video engine uses eclk and vclk for its clock sources and its reset
control is coupled with eclk so the current clock enabling sequence works
like below.

 Enable eclk
 De-assert Video Engine reset
 10ms delay
 Enable vclk

It introduces improper reset on the Video Engine hardware and eventually
the hardware generates unexpected DMA memory transfers that can corrupt
memory region in random and sporadic patterns. This issue is observed
very rarely on some specific AST2500 SoCs but it causes a critical
kernel panic with making a various shape of signature so it's extremely
hard to debug. Moreover, the issue is observed even when the video
engine is not actively used because udevd turns on the video engine
hardware for a short time to make a query in every boot.

To fix this issue, this commit changes the clock handling logic to make
the reset de-assertion triggered after enabling both eclk and vclk. Also,
it adds clk_unprepare call for a case when probe fails.

clk: ast2600: fix reset settings for eclk and vclk
Video engine reset setting should be coupled with eclk to match it
with the setting for previous Aspeed SoCs which is defined in
clk-aspeed.c since all Aspeed SoCs are sharing a single video engine
driver. Also, reset bit 6 is defined as 'Video Engine' reset in
datasheet so it should be de-asserted when eclk is enabled. This
commit fixes the setting.

Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Fixes: d3d04f6c330a ("clk: Add support for AST2600 SoC")
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rkisp1: rsz: crash fix when setting src format
Dafna Hirschfeld [Wed, 9 Dec 2020 16:15:10 +0000 (17:15 +0100)]
media: rkisp1: rsz: crash fix when setting src format

When setting the source media bus code in the resizer,
we first check that the current media bus code in the
source is yuv encoded format. This is done by
retrieving the data from the formats list of the isp
entity. This cause a crash when the media bus code on the
source is YUYV8_1_5X8 which is not supported by the isp
entity. Instead we should test the sink format of the resizer
which is guaranteed to be supported by the isp entity.

Fixes: 251b6eebb6c49 ("media: staging: rkisp1: rsz: Add support to more YUV encoded mbus codes on src pad")
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Tested-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: b2c2: remove trailing semicolon in macro definition
Tom Rix [Fri, 27 Nov 2020 16:38:36 +0000 (17:38 +0100)]
media: b2c2: remove trailing semicolon in macro definition

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: omap4iss: return error code when omap4iss_get() failed
Yang Yingliang [Tue, 17 Nov 2020 02:50:41 +0000 (03:50 +0100)]
media: omap4iss: return error code when omap4iss_get() failed

If omap4iss_get() failed, it need return error code in iss_probe().

Fixes: 59f0ad807681 ("[media] v4l: omap4iss: Add support for OMAP4...")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/siano: kill pointless kmutex definitions
Davidlohr Bueso [Sun, 1 Nov 2020 19:54:24 +0000 (20:54 +0100)]
media: media/siano: kill pointless kmutex definitions

Use the mutex api instead of renaming the calls for this
driver.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ngene: simplify the return expression of eeprom_write_ushort()
Qinglang Miao [Mon, 21 Sep 2020 13:10:37 +0000 (15:10 +0200)]
media: ngene: simplify the return expression of eeprom_write_ushort()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: anysee: simplify the return expression of anysee_ci_* function
Liu Shixin [Mon, 21 Sep 2020 08:24:38 +0000 (10:24 +0200)]
media: anysee: simplify the return expression of anysee_ci_* function

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: saa7146: use sg_dma_len when building pgtable
Tasos Sahanidis [Wed, 3 Mar 2021 18:52:53 +0000 (19:52 +0100)]
media: saa7146: use sg_dma_len when building pgtable

The new AMD IOMMU DMA implementation concatenates sglist entries under
certain conditions, and because saa7146 accessed the length member
directly, it did not support this scenario.

This fixes IO_PAGE_FAULTs by using the sg_dma_len macro.

Fixes: be62dbf554c5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api")
Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: saa7134: use sg_dma_len when building pgtable
Tasos Sahanidis [Wed, 3 Mar 2021 18:30:18 +0000 (19:30 +0100)]
media: saa7134: use sg_dma_len when building pgtable

The new AMD IOMMU DMA implementation concatenates sglist entries under
certain conditions, and because saa7134 accessed the length member
directly, it did not support this scenario.

This fixes IO_PAGE_FAULTs and choppy DMA audio by using the
sg_dma_len macro.

Fixes: be62dbf554c5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api")
Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: fix incorrect kernel doc usages
Hans Verkuil [Wed, 3 Mar 2021 12:55:10 +0000 (13:55 +0100)]
media: fix incorrect kernel doc usages

This patch fixes the following trivial warnings w.r.t. kernel-doc usage:

drivers/media/common/videobuf2/frame_vector.c:38: warning: Excess function parameter 'gup_flags' description in 'get_vaddr_frames'
drivers/media/dvb-core/dvb_ca_en50221.c:193: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1014: warning: expecting prototype for Wake up the DVB CA thread(). Prototype was for
dvb_ca_en50221_thread_wakeup() instead
drivers/media/dvb-core/dvb_ca_en50221.c:1023: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1081: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1112: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1327: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1411: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1426: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1582: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1693: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1743: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1772: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1830: warning: wrong kernel-doc identifier on line:
drivers/media/dvb-core/dvb_ca_en50221.c:1922: warning: wrong kernel-doc identifier on line:
drivers/media/rc/img-ir/img-ir-hw.c:628: warning: expecting prototype for img_ir_decoder_compatable(). Prototype was for
img_ir_decoder_compatible() instead
drivers/media/v4l2-core/v4l2-jpeg.c:461: warning: expecting prototype for jpeg_parse_header(). Prototype was for v4l2_jpeg_parse_header()
instead
drivers/media/platform/vsp1/vsp1_dl.c:166: warning: expecting prototype for struct vsp1_cmd_pool. Prototype was for struct vsp1_dl_cmd_pool
instead
drivers/media/platform/mtk-vpu/mtk_vpu.c:28: warning: expecting prototype for is a tiny processor controlling video hardware(). Prototype
was for INIT_TIMEOUT_MS() instead
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:73: warning: expecting prototype for struct vp9_fb_info. Prototype was for struct
vp9_ref_buf instead
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:85: warning: expecting prototype for struct vp9_fb_info. Prototype was for struct
vp9_sf_ref_fb instead
drivers/media/tuners/mt2063.c:1404: warning: expecting prototype for fLO_FractionalTerm(). Prototype was for MT2063_fLO_FractionalTerm() instead
drivers/media/tuners/mt2063.c:1465: warning: expecting prototype for CalcLO2Mult(). Prototype was for MT2063_CalcLO2Mult() instead
drivers/media/usb/pwc/pwc-dec23.c:640: warning: wrong kernel-doc identifier on line:
drivers/media/platform/exynos4-is/media-dev.c:820: warning: expecting prototype for __fimc_md_create_fimc_links(). Prototype was for
__fimc_md_create_fimc_sink_links() instead
drivers/media/i2c/s5k6aa.c:426: warning: expecting prototype for s5k6aa_configure_pixel_clock(). Prototype was for
s5k6aa_configure_pixel_clocks() instead
drivers/media/i2c/imx274.c:700: warning: wrong kernel-doc identifier on line:
drivers/media/i2c/imx274.c:735: warning: wrong kernel-doc identifier on line:
drivers/media/i2c/imx274.c:983: warning: wrong kernel-doc identifier on line:

Most are missing or mistyped function names.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vivid: fix assignment of dev->fbuf_out_flags
Colin Ian King [Thu, 25 Feb 2021 15:43:27 +0000 (16:43 +0100)]
media: vivid: fix assignment of dev->fbuf_out_flags

Currently the chroma_flags and alpha_flags are being zero'd with a bit-wise
mask and the following statement should be bit-wise or'ing in the new flag
bits but instead is making a direct assignment.  Fix this by using the |=
operator rather than an assignment.

Addresses-Coverity: ("Unused value")

Fixes: ef834f7836ec ("[media] vivid: add the video capture and output parts")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-subdev.rst: typo fix
Tomi Valkeinen [Tue, 16 Feb 2021 06:44:55 +0000 (07:44 +0100)]
media: v4l2-subdev.rst: typo fix

Fix a typo in the text.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ti-vpe: Simplify bool comparison
Jiapeng Chong [Mon, 8 Feb 2021 10:04:46 +0000 (11:04 +0100)]
media: ti-vpe: Simplify bool comparison

Fix the following coccicheck warning:

./drivers/media/platform/ti-vpe/vpdma.c:946:5-26: WARNING: Comparison to
bool.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cec-notifier: also search for HDMI devices on I2C
Johan Fjeldtvedt [Tue, 2 Mar 2021 11:50:56 +0000 (12:50 +0100)]
media: cec-notifier: also search for HDMI devices on I2C

Currently the cec_notifier_parse_hdmi_phandle function can only be used
if the HDMI device associated with the CEC device is a platform device.
Extend the function to cover I2C devices as well, as there do exist
some I2C HDMI devices which don't handle CEC internally and need an
external CEC adapter.

[hverkuil: add missing linux/i2c.h header]
[hverkuil: only attempt to find the i2c device if CONFIG_I2C is set]

Signed-off-by: Johan Fjeldtvedt <johfjeld@cisco.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drivers/media/usb: fix memory leak in zr364xx_probe
Pavel Skripkin [Mon, 1 Mar 2021 20:38:26 +0000 (21:38 +0100)]
media: drivers/media/usb: fix memory leak in zr364xx_probe

syzbot reported memory leak in zr364xx_probe()[1].
The problem was in invalid error handling order.
All error conditions rigth after v4l2_ctrl_handler_init()
must call v4l2_ctrl_handler_free().

Reported-by: syzbot+efe9aefc31ae1e6f7675@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rkisp1: params: remove extra 'if' conditions
Dafna Hirschfeld [Mon, 1 Mar 2021 17:18:34 +0000 (18:18 +0100)]
media: rkisp1: params: remove extra 'if' conditions

There is a repeating code pattern:

if (a || b) {
if (a)
...
if (b)
...
}

In this pattern, the first 'if' is redundant.
The code can be replaced with:

if (a)
...
if (b)
...

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>
3 years agomedia: mtk: fix mtk-smi dependency
Arnd Bergmann [Fri, 26 Feb 2021 14:07:14 +0000 (15:07 +0100)]
media: mtk: fix mtk-smi dependency

The mtk-smi driver can now be built as a loadable module, but
this leads to a build time regression when the drivers that
depend on it are built-in:

aarch64-linux-ld: drivers/media/platform/mtk-mdp/mtk_mdp_comp.o: in function `mtk_mdp_comp_clock_on':
mtk_mdp_comp.c:(.text.mtk_mdp_comp_clock_on+0x54): undefined reference to `mtk_smi_larb_get'
aarch64-linux-ld: drivers/media/platform/mtk-mdp/mtk_mdp_comp.o: in function `mtk_mdp_comp_clock_off':
mtk_mdp_comp.c:(.text.mtk_mdp_comp_clock_off+0x12c): undefined reference to `mtk_smi_larb_put'

Add a dependency on the interface, but keep allowing
compile-testing without that driver, as it was originally
intended.

Fixes: 50fc8d9232cd ("memory: mtk-smi: Allow building as module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB
Julian Braha [Thu, 25 Feb 2021 08:06:58 +0000 (09:06 +0100)]
media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB

When STA2X11_VIP is enabled, and GPIOLIB is disabled,
Kbuild gives the following warning:

WARNING: unmet direct dependencies detected for VIDEO_ADV7180
  Depends on [n]: MEDIA_SUPPORT [=y] && GPIOLIB [=n] && VIDEO_V4L2 [=y] && I2C [=y]
  Selected by [y]:
  - STA2X11_VIP [=y] && MEDIA_SUPPORT [=y] && MEDIA_PCI_SUPPORT [=y] && MEDIA_CAMERA_SUPPORT [=y] && PCI [=y] && VIDEO_V4L2 [=y] && VIRT_TO_BUS [=y] && I2C [=y] && (STA2X11 [=n] || COMPILE_TEST [=y]) && MEDIA_SUBDRV_AUTOSELECT [=y]

This is because STA2X11_VIP selects VIDEO_ADV7180
without selecting or depending on GPIOLIB,
despite VIDEO_ADV7180 depending on GPIOLIB.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/usb:Remove superfluous "breaks" in the ttusb_dec.c
dingsenjie [Tue, 23 Feb 2021 08:36:54 +0000 (09:36 +0100)]
media: media/usb:Remove superfluous "breaks" in the ttusb_dec.c

Remove superfluous "breaks", as there is a "return" before them.

Signed-off-by: dingsenjie <dingsenjie@yulong.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/usb:Remove superfluous "breaks"
dingsenjie [Tue, 23 Feb 2021 08:20:31 +0000 (09:20 +0100)]
media: media/usb:Remove superfluous "breaks"

Remove superfluous "breaks", as there is a "return" before them.

Signed-off-by: dingsenjie <dingsenjie@yulong.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/i2c: remove unneeded variable: "ret"
zuoqilin [Mon, 22 Feb 2021 13:13:17 +0000 (14:13 +0100)]
media: media/i2c: remove unneeded variable: "ret"

remove unneeded variable: "ret"

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: solo6x10: Switch to using the new API kobj_to_dev()
Yang Li [Mon, 22 Feb 2021 08:08:01 +0000 (09:08 +0100)]
media: solo6x10: Switch to using the new API kobj_to_dev()

fixed the following coccicheck:
./drivers/media/pci/solo6x10/solo6x10-core.c:371:60-61: WARNING
opportunity for kobj_to_dev()

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+huawei@kernel.org>
3 years agomedia: qcom: camss: Fix overflows in clock rate calculations
Vladimir Lypak [Wed, 17 Feb 2021 22:11:34 +0000 (23:11 +0100)]
media: qcom: camss: Fix overflows in clock rate calculations

Because of u32 type being used to store pixel clock rate, expression used
to calculate pipeline clocks (pixel_clock * bpp) produces wrong value due
to integer overflow. This patch changes data type used to store, pass and
retrieve pixel_clock from u32 to u64 to make this mistake less likely to
be repeated in the future.

Signed-off-by: Vladimir Lypak <junak.pub@gmail.com>
Acked-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: use v4l2_get_link_freq() to calculate the relevant clocks
Andrey Konovalov [Wed, 17 Feb 2021 22:11:33 +0000 (23:11 +0100)]
media: camss: use v4l2_get_link_freq() to calculate the relevant clocks

There are places in the camss driver where camss_get_pixel_clock() is
called to get the pixel rate (using V4L2_CID_PIXEL_RATE control) and to
calculate the link frequency from it. There is a case when this would
not work: when V4L2_CID_PIXEL_RATE gets the rate at which the pixels are
read (sampled) from the sensor's pixel array, and this rate is different
from the pixel transmission rate over the CSI link, the link frequency
value can't be calculated from the pixel rate. One needs to use
V4L2_CID_LINK_FREQ to get the link frequency in this case.

Replace such calls to camss_get_pixel_clock() with calls to a wrapper
around v4l2_get_link_freq(). v4l2_get_link_freq() tries V4L2_CID_LINK_FREQ
first, and if it is not implemented by the camera sensor driver, falls
back to V4L2_CID_PIXEL_RATE to calculate the link frequency value from.

Calls to camss_get_pixel_clock() from vfe_[check,set]_clock_rates()
are left intact as it looks like this VFE clock does depend on the
rate the pixel samples comes out of the camera sensor, not on the
frequency at which the link between the sensor and the CSI receiver
operates.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Acked-by: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l: common: v4l2_get_link_freq: add printing a warning
Andrey Konovalov [Thu, 18 Feb 2021 17:16:40 +0000 (18:16 +0100)]
media: v4l: common: v4l2_get_link_freq: add printing a warning

Print a warning if V4L2_CID_LINK_FREQ control is not implemented.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drivers: media: pci: cx18: Spelling fix of minimze to minimize in the file...
Bhaskar Chowdhury [Sat, 13 Feb 2021 15:13:20 +0000 (16:13 +0100)]
media: drivers: media: pci: cx18: Spelling fix of minimze to minimize in the file cx18-av-audio.c

s/minimze/minimize/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drivers: media: pci: cx18: Couple of spell fixes in the file cx18-av-core.c
Bhaskar Chowdhury [Sat, 13 Feb 2021 15:08:05 +0000 (16:08 +0100)]
media: drivers: media: pci: cx18: Couple of spell fixes in the file cx18-av-core.c

s/minimze/minimize/
s/initallize/initialize/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: drivers/media/pci/cx18: Fix a spelling minimze to minimize in the file cx18...
Bhaskar Chowdhury [Sat, 13 Feb 2021 15:00:14 +0000 (16:00 +0100)]
media: drivers/media/pci/cx18: Fix a spelling minimze to minimize in the file cx18-firmware.c

s/minimze/minimize/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: use getter/setter functions
Julia Lawall [Tue, 9 Feb 2021 21:13:33 +0000 (22:13 +0100)]
media: use getter/setter functions

Use getter and setter functions, for a variety of data types.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: doc: h264/hevc: Clarify _START_CODE_NONE meaning
Nicolas Dufresne [Tue, 9 Feb 2021 17:22:33 +0000 (18:22 +0100)]
media: doc: h264/hevc: Clarify _START_CODE_NONE meaning

As some hardware have a knob to enable or disable emulation prevention
bytes removal, driver writers ended up wondering what exactly the
START_CODE_NONE modes meant in this regards. This patch clarify what is
expected with a reference to the specification.

Reported-by: John Cox <jc@kynesim.co.uk>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: usbtv: constify static structs
Rikard Falkeborn [Sat, 6 Feb 2021 21:21:39 +0000 (22:21 +0100)]
media: usbtv: constify static structs

Constify two static structs which are never modified to allow the
compiler to put them in read-only memory.

The only usage of norm_params is only read from it in
usbtv_configure_for_norm(). Making it const shrinks the resulting
ko-file with 300 bytes (tested with gcc 10).

The only usage of usbtv_ioctl_ops is to put its address to the ioctl_ops
field in the video_device struct. Making it const moves ~1kb to
read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: include: media: davinci: Fixed up few trivial spellings in the file isif.h
Bhaskar Chowdhury [Fri, 5 Feb 2021 09:21:17 +0000 (10:21 +0100)]
media: include: media: davinci: Fixed up few trivial spellings in the file isif.h

Several spelling fixes throughout the file.

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: sti: make a const arrays static, makes object smaller
Colin Ian King [Thu, 4 Feb 2021 17:08:50 +0000 (18:08 +0100)]
media: platform: sti: make a const arrays static, makes object smaller

Don't populate the const arrays on the stack but instead it
static. Makes the object code smaller by 8 bytes:

Before:
   text    data     bss     dec     hex filename
  12504    4568       0   17072    42b0 media/platform/sti/hva/hva-h264.o

After:
   text    data     bss     dec     hex filename
  12272    4792       0   17064    42a8 media/platform/sti/hva/hva-h264.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: uapi: Correct doc comment in H264 uAPI
Andrzej Pietrasiewicz [Thu, 4 Feb 2021 16:16:59 +0000 (17:16 +0100)]
media: uapi: Correct doc comment in H264 uAPI

struct v4l2_ctrl_h264_pps members obviously match picture parameter syntax,
not sequence parameter syntax.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rc: add keymap for Xbox 360 Universal Media remote
Bastien Nocera [Tue, 26 Jan 2021 17:40:33 +0000 (18:40 +0100)]
media: rc: add keymap for Xbox 360 Universal Media remote

Captured using a raw IR receiver. Manual linked in the remote definition
itself.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvb-usb: Fix use-after-free access
Takashi Iwai [Mon, 1 Feb 2021 08:32:47 +0000 (09:32 +0100)]
media: dvb-usb: Fix use-after-free access

dvb_usb_device_init() copies the properties to the own data, so that
the callers can release the original properties later (as done in the
commit 299c7007e936 ("media: dw2102: Fix memleak on sequence of
probes")).  However, it also stores dev->desc pointer that is a
reference to the original properties data.  Since dev->desc is
referred later, it may result in use-after-free, in the worst case,
leading to a kernel Oops as reported.

This patch addresses the problem by allocating and copying the
properties at first, then get the desc from the copied properties.

Reported-and-tested-by: Stefan Seyfried <seife+kernel@b1-systems.com>
BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=1181104
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvb-usb: Fix memory leak at error in dvb_usb_device_init()
Takashi Iwai [Mon, 1 Feb 2021 08:32:46 +0000 (09:32 +0100)]
media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()

dvb_usb_device_init() allocates a dvb_usb_device object, but it
doesn't release the object by itself even at errors.  The object is
released in the callee side (dvb_usb_init()) in some error cases via
dvb_usb_exit() call, but it also missed the object free in other error
paths.  And, the caller (it's only dvb_usb_device_init()) doesn't seem
caring the resource management as well, hence those memories are
leaked.

This patch assures releasing the memory at the error path in
dvb_usb_device_init().  Now dvb_usb_init() frees the resources it
allocated but leaves the passed dvb_usb_device object intact.  In
turn, the dvb_usb_device object is released in dvb_usb_device_init()
instead.
We could use dvb_usb_exit() function for releasing everything in the
callee (as it was used for some error cases in the original code), but
releasing the passed object in the callee is non-intuitive and
error-prone.  So I took this approach (which is more standard in Linus
kernel code) although it ended with a bit more open codes.

Along with the change, the patch makes sure that USB intfdata is reset
and don't return the bogus pointer to the caller of
dvb_usb_device_init() at the error path, too.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: em28xx: Add pid for bulk revision of Hauppauge 461eV2
Brad Love [Tue, 2 Feb 2021 01:40:30 +0000 (02:40 +0100)]
media: em28xx: Add pid for bulk revision of Hauppauge 461eV2

Manufacturing has switched from ISOC to bulk transport,
the pid has accordingly changed to signify this.

0x2013:0x0461 is an ISOC 461e v2

0x2013:0x8461 is a bulk transport 461e v2

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>
3 years agomedia: em28xx: Add pid for bulk revision of Hauppauge 461e
Brad Love [Tue, 2 Feb 2021 01:40:29 +0000 (02:40 +0100)]
media: em28xx: Add pid for bulk revision of Hauppauge 461e

Manufacturing has switched from ISOC to bulk transport,
the pid has accordingly changed to signify this.

0x2013:0x0258 is an ISOC 461e

0x2013:0x8258 is a bulk transport 461e

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>
3 years agomedia: rc: add keymap for minix-neo remote
Christian Hewitt [Mon, 1 Feb 2021 20:59:51 +0000 (21:59 +0100)]
media: rc: add keymap for minix-neo remote

Add a keymap and bindings for the simple IR (NEC) remote used with
Minix 'NEO' branded Android STB devices.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: in_use is not needed
Sean Young [Mon, 22 Feb 2021 13:46:42 +0000 (14:46 +0100)]
media: ite-cir: in_use is not needed

The in_use variable is set to true when a lirc file is opened, and ir
transmit can only be done by writing to a lirc file descriptor. As a
result when in_use is read, it is always true, so we might as well remove
it.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: check for receive overflow
Sean Young [Mon, 22 Feb 2021 08:08:35 +0000 (09:08 +0100)]
media: ite-cir: check for receive overflow

It's best if this condition is reported.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: move runtime information into driver data
Sean Young [Sun, 21 Feb 2021 20:16:45 +0000 (21:16 +0100)]
media: ite-cir: move runtime information into driver data

The carrier, duty cycle etc are not device dependent, and they can be
changed at runtime. By moving them into the allocated struct, we can make
the device specific structures smaller, and we no longer need to copy
the struct.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: carrier and duty cycle can be set via ioctl
Sean Young [Sat, 20 Feb 2021 12:41:37 +0000 (13:41 +0100)]
media: ite-cir: carrier and duty cycle can be set via ioctl

The lirc ioctls should be used for this, not module parameters.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: use standard logging and reduce noise
Sean Young [Sat, 20 Feb 2021 10:43:47 +0000 (11:43 +0100)]
media: ite-cir: use standard logging and reduce noise

Remove lots of superfluous debug messages which just log the function
name. Also, there is no need to announce the various parameters of the
device. This can be discovered via lirc ioctl if needed.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: set parent device
Sean Young [Sat, 20 Feb 2021 10:04:41 +0000 (11:04 +0100)]
media: ite-cir: set parent device

This ensure that the rc device shows up correctly in sysfs.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ite-cir: remove unused fields
Sean Young [Sun, 21 Feb 2021 10:05:12 +0000 (11:05 +0100)]
media: ite-cir: remove unused fields

These fields are not referenced anywhere.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rc/ite-cir: replace spin_lock_irqsave by spin_lock in hard IRQ
Daode Huang [Fri, 5 Feb 2021 09:39:11 +0000 (10:39 +0100)]
media: rc/ite-cir: replace spin_lock_irqsave by spin_lock in hard IRQ

It is redundant to do irqsave and irqrestore in hardIRQ context.

Signed-off-by: Daode Huang <huangdaode@huawei.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l docs: move some cross-reference identifiers
Mauro Carvalho Chehab [Thu, 4 Mar 2021 14:56:09 +0000 (15:56 +0100)]
media: v4l docs: move some cross-reference identifiers

Sphinx doesn't allow placing those cross-reference identifies
everywhere. Misplacing them cause those warnings:

  Documentation/userspace-api/media/v4l/hist-v4l2.rst:818: WARNING: undefined label: control-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/hist-v4l2.rst:853: WARNING: undefined label: reserved-formats (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/pixfmt-v4l2.rst:47: WARNING: undefined label: reserved-formats (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:39: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:53: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:67: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:83: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:97: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/subdev-formats.rst:140: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-decoder-cmd.rst:75: WARNING: undefined label: decoder-cmds (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-dqevent.rst:234: WARNING: undefined label: control-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-dv-timings.rst:156: WARNING: undefined label: dv-bt-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst:41: WARNING: undefined label: ctrl-class (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst:246: WARNING: undefined label: ctrl-class (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst:269: WARNING: undefined label: ctrl-class (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-modulator.rst:100: WARNING: undefined label: modulator-txsubchans (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-g-tuner.rst:119: WARNING: undefined label: tuner-rxsubchans (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst:167: WARNING: undefined label: control-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst:245: WARNING: undefined label: control-flags (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst:396: WARNING: undefined label: ctrl-class (if the link has no caption the label must precede a section header)
  Documentation/userspace-api/media/v4l/vidioc-subdev-enum-mbus-code.rst:73: WARNING: undefined label: v4l2-subdev-mbus-code-flags (if the link has no caption the label must precede a section header)

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vbi_hsync.svg: fix the viewports
Mauro Carvalho Chehab [Wed, 3 Mar 2021 16:33:27 +0000 (17:33 +0100)]
media: vbi_hsync.svg: fix the viewports

At least at pdf output, part of the VBI drawings are not visible.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dev-overlay.rst: cleanup the xvideo example
Mauro Carvalho Chehab [Wed, 3 Mar 2021 16:19:22 +0000 (17:19 +0100)]
media: dev-overlay.rst: cleanup the xvideo example

It makes more sense to place the xvideo example at the body,
keeping the footnote only to justify the design decision.

While this makes the text better, it also fixes the PDF
output.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: docs: uAPI: fix table output in LaTeX/PDF format
Mauro Carvalho Chehab [Thu, 10 Dec 2020 10:39:46 +0000 (11:39 +0100)]
media: docs: uAPI: fix table output in LaTeX/PDF format

There are lots of tables that are not properly displayed
in LaTeX/PDF.

Fix the tablecolumns, add longtable where needed and LaTeX
formatting macros, in order to address such issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pixfmt-yuv-planar.rst: fix PDF OUTPUT
Mauro Carvalho Chehab [Thu, 10 Dec 2020 10:38:23 +0000 (11:38 +0100)]
media: pixfmt-yuv-planar.rst: fix PDF OUTPUT

Add missing format macros for the tables there to be properly
output.

While here, also remove the empty ".. note::" markup.

It should be noticed that ".. [1]" markups will generate footnotes,
and not a note within the main text body.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ext-ctrls-codec-stateless.rst: fix an H-264 table format
Mauro Carvalho Chehab [Thu, 10 Dec 2020 10:34:21 +0000 (11:34 +0100)]
media: ext-ctrls-codec-stateless.rst: fix an H-264 table format

The Picture Parameter Set Flags table for H-264 doesn't output
well on PDF. There are missing format instructions for LaTeX, and
the columns are too long.

Reduce the size of the second column, as 16 bits is more than enough
for the current flags usage, and add the needed bits for it to be
properly output in PDF format.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: buffer.rst: fix a PDF output issue
Mauro Carvalho Chehab [Thu, 10 Dec 2020 10:30:15 +0000 (11:30 +0100)]
media: buffer.rst: fix a PDF output issue

Sphinx/LaTeX doesn't work well with literal blocks.
Due to that, V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF ends
being writing outside the table (and even outside the page).

We need to not only change the table size and font size, but
also to change the message, in order to avoid this bug.

So, improve the text a little bit, while ensuring that the
literal will be written at the beginning of the second line.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: docs: pixfmt: use section titles for bayer formats
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:36:04 +0000 (08:36 +0100)]
media: docs: pixfmt: use section titles for bayer formats

The bayer formats have a subtitle, specifying how many bits
they use. Add a title markup to those, as otherwise they
look weird, specially at the PDF output.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ext-ctrls-jpeg.rst: cleanup V4L2_CID_JPEG_COMPRESSION_QUALITY text
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:31:21 +0000 (08:31 +0100)]
media: ext-ctrls-jpeg.rst: cleanup V4L2_CID_JPEG_COMPRESSION_QUALITY text

The text is repeating the name of the control, which causes
it to be displayed outside the page with PDF output.

Besides that, this is the only JPEG control doing that. Removing
the name duplication doesn't affect the description, but, instead,
make it nicer.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ext-ctrls-codec.rst: simplify a few tables
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:27:12 +0000 (08:27 +0100)]
media: ext-ctrls-codec.rst: simplify a few tables

Those tables nicely fits on PDF output without any hack.
Yet, they are using a very small font, and have tabularcolumns.

Clean it up, and convert it to an ASCII artwork, as it
makes easier to see that no hacks are needed to display it ;-)

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ext-ctrls-codec.rst: add a missing profile description
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:22:46 +0000 (08:22 +0100)]
media: ext-ctrls-codec.rst: add a missing profile description

One of the MPEG-4 profiles has a missing description. Add it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ext-ctrls-codec-stateless.rst: change a FWHT flag description
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:20:11 +0000 (08:20 +0100)]
media: ext-ctrls-codec-stateless.rst: change a FWHT flag description

Instead of using "- 1", use "minus one".

The reason is that, if the table is split like:

  V4L2_FWHT_FL_COMPONENTS_NUM_MSK  0x00070000  The number of color components
                                               - 1.

One might not realize the meaning of the second line.

As a side effect, using text instead of arabic numbers is
more appropriate for formal documents like this spec.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: docs: sliced-vbi: fix V4L2_SLICED_WSS_625 docs
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:13:48 +0000 (08:13 +0100)]
media: docs: sliced-vbi: fix V4L2_SLICED_WSS_625 docs

While fixing issues with PDF generation, I noticed that
bit 8 was missing for WSS 625 format.

While here, convert the literal block into a tables,
as it becomes more visible.

I opted to move the payload into a separate table, as
Sphinx has troubles with complex nested tables.

This way, it should work fine on both html and LaTeX/PDF
formats.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: control.rst: use a table for V4L2_CID_POWER_LINE
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:08:20 +0000 (08:08 +0100)]
media: control.rst: use a table for V4L2_CID_POWER_LINE

The default way to document control enums is via tables.

Use one here too. As the table is simple, just use ASCII
artwork.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: colorspaces-details.rst: drop tabularcolumns
Mauro Carvalho Chehab [Thu, 10 Dec 2020 07:05:14 +0000 (08:05 +0100)]
media: colorspaces-details.rst: drop tabularcolumns

Those tables have small cells that fit nicely without requiring
line beaks.

So, they don't need tabular columns, as Sphinx/LaTeX
can adjust the width on such tables.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agoLinux 5.12-rc2
Linus Torvalds [Sat, 6 Mar 2021 01:33:41 +0000 (17:33 -0800)]
Linux 5.12-rc2

3 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Linus Torvalds [Sat, 6 Mar 2021 01:27:59 +0000 (17:27 -0800)]
Merge tag 'for-linus' of git://git./linux/kernel/git/rdma/rdma

Pull rdma fixes from Jason Gunthorpe:
 "Nothing special here, though Bob's regression fixes for rxe would have
  made it before the rc cycle had there not been such strong winter
  weather!

   - Fix corner cases in the rxe reference counting cleanup that are
     causing regressions in blktests for SRP

   - Two kdoc fixes so W=1 is clean

   - Missing error return in error unwind for mlx5

   - Wrong lock type nesting in IB CM"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  RDMA/rxe: Fix errant WARN_ONCE in rxe_completer()
  RDMA/rxe: Fix extra deref in rxe_rcv_mcast_pkt()
  RDMA/rxe: Fix missed IB reference counting in loopback
  RDMA/uverbs: Fix kernel-doc warning of _uverbs_alloc
  RDMA/mlx5: Set correct kernel-doc identifier
  IB/mlx5: Add missing error code
  RDMA/rxe: Fix missing kconfig dependency on CRYPTO
  RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep