]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
4 years agoMAINTAINERS: reorder media attributes
Mauro Carvalho Chehab [Wed, 22 Apr 2020 13:59:54 +0000 (15:59 +0200)]
MAINTAINERS: reorder media attributes

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

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

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

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

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

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

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

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

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

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

This ensures a more consistent numbering at the main index.

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

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

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

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

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

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

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

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

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

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

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

So, add a SPI card list there.

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

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

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

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

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

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

So, add a table for that.

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

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

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

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

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

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

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

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

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

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

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

Add a card list for it.

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

Add documentation for the remaining dvb-usb boards.

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

Document the supported dib0300 boards.

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

Document the cards supported by dib0700 driver.

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

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

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

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

Improve the docs to mention that.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix that.

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

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

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dt-bindings: media: convert rockchip rga bindings to yaml
Johan Jonker [Fri, 3 Apr 2020 13:06:06 +0000 (15:06 +0200)]
media: dt-bindings: media: convert rockchip rga bindings to yaml

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

Changed:
  Add missing reg property

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: support uv swapped planar formats
Dafna Hirschfeld [Sat, 11 Apr 2020 16:06:01 +0000 (18:06 +0200)]
media: staging: rkisp1: cap: support uv swapped planar formats

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

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: support uv swap only for semiplanar formats
Dafna Hirschfeld [Sat, 11 Apr 2020 16:06:00 +0000 (18:06 +0200)]
media: staging: rkisp1: cap: support uv swap only for semiplanar formats

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

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: change the logic for writing to uv swap register
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:59 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: change the logic for writing to uv swap register

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

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: fix value written to uv swap register in selfpath
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:58 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: fix value written to uv swap register in selfpath

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

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: cleanup in mainpath config for uv swap format
Dafna Hirschfeld [Sat, 11 Apr 2020 16:05:57 +0000 (18:05 +0200)]
media: staging: rkisp1: cap: cleanup in mainpath config for uv swap format

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

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-image-sizes: add HD and Full-HD definitions
Marco Felsch [Thu, 2 Apr 2020 08:49:57 +0000 (10:49 +0200)]
media: v4l2-image-sizes: add HD and Full-HD definitions

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

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

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

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: replace the call to v4l2_async_notifier_parse_fwnode_endpoint...
Dafna Hirschfeld [Tue, 17 Mar 2020 18:07:01 +0000 (19:07 +0100)]
media: staging: rkisp1: replace the call to v4l2_async_notifier_parse_fwnode_endpoints_by_port

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

Also remove the relevant item in the TODO file

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: remove mbus field from rkisp1_sensor_async
Dafna Hirschfeld [Tue, 17 Mar 2020 18:07:00 +0000 (19:07 +0100)]
media: staging: rkisp1: remove mbus field from rkisp1_sensor_async

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

enum v4l2_mbus_type mbus_type;
unsigned int mbus_flags;

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: serialize start/stop stream
Helen Koike [Mon, 16 Mar 2020 21:00:44 +0000 (22:00 +0100)]
media: staging: rkisp1: cap: serialize start/stop stream

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

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: fix return values from pm functions
Helen Koike [Mon, 16 Mar 2020 21:00:43 +0000 (22:00 +0100)]
media: staging: rkisp1: cap: fix return values from pm functions

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

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

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
Hans Verkuil [Tue, 3 Mar 2020 11:02:00 +0000 (12:02 +0100)]
media: v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()

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

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

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

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

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

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

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

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

Add labels to some undocumented registers.

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

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

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

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

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cx231xx: Add i2c device analog tuner support
Brad Love [Thu, 14 Nov 2019 20:04:05 +0000 (21:04 +0100)]
media: cx231xx: Add i2c device analog tuner support

The boards listed below use i2c device drivers and have
tuner_type equal TUNER_ABSENT. This means additional support
is required to enable the analog tuning capability, a case
statement is used to identify these models.

Models with analog tuning enabled:
- CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx (tested)
- CX231XX_BOARD_HAUPPAUGE_935C (tested)
- CX231XX_BOARD_HAUPPAUGE_955Q (tested)
- CX231XX_BOARD_HAUPPAUGE_975 (tested)
- CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD (untested)

The EvroMedia model was added, since it uses the si2157
tuner and the board profile claims it has analog inputs.

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

Hauppauge QuadHD/1265/5525 boards all use i2c device drivers and
have tuner_type equal TUNER_ABSENT. This means additional support
is required to enable the analog tuning capability, a case
statement is used to identify these models.

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

Enables the analog tuning frontend for Hauppauge HVR-5525.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cx23885: Add analog frontend to 1265_K4
Brad Love [Thu, 14 Nov 2019 20:04:02 +0000 (21:04 +0100)]
media: cx23885: Add analog frontend to 1265_K4

Enables the analog tuning frontend for Hauppauge HVR-1265_K4.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: cx23885: Add analog frontend to Hauppauge QuadHD
Brad Love [Thu, 14 Nov 2019 20:04:01 +0000 (21:04 +0100)]
media: cx23885: Add analog frontend to Hauppauge QuadHD

Add analog tuner frontend to 888 Hauppauge QuadHD boards

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: module debug option to wait on signal lock
Brad Love [Thu, 14 Nov 2019 20:04:00 +0000 (21:04 +0100)]
media: si2157: module debug option to wait on signal lock

In some debugging cases it is useful to know how long it took
signal lock to happen after tuning. This can help diagnose
line issues.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: Briefly wait for tuning operation to complete
Brad Love [Thu, 14 Nov 2019 20:03:59 +0000 (21:03 +0100)]
media: si2157: Briefly wait for tuning operation to complete

To detect errors in the tuning operation, this waits up 40ms for operation
completion status. This allows for error detection and prevents issuing
additional commands to the tuner before it is finished.

Tuning typically completes in 20-30ms.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: Add analog tuning related functions
Brad Love [Thu, 14 Nov 2019 20:03:58 +0000 (21:03 +0100)]
media: si2157: Add analog tuning related functions

Include set_analog_params, get_frequency, and get_bandwidth.

Tested with NTSC and PAL standards via ch3/4 generator. Other standards
are included, but are untested due to lack of generator.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: Better check for running tuner in init
Brad Love [Thu, 14 Nov 2019 20:03:57 +0000 (21:03 +0100)]
media: si2157: Better check for running tuner in init

Getting the Xtal trim property to check if running is less error prone.
Reset if_frequency if state is unknown.

Replaces the previous "garbage check".

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: Check error status bit on cmd execute
Brad Love [Thu, 14 Nov 2019 20:03:56 +0000 (21:03 +0100)]
media: si2157: Check error status bit on cmd execute

Check error status bit on command execute, if error bit is
set return -EAGAIN. Ignore -EAGAIN in probe during device check.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: Enable tuner status flags
Brad Love [Thu, 14 Nov 2019 20:03:55 +0000 (21:03 +0100)]
media: si2157: Enable tuner status flags

Enable flags to get status of commands sent to the tuner.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rkvdec: Add the rkvdec driver
Boris Brezillon [Fri, 3 Apr 2020 22:13:44 +0000 (00:13 +0200)]
media: rkvdec: Add the rkvdec driver

The rockchip vdec block is a stateless decoder that's able to decode
H264, HEVC and VP9 content. This commit adds the core infrastructure
and the H264 backend. Support for VP9 and HEVS will be added later on.

[mchehab+huawei@kernel.org: select MEDIA_CONTROLLER and REQUEST_API]
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-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>
4 years agomedia: dt-bindings: rockchip: Document RK3399 Video Decoder bindings
Boris Brezillon [Fri, 3 Apr 2020 22:13:43 +0000 (00:13 +0200)]
media: dt-bindings: rockchip: Document RK3399 Video Decoder bindings

Document the Rockchip RK3399 Video Decoder bindings.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: hantro: h264: Use the generic H264 reflist builder
Boris Brezillon [Fri, 3 Apr 2020 22:13:42 +0000 (00:13 +0200)]
media: hantro: h264: Use the generic H264 reflist builder

Now that the core provides generic reflist builders, we can use them
instead of implementing our own.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-core: Add helpers to build the H264 P/B0/B1 reflists
Boris Brezillon [Fri, 3 Apr 2020 22:13:41 +0000 (00:13 +0200)]
media: v4l2-core: Add helpers to build the H264 P/B0/B1 reflists

Building those list is a standard procedure described in section
'8.2.4 Decoding process for reference picture lists construction' of
the H264 specification.

We already have 2 drivers needing the same logic (hantro and rkvdec) and
I suspect we will soon have more.

Let's provide generic helpers to create those lists.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rkisp1: Fix wrong PHY config dependency
Ezequiel Garcia [Thu, 2 Apr 2020 19:45:04 +0000 (21:45 +0200)]
media: rkisp1: Fix wrong PHY config dependency

Instead of depending on the Rockchip PHY driver the ISP driver
should really depend on CONFIG_GENERIC_PHY_MIPI_DPHY,
given all it needs is the phy_mipi_dphy_get_default_config() symbol.

Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: phy-rockchip-dphy-rx0: Drop unneeded CONFIG_OF dependency
Ezequiel Garcia [Thu, 2 Apr 2020 19:45:03 +0000 (21:45 +0200)]
media: phy-rockchip-dphy-rx0: Drop unneeded CONFIG_OF dependency

The driver is perfectly capable of being built without CONFIG_OF.
Remove this dependency, which is useful for compile-only tests.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rkisp1: Get rid of unused variable warning
Ezequiel Garcia [Thu, 2 Apr 2020 19:45:02 +0000 (21:45 +0200)]
media: rkisp1: Get rid of unused variable warning

If CONFIG_OF is not selected, the compiler will complain:

drivers/staging/media/rkisp1/rkisp1-dev.c: In function â€˜rkisp1_probe’:
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: warning: unused variable â€˜node’ [-Wunused-variable]
  457 |  struct device_node *node = pdev->dev.of_node;

Rework the code slightly and make the compiler happy.

Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fh: define v4l2_fh struct regardless of condition
Seungchul Kim [Thu, 26 Mar 2020 09:09:46 +0000 (10:09 +0100)]
media: v4l2-fh: define v4l2_fh struct regardless of condition

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV.
If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module,
it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================
[    7.533506] v4l2_mem2mem: disagrees about version of symbol video_devdata
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)
===============================

So v4l2_fh struct is modified to does not have dependency
for CONFIG_V4L2_MEM2MEM_DEV.

Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: change fields names from fmt_type to pixel_enc
Dafna Hirschfeld [Mon, 6 Apr 2020 18:52:35 +0000 (20:52 +0200)]
media: staging: rkisp1: change fields names from fmt_type to pixel_enc

The fields 'fmt_type' in the structs
'rkisp1_rsz_config', 'rkisp1_isp_mbus_info' are of type
'v4l2_pixel_encoding' so it is nicer to change their name to
'pixel_enc'. Also change the define 'RKISP1_DEF_FMT_TYPE' to
'RKISP1_DEF_PIXEL_ENC'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: cap: remove field fmt_type from struct rkisp1_capture_fmt_cfg
Dafna Hirschfeld [Mon, 6 Apr 2020 18:52:34 +0000 (20:52 +0200)]
media: staging: rkisp1: cap: remove field fmt_type from struct rkisp1_capture_fmt_cfg

The pixel encoding can be retrieved from the cap->pix.info.
Therefore the field fmt_type can be removed from the
struct rkisp1_capture_fmt_cfg.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: replace rkisp1_fmt_pix_type with v4l2_pixel_encoding
Dafna Hirschfeld [Mon, 6 Apr 2020 18:52:33 +0000 (20:52 +0200)]
media: staging: rkisp1: replace rkisp1_fmt_pix_type with v4l2_pixel_encoding

The enum rkisp1_fmt_pix_type that holds the pixel format
which is one of RGB, YUV, BAYER, can be replace by the
v4l2 enum v4l2_pixel_encoding.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: platform: fcp: Set appropriate DMA parameters
Kieran Bingham [Tue, 7 Apr 2020 15:44:17 +0000 (17:44 +0200)]
media: platform: fcp: Set appropriate DMA parameters

Enabling CONFIG_DMA_API_DEBUG=y and CONFIG_DMA_API_DEBUG_SG=y will
enable extra validation on DMA operations ensuring that the size
restraints are met.

When using the FCP in conjunction with the VSP1/DU, and display frames,
the size of the DMA operations is larger than the default maximum
segment size reported by the DMA core (64K). With the DMA debug enabled,
this produces a warning such as the following:

"DMA-API: rcar-fcp fea27000.fcp: mapping sg segment longer than device
claims to support [len=3145728] [max=65536]"

We have no specific limitation on the segment size which isn't already
handled by the VSP1/DU which actually handles the DMA allcoations and
buffer management, so define a maximum segment size of up to 4GB (a 32
bit mask).

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: 7b49235e83b2 ("[media] v4l: Add Renesas R-Car FCP driver")
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: rkisp1: remove TODO item - uapi structs compatibility
Dafna Hirschfeld [Tue, 7 Apr 2020 17:25:22 +0000 (19:25 +0200)]
media: staging: rkisp1: remove TODO item - uapi structs compatibility

remove the TODO item:

* Make sure uapi structs have the same size and layout in 32 and 62 bits,
and that there are no holes in the structures (pahole is a utility that
can be used to test this).

It was tested with pahole and found compatible.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vicodec: Fix error codes in probe function
Dan Carpenter [Tue, 7 Apr 2020 09:32:37 +0000 (11:32 +0200)]
media: vicodec: Fix error codes in probe function

If these functions fail then we return success, but we should instead
preserve negative error code and return that.

Fixes: fde649b418d1 ("media: vicodec: Register another node for stateless decoder")
Fixes: c022a4a95722 ("media: vicodec: add struct for encoder/decoder instance")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx.rst: Provide streaming examples for imx6q-sabresd
Fabio Estevam [Thu, 9 Apr 2020 16:29:45 +0000 (18:29 +0200)]
media: imx.rst: Provide streaming examples for imx6q-sabresd

Improve the documentation by providing examples on how to test camera
capture on imx6q-sabresd via v4l2-ctl and Gstreamer.

Signed-off-by: Fabio Estevam <festevam@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>
4 years agomedia: imx.rst: Provide the OV560 module part number
Fabio Estevam [Thu, 9 Apr 2020 16:29:44 +0000 (18:29 +0200)]
media: imx.rst: Provide the OV560 module part number

In order to improve the documentation, provide the OV5640 MIPI module
part number that is used on the imx6q-sabresd board.

Signed-off-by: Fabio Estevam <festevam@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>
4 years agomedia: imx.rst: Provide an example for unprocessed video capture
Fabio Estevam [Thu, 9 Apr 2020 16:29:43 +0000 (18:29 +0200)]
media: imx.rst: Provide an example for unprocessed video capture

The current example for imx6q-sabresd is for a direct conversion pipeline.

Provide an extra example using unprocessed video capture for completeness.

Signed-off-by: Fabio Estevam <festevam@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>
4 years agomedia: imx.rst: Fix the MIPI CSI-2 virtual channel
Fabio Estevam [Thu, 9 Apr 2020 16:29:42 +0000 (18:29 +0200)]
media: imx.rst: Fix the MIPI CSI-2 virtual channel

The current instructions for imx6q-sabresd do not lead to functional
capture on OV5640 MIPI CSI-2.

The reason for this, as explained by Steve Longerbeam, is that OV5640 by
default transmits on virtual channel 0, not channel 1 as is given in the
instructions.

Adapt the instructions to use virtual channel 0 so that a working
camera setup can be achieved on imx6q-sabresd.

Also, since we are using an IC direct conversion pipeline, improve
the example by demonstrating colorspace and scaling.

Signed-off-by: Fabio Estevam <festevam@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>
4 years agomedia: uapi: h264: Add new profile and levels
Maheshwar Ajja [Tue, 7 Apr 2020 21:55:26 +0000 (23:55 +0200)]
media: uapi: h264: Add new profile and levels

Add H264 profile "Contrained High" and H264 levels "5.2",
"6.0", "6.1" and "6.2".

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrl: Add H264 profile and levels
Maheshwar Ajja [Mon, 16 Mar 2020 22:42:30 +0000 (23:42 +0100)]
media: v4l2-ctrl: Add H264 profile and levels

Add H264 profile "Contrained High" and H264 levels "5.2",
"6.0", "6.1" and "6.2".

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx-media-csc-scaler: Use a shorter name for driver
Fabio Estevam [Wed, 8 Apr 2020 13:10:05 +0000 (15:10 +0200)]
media: imx-media-csc-scaler: Use a shorter name for driver

Currently v4l2-compliance tool returns the following output:

Compliance test for imx-media-csc-s device /dev/video8:

Driver Info:
        Driver name      : imx-media-csc-s
        Card type        : imx-media-csc-scaler
        Bus info         : platform:imx-media-csc-scaler

The driver name string is limited to 16 characters, so provide
a shorter name in order to get a better output.

While at it, use the same shorter name for driver, card and platform.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: gspca: remove redundant assignment to variable status
Colin Ian King [Fri, 10 Apr 2020 14:18:13 +0000 (16:18 +0200)]
media: gspca: remove redundant assignment to variable status

The variable status is being assigned a value that is never read.
The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.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>
4 years agomedia: pwc-ctl: remove redundant assignment to variable ret
Colin Ian King [Fri, 10 Apr 2020 13:50:14 +0000 (15:50 +0200)]
media: pwc-ctl: remove redundant assignment to variable ret

The variable ret 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.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.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>
4 years agomedia: mtk-mdp: Use correct aliases name
Hsin-Yi Wang [Tue, 14 Apr 2020 03:08:15 +0000 (05:08 +0200)]
media: mtk-mdp: Use correct aliases name

aliases property name must include only lowercase and '-'. Fix in dts
and driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: davinci: remove redundant assignment to pointer 'common'
Colin Ian King [Wed, 15 Apr 2020 22:54:11 +0000 (00:54 +0200)]
media: davinci: remove redundant assignment to pointer 'common'

The pointer 'common' is being assigned with a value that is never read,
the assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

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>
4 years agomedia: imx: utils: Constify some mbus and ipu_image arguments
Laurent Pinchart [Mon, 6 Apr 2020 16:39:05 +0000 (18:39 +0200)]
media: imx: utils: Constify some mbus and ipu_image arguments

The imx_media_mbus_fmt_to_pix_fmt() and imx_media_mbus_fmt_to_ipu_image()
functions do not need to modify their mbus argument, and
imx_media_ipu_image_to_mbus_fmt() does not need to modify its ipu_image
argument. Make them const.

[slongerbeam@gmail.com: Constified mbus arg to
 imx_media_mbus_fmt_to_ipu_image(), and ipu_image
 arg to imx_media_ipu_image_to_mbus_fmt(), as well]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Rename format lookup and enumeration functions
Laurent Pinchart [Mon, 6 Apr 2020 16:39:04 +0000 (18:39 +0200)]
media: imx: utils: Rename format lookup and enumeration functions

Rename the format lookup and enumeration functions according to their
usage:

- Rename imx_media_(find|enum)_format() to *_pixel_format() to
  explicitly state on what formats the functions operate. This aligns
  the naming scheme with the media bus and IPU format functions that
  already end with *_mbus_format() and *_ipu_formats().

- Rename all enumeration functions to pluralize 'formats' at the end, as
  they enumerate multiple formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Split find|enum_format into fourcc and mbus functions
Steve Longerbeam [Mon, 6 Apr 2020 16:39:03 +0000 (18:39 +0200)]
media: imx: utils: Split find|enum_format into fourcc and mbus functions

To make the code easier to follow, split up find_format() into separate
search functions for pixel formats and media-bus codes, and inline
find_format() into the exported functions imx_media_find_format()
and imx_media_find_mbus_format().

Do the equivalent for enum_format().

Also add comment blocks for the exported find|enum functions.

The convenience functions imx_media_find_ipu_format() and
imx_media_enum_ipu_format() can now be made inline and moved to
imx-media.h.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Make imx_media_pixfmt handle variable number of codes
Laurent Pinchart [Mon, 6 Apr 2020 16:39:02 +0000 (18:39 +0200)]
media: imx: utils: Make imx_media_pixfmt handle variable number of codes

The imx_media_pixfmt structures include a codes member that stores
media bus codes as a fixed array of 4 integers. The functions dealing
with the imx_media_pixfmt structures assume that the array of codes is
terminated by a 0 element. This mechanism is fragile, as demonstrated
by several instances of the structure containing 4 non-zero codes.

Fix this by turning the array into a pointer, and providing an
IMX_BUS_FMTS macro to initialize the codes member with a guaranteed 0
element at the end.

[Fixed a NULL deref of the codes pointer in a couple places]
[Added more comments for the struct imx_media_pixfmt members,
 including a bold NOTE! for future developers that codes pointer
 is NULL for the in-memory-only formats]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Introduce PIXFMT_SEL_IPU
Steve Longerbeam [Mon, 6 Apr 2020 16:39:01 +0000 (18:39 +0200)]
media: imx: utils: Introduce PIXFMT_SEL_IPU

Add a PIXFMT_SEL_IPU selection flag, to select only the IPU-internal
pixel formats, and move the single-entry IPU-internal pixel format
arrays into pixel_formats[]. imx_media_find_ipu_format() and
imx_media_enum_ipu_format() can now simply call find_format() and
enum_format().

The RGB32 format is both an IPU-internal format, and an in-memory format
via idmac channels that is supported by the IPUv3 driver, so it appears
twice in pixel_formats[], one with ipufmt=false for the in-memory format,
and again with ipufmt=true for the IPU-internal format.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Rename pixel format selection enumeration
Steve Longerbeam [Mon, 6 Apr 2020 16:39:00 +0000 (18:39 +0200)]
media: imx: utils: Rename pixel format selection enumeration

After the introduction of the CS_SEL_BAYER flag, the "codespace"
pixel format selection enumeration wording no longer makes sense
(and even before, when selecting between YUV or RGB formats,
"codespace" was a misuse of the term).

Rename

- 'enum codespace_sel' to 'enum imx_pixfmt_sel'
- CS_SEL_* to PIXFMT_SEL_*
- local vars named cs_sel to fmt_sel or just sel

No functional changes.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: Fix some pixel format selections
Steve Longerbeam [Mon, 6 Apr 2020 16:38:59 +0000 (18:38 +0200)]
media: imx: Fix some pixel format selections

- imx_media_capture_device_register() needs to use CS_SEL_ANY when
  finding the format from the attached source subdevice, because the
  source can be a CSI which supports bayer, and the CSI may have selected
  a bayer format when it registered.

- Likewise, imx_media_init_mbus_fmt() is called from the CSI, so the
  function may be passed a bayer code. Use CS_SEL_ANY when locating
  the format.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Handle Bayer format lookup through a selection flag
Laurent Pinchart [Mon, 6 Apr 2020 16:38:58 +0000 (18:38 +0200)]
media: imx: utils: Handle Bayer format lookup through a selection flag

The format lookup (and enumeration) functions take a boolean flag to
tell if Bayer formats should be considered. This leads to hard to read
lines such as

return enum_format(fourcc, NULL, index, cs_sel, true, false);

where the boolean parameters can easily be mixed. To make the code
clearer, add a CS_SEL_BAYER flag that can be passed through the
codespace_sel parameter of the lookup functions to replace the bool
parameter.

[slongerbeam@gmail.com: Instead of declaring CS_SEL_ANY as a bitfield
 containing only CS_SEL_YUV | CS_SEL_RGB, declare CS_SEL_ANY as all of
 the above (YUV, RGB, BAYER). A new enum is declared for the YUV | RGB
 selection as CS_SEL_YUV_RGB, and that is used by sub-devices that
 don't support BAYER and only allow selecting and enumerating YUV or RGB
 encodings. CS_SEL_ANY is now only used by the CSI sub-devices and the
 attached capture interfaces, since only those devices support BAYER
 formats.]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: Inline init_mbus_colorimetry() in its caller
Laurent Pinchart [Mon, 6 Apr 2020 16:38:57 +0000 (18:38 +0200)]
media: imx: utils: Inline init_mbus_colorimetry() in its caller

The init_mbus_colorimetry() function is small and used in a single
place. The code becomes easier to follow if it gets inline in its
caller. Do so.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: fix media bus format enumeration
Philipp Zabel [Tue, 14 Apr 2020 21:23:38 +0000 (23:23 +0200)]
media: imx: utils: fix media bus format enumeration

Iterate over all media bus formats, not just over the first format in
each imx_media_pixfmt entry.

Before:

  $ v4l2-ctl -d $(media-ctl -e ipu1_csi0) --list-subdev-mbus-codes 0
  ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
0x2006: MEDIA_BUS_FMT_UYVY8_2X8
0x2008: MEDIA_BUS_FMT_YUYV8_2X8
0x1008: MEDIA_BUS_FMT_RGB565_2X8_LE
0x100a: MEDIA_BUS_FMT_RGB888_1X24
0x100d: MEDIA_BUS_FMT_ARGB8888_1X32
0x3001: MEDIA_BUS_FMT_SBGGR8_1X8
0x3013: MEDIA_BUS_FMT_SGBRG8_1X8
0x3002: MEDIA_BUS_FMT_SGRBG8_1X8
0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
0x300e: MEDIA_BUS_FMT_SGBRG10_1X10
0x300a: MEDIA_BUS_FMT_SGRBG10_1X10
0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
0x2001: MEDIA_BUS_FMT_Y8_1X8
0x200a: MEDIA_BUS_FMT_Y10_1X10

After:

  $ v4l2-ctl -d $(media-ctl -e ipu1_csi0) --list-subdev-mbus-codes 0
  ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
0x2006: MEDIA_BUS_FMT_UYVY8_2X8
0x200f: MEDIA_BUS_FMT_UYVY8_1X16
0x2008: MEDIA_BUS_FMT_YUYV8_2X8
0x2011: MEDIA_BUS_FMT_YUYV8_1X16
0x1008: MEDIA_BUS_FMT_RGB565_2X8_LE
0x100a: MEDIA_BUS_FMT_RGB888_1X24
0x100c: MEDIA_BUS_FMT_RGB888_2X12_LE
0x100d: MEDIA_BUS_FMT_ARGB8888_1X32
0x3001: MEDIA_BUS_FMT_SBGGR8_1X8
0x3013: MEDIA_BUS_FMT_SGBRG8_1X8
0x3002: MEDIA_BUS_FMT_SGRBG8_1X8
0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
0x3008: MEDIA_BUS_FMT_SBGGR12_1X12
0x3019: MEDIA_BUS_FMT_SBGGR14_1X14
0x301d: MEDIA_BUS_FMT_SBGGR16_1X16
0x300e: MEDIA_BUS_FMT_SGBRG10_1X10
0x3010: MEDIA_BUS_FMT_SGBRG12_1X12
0x301a: MEDIA_BUS_FMT_SGBRG14_1X14
0x301e: MEDIA_BUS_FMT_SGBRG16_1X16
0x300a: MEDIA_BUS_FMT_SGRBG10_1X10
0x3011: MEDIA_BUS_FMT_SGRBG12_1X12
0x301b: MEDIA_BUS_FMT_SGRBG14_1X14
0x301f: MEDIA_BUS_FMT_SGRBG16_1X16
0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
0x3012: MEDIA_BUS_FMT_SRGGB12_1X12
0x301c: MEDIA_BUS_FMT_SRGGB14_1X14
0x3020: MEDIA_BUS_FMT_SRGGB16_1X16
0x2001: MEDIA_BUS_FMT_Y8_1X8
0x200a: MEDIA_BUS_FMT_Y10_1X10
0x2013: MEDIA_BUS_FMT_Y12_1X12

[laurent.pinchart@ideasonboard.com: Decrement index to replace loop counter k]
[laurent.pinchart@ideasonboard.com: Return directly from within the loops]

Fixes: e130291212df5 ("[media] media: Add i.MX media core driver")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: utils: fix and simplify pixel format enumeration
Philipp Zabel [Tue, 14 Apr 2020 21:20:29 +0000 (23:20 +0200)]
media: imx: utils: fix and simplify pixel format enumeration

Merge yuv_formats and rgb_formats into a single array. Always loop over
all entries, skipping those that do not match the requested search
criteria. This simplifies the code, lets us get rid of the manual
counting of array entries, and stops accidentally ignoring some non-mbus
RGB formats.

Before:

  $ v4l2-ctl -d /dev/video14 --list-formats-out
  ioctl: VIDIOC_ENUM_FMT
Type: Video Output

[0]: 'UYVY' (UYVY 4:2:2)
[1]: 'YUYV' (YUYV 4:2:2)
[2]: 'YU12' (Planar YUV 4:2:0)
[3]: 'YV12' (Planar YVU 4:2:0)
[4]: '422P' (Planar YUV 4:2:2)
[5]: 'NV12' (Y/CbCr 4:2:0)
[6]: 'NV16' (Y/CbCr 4:2:2)
[7]: 'RGBP' (16-bit RGB 5-6-5)
[8]: 'RGB3' (24-bit RGB 8-8-8)
[9]: 'BX24' (32-bit XRGB 8-8-8-8)

After:

  $ v4l2-ctl -d /dev/video14 --list-formats-out
  ioctl: VIDIOC_ENUM_FMT
Type: Video Output

[0]: 'UYVY' (UYVY 4:2:2)
[1]: 'YUYV' (YUYV 4:2:2)
[2]: 'YU12' (Planar YUV 4:2:0)
[3]: 'YV12' (Planar YVU 4:2:0)
[4]: '422P' (Planar YUV 4:2:2)
[5]: 'NV12' (Y/CbCr 4:2:0)
[6]: 'NV16' (Y/CbCr 4:2:2)
[7]: 'RGBP' (16-bit RGB 5-6-5)
[8]: 'RGB3' (24-bit RGB 8-8-8)
[9]: 'BGR3' (24-bit BGR 8-8-8)
[10]: 'BX24' (32-bit XRGB 8-8-8-8)
[11]: 'XR24' (32-bit BGRX 8-8-8-8)
[12]: 'RX24' (32-bit XBGR 8-8-8-8)
[13]: 'XB24' (32-bit RGBX 8-8-8-8)

Tested on a imx6q-sabresd.

[laurent.pinchart@ideasonboard.com: Make loop counters unsigned]
[laurent.pinchart@ideasonboard.com: Decrement index instead of adding a counter]
[laurent.pinchart@ideasonboard.com: Return directly from within loop instead of breaking]
[slongerbeam@gmail.com: Fix colorspace comparison error]

Fixes: e130291212df5 ("[media] media: Add i.MX media core driver")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ir-rx51: Use 64-bit division macro
Guru Das Srinagesh [Thu, 9 Apr 2020 06:52:32 +0000 (08:52 +0200)]
media: ir-rx51: Use 64-bit division macro

Since the PWM framework is switching struct pwm_state.period's datatype
to u64, prepare for this transition by using DIV_ROUND_CLOSEST_ULL to
handle a 64-bit dividend.

Cc: Richard Fontana <rfontana@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Allison Randal <allison@lohutok.net>
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: m88ds3103: Add missing '\n' in log messages
Christophe JAILLET [Sat, 11 Apr 2020 14:27:29 +0000 (16:27 +0200)]
media: m88ds3103: Add missing '\n' in log messages

Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'.

While at it, change the log level from 'err' to 'debug'.

Fixes: e6089feca460 ("media: m88ds3103: Add support for ds3103b demod")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dvb-usb: make dvb_usb_device_properties const
Sean Young [Tue, 14 Apr 2020 10:10:43 +0000 (12:10 +0200)]
media: dvb-usb: make dvb_usb_device_properties const

This makes it possible to declare dvb_usb_device_properties const.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dvb: return -EREMOTEIO on i2c transfer failure.
Colin Ian King [Mon, 10 Feb 2020 17:51:33 +0000 (18:51 +0100)]
media: dvb: return -EREMOTEIO on i2c transfer failure.

Currently when i2c transfers fail the error return -EREMOTEIO
is assigned to err but then later overwritten when the tuner
attach call is made.  Fix this by returning early with the
error return code -EREMOTEIO on i2c transfer failure errors.

If the transfer fails, an uninitialized value will be read from b2.

Addresses-Coverity: ("Unused value")

Fixes: fbfee8684ff2 ("V4L/DVB (5651): Dibusb-mb: convert pll handling to properly use dvb-pll")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>