platform/kernel/linux-rpi.git
4 years agomedia: vimc: cap: Report a colorspace
Niklas Söderlund [Fri, 17 Apr 2020 15:09:29 +0000 (17:09 +0200)]
media: vimc: cap: Report a colorspace

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

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

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: si2157: ensure wait_status is initialized
Sean Young [Wed, 22 Apr 2020 19:16:46 +0000 (21:16 +0200)]
media: si2157: ensure wait_status is initialized

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

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

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

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

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

Bail out if registers can not be updated.

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

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

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

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

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

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

Detected via randconfig builds.

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

As detected by a randconfig:

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

There's a missing dependency on VIDEO_V4L2 for VIA_CAMERA.

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

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

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

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

on x86_64:
CONFIG_VIDEO_V4L2=m
CONFIG_MEDIA_TUNER_E4000=y

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

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

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

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

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

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

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

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

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

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

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

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

This ensures a more consistent numbering at the main index.

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

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

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

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

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

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

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

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

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

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

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

So, add a SPI card list there.

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

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

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

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

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

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

So, add a table for that.

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

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

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

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

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

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

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

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

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

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

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

Add a card list for it.

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

Add documentation for the remaining dvb-usb boards.

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

Document the supported dib0300 boards.

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

Document the cards supported by dib0700 driver.

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

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

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

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

Improve the docs to mention that.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix that.

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

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

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

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

Changed:
  Add missing reg property

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also remove the relevant item in the TODO file

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

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

enum v4l2_mbus_type mbus_type;
unsigned int mbus_flags;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add labels to some undocumented registers.

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

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

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

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

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