OSDN Git Service

android-x86/kernel.git
5 years agomedia: ov9650: avoid maybe-uninitialized warnings
Arnd Bergmann [Wed, 26 Sep 2018 12:51:01 +0000 (08:51 -0400)]
media: ov9650: avoid maybe-uninitialized warnings

The regmap change causes multiple warnings like

drivers/media/i2c/ov9650.c: In function 'ov965x_g_volatile_ctrl':
drivers/media/i2c/ov9650.c:889:29: error: 'reg2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   exposure = ((reg2 & 0x3f) << 10) | (reg1 << 2) |
              ~~~~~~~~~~~~~~~^~~~~~

It is apparently hard for the compiler to see here if ov965x_read()
returned successfully or not. Besides, we have a v4l2_dbg() statement
that prints an uninitialized value if regmap_read() fails.

Adding an 'else' clause avoids the ambiguity.

Fixes: 361f3803adfe ("media: ov9650: use SCCB regmap")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx355: fix a few coding style issues
Mauro Carvalho Chehab [Fri, 5 Oct 2018 14:18:05 +0000 (10:18 -0400)]
media: imx355: fix a few coding style issues

Function alignments are off by 1 space, as reported by
checkpatch.pl --strict.

Fix those.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add imx355 camera sensor driver
Bingbu Cao [Sat, 29 Sep 2018 10:03:54 +0000 (06:03 -0400)]
media: add imx355 camera sensor driver

Add a v4l2 sub-device driver for the Sony imx355 image sensor.
This is a camera sensor using the i2c bus for control and the
csi-2 bus for data.

This driver supports following features:

- manual exposure and analog/digital gain control support
- vblank/hblank control support
- 4 test patterns control support
- vflip/hflip control support (will impact the output bayer order)
- support following resolutions:
    - 3268x2448, 3264x2448, 3280x2464 @ 30fps
    - 1940x1096, 1936x1096, 1924x1080, 1920x1080 @ 60fps
    - 1640x1232, 1640x922, 1300x736, 1296x736,
      1284x720, 1280x720 820x616 @ 120fps
- support 4 bayer orders output (via change v/hflip)
    - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10

[Sakari Ailus: Use do_div() for dividing 64-bit numbers, fix fwnode if usage]

Cc: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx319: fix a few coding style issues
Mauro Carvalho Chehab [Fri, 5 Oct 2018 14:11:43 +0000 (10:11 -0400)]
media: imx319: fix a few coding style issues

Function alignments are off by 1 space, as reported by
checkpatch.pl --strict.

Fix those.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add imx319 camera sensor driver
Bingbu Cao [Wed, 26 Sep 2018 02:42:18 +0000 (22:42 -0400)]
media: add imx319 camera sensor driver

Add a v4l2 sub-device driver for the Sony imx319 image sensor.
This is a camera sensor using the i2c bus for control and the
csi-2 bus for data.

This driver supports following features:
- manual exposure and analog/digital gain control support
- vblank/hblank control support
-  4 test patterns control support
- vflip/hflip control support (will impact the output bayer order)
- support following resolutions:
    - 3264x2448, 3280x2464 @ 30fps
    - 1936x1096, 1920x1080 @ 60fps
    - 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps
- support 4 bayer orders output (via change v/hflip)
    - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10

[Sakari Ailus: Replace 64-bit division by do_div(), fix fwnode if usage]

Cc: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: ctrl: Provide unlocked variant of v4l2_ctrl_grab
Sakari Ailus [Thu, 19 Jul 2018 11:11:40 +0000 (07:11 -0400)]
media: v4l: ctrl: Provide unlocked variant of v4l2_ctrl_grab

Sometimes it may be necessary to grab a control while holding the control
handler's lock. Provide an unlocked variant of v4l2_ctrl_grab for the
purpose --- it's called __v4l2_ctrl_grab.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: ctrl: Remove old documentation from v4l2_ctrl_grab
Sakari Ailus [Thu, 19 Jul 2018 11:10:50 +0000 (07:10 -0400)]
media: v4l: ctrl: Remove old documentation from v4l2_ctrl_grab

v4l2_ctrl_grab() is documented in the header; there's no need to have a
comment explaining what the function does in the .c file.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: MAINTAINERS: Fix entry for the renamed dw9807 driver
Sakari Ailus [Sat, 29 Sep 2018 16:41:17 +0000 (12:41 -0400)]
media: MAINTAINERS: Fix entry for the renamed dw9807 driver

The driver for the dw9807 voice coil was renamed as dw9807-vcm.c to
reflect the fact that the chip also contains an EEPROM. While there is no
EEPROM (nor MFD) driver yet and it may not be ever even needed, the driver
was renamed accordingly. But the MAINTAINERS entry was not. Fix this.

Fixes: e6c17ada3188 ("media: dw9807-vcm: Recognise this is just the VCM bit of the device")

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: MAINTAINERS: update videobuf2 entry
Marek Szyprowski [Fri, 5 Oct 2018 08:01:41 +0000 (04:01 -0400)]
media: MAINTAINERS: update videobuf2 entry

Commits 03fbdb2fc2b8 ("media: move videobuf2 to drivers/media/common")
and 7952be9b6ece ("media: drivers/media/common/videobuf2: rename from
videobuf") moved videobuf2 framework source code finally to
drivers/media/common/videobuf2 directory, so update relevant paths in
MAINTAINERS file.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: mce_kbd: input events via rc-core's input device
Sean Young [Tue, 18 Sep 2018 14:29:29 +0000 (10:29 -0400)]
media: rc: mce_kbd: input events via rc-core's input device

There is no need to create another input device.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: imon: report mouse events using rc-core's input device
Sean Young [Sun, 16 Sep 2018 11:35:58 +0000 (07:35 -0400)]
media: rc: imon: report mouse events using rc-core's input device

There is no need to create another input device.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: some events are dropped by userspace
Sean Young [Tue, 18 Sep 2018 08:50:20 +0000 (04:50 -0400)]
media: rc: some events are dropped by userspace

libevdev (which is used by libinput) gets a list of keycodes from the
input device on creation. Any events with keycodes which are not in this
list are silently dropped. So, set all keycodes on device creation since
we do not know which will be used if the keymap changes.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: simplify v4l2_fwnode_reference_parse_int_props() call
Mauro Carvalho Chehab [Thu, 4 Oct 2018 21:55:06 +0000 (17:55 -0400)]
media: v4l2-fwnode: simplify v4l2_fwnode_reference_parse_int_props() call

The v4l2_fwnode_reference_parse_int_props() has a big name, causing
it to cause coding style warnings. Also, it depends on a const
struct embedded indide a function.

Rearrange the logic in order to move the struct declaration out
of such function and use it inside this function.

That cleans up some coding style issues.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: cleanup functions that parse endpoints
Mauro Carvalho Chehab [Thu, 4 Oct 2018 21:41:16 +0000 (17:41 -0400)]
media: v4l2-fwnode: cleanup functions that parse endpoints

There is already a typedef for the parse endpoint function.
However, instead of using it, it is redefined at the C file
(and on one of the function headers).

Replace them by the function typedef, in order to cleanup
several related coding style warnings.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-core: cleanup coding style at V4L2 async/fwnode
Mauro Carvalho Chehab [Thu, 4 Oct 2018 21:10:46 +0000 (17:10 -0400)]
media: v4l2-core: cleanup coding style at V4L2 async/fwnode

There are several coding style issues at those definitions,
and the previous patchset added even more.

Address the trivial ones by first calling:

./scripts/checkpatch.pl --strict --fix-inline include/media/v4l2-async.h include/media/v4l2-fwnode.h include/media/v4l2-mediabus.h drivers/media/v4l2-core/v4l2-async.c drivers/media/v4l2-core/v4l2-fwnode.c

and then manually adjusting the style where needed.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: renesas-ceu: Use default mbus settings
Jacopo Mondi [Thu, 13 Sep 2018 13:59:51 +0000 (09:59 -0400)]
media: renesas-ceu: Use default mbus settings

As the v4l2-fwnode now allows drivers to set defaults, and eventually
override them by specifying properties in DTS, use defaults for the CEU
driver.

Also remove endpoint properties from the gr-peach-audiocamerashield as
they match the defaults now specified in the driver code
(h/vsync-active and bus-width) or are not relevant to the interface
as they cannot be configured (pclk-sample).

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: renesas-ceu: Add more endpoint properties
Jacopo Mondi [Thu, 13 Sep 2018 13:59:50 +0000 (09:59 -0400)]
media: dt-bindings: media: renesas-ceu: Add more endpoint properties

As the v4l2-fwnode framework now allows specifying defaults configurations,
expand the description of the optional endpoint properties for the CEU
interface to better explain which are their defaults values.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: renesas-ceu: Refer to video-interfaces.txt
Jacopo Mondi [Thu, 13 Sep 2018 13:59:49 +0000 (09:59 -0400)]
media: dt-bindings: media: renesas-ceu: Refer to video-interfaces.txt

Refer to video-interfaces.txt when describing standard properties.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: smiapp: Query the V4L2 endpoint for a specific bus type
Sakari Ailus [Mon, 16 Apr 2018 20:56:51 +0000 (16:56 -0400)]
media: smiapp: Query the V4L2 endpoint for a specific bus type

Instead of opportunistically trying to gather some information from the
V4L2 endpoint, set the bus type and let the V4L2 fwnode framework figure
out the configuration.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Update V4L2 fwnode endpoint parsing documentation
Sakari Ailus [Wed, 18 Jul 2018 10:09:57 +0000 (06:09 -0400)]
media: v4l: fwnode: Update V4L2 fwnode endpoint parsing documentation

The semantics of v4l2_fwnode_endpoint_parse() and
v4l2_fwnode_endpoint_alloc_parse() have changed slightly: they now take
the bus type from the user as well as a default configuration for the bus
that shall reflect the DT binding defaults. Document this.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Support parsing of CSI-2 C-PHY endpoints
Sakari Ailus [Mon, 23 Jul 2018 13:09:28 +0000 (09:09 -0400)]
media: v4l: fwnode: Support parsing of CSI-2 C-PHY endpoints

The V4L2 fwnode framework only parsed CSI-2 D-PHY endpoints while C-PHY
support wasn't there. Also parse endpoints for media bus type
V4L2_MBUS_CSI2_CPHY.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Use V4L2 fwnode endpoint media bus type if set
Sakari Ailus [Thu, 19 Jul 2018 15:22:49 +0000 (11:22 -0400)]
media: v4l: fwnode: Use V4L2 fwnode endpoint media bus type if set

Use the given media bus type set by the caller. If none is given (i.e. the
mbus type is V4L2_MBUS_UNKNOWN, or 0), fall back to the old behaviour.
This is to obtain the information from the DT or try to guess the bus
type.

-ENXIO is returned if the caller sets the bus type but that does not match
with what's in DT. Also return -ENXIO if bus type detection failed to
separate this from the rest of the errors.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Print bus type
Sakari Ailus [Tue, 2 Jan 2018 15:44:34 +0000 (10:44 -0500)]
media: v4l: fwnode: Print bus type

Print bus type either as set by the driver or as parsed from the bus-type
property, as well as the guessed V4L2 media bus type.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Use default parallel flags
Sakari Ailus [Tue, 3 Jul 2018 11:09:25 +0000 (07:09 -0400)]
media: v4l: fwnode: Use default parallel flags

The caller may provide default flags for the endpoint. Change the
configuration based on what is available through the fwnode property API.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Use media bus type for bus parser selection
Sakari Ailus [Tue, 17 Jul 2018 16:17:02 +0000 (12:17 -0400)]
media: v4l: fwnode: Use media bus type for bus parser selection

Use the media bus types instead of the fwnode bus types internally. This
is the interface to the drivers as well, making the use of the fwnode bus
types more localised to the V4L2 fwnode framework.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Only zero the struct if bus type is set to V4L2_MBUS_UNKNOWN
Sakari Ailus [Tue, 31 Jul 2018 09:21:53 +0000 (05:21 -0400)]
media: v4l: fwnode: Only zero the struct if bus type is set to V4L2_MBUS_UNKNOWN

In order to prepare for allowing drivers to set the defaults for a given
bus, make zeroing the struct conditional based on detecting the bus.
All callers now set the bus type to zero which allows only zeroing the
remaining bus union.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero
Sakari Ailus [Tue, 31 Jul 2018 09:15:50 +0000 (05:15 -0400)]
media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero

Initialise the V4L2 fwnode endpoints to zero in all drivers using
v4l2_fwnode_endpoint_parse(). This prepares for setting default endpoint
flags as well as the bus type. Setting bus type to zero will continue to
guess the bus among the guessable set (parallel, Bt.656 and CSI-2 D-PHY).

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Parse the graph endpoint as last
Sakari Ailus [Wed, 18 Jul 2018 13:20:34 +0000 (09:20 -0400)]
media: v4l: fwnode: Parse the graph endpoint as last

Parsing the graph endpoint is always successful; therefore parse it as
last.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Support default CSI-2 lane mapping for drivers
Sakari Ailus [Fri, 20 Jul 2018 13:57:48 +0000 (09:57 -0400)]
media: v4l: fwnode: Support default CSI-2 lane mapping for drivers

Most hardware doesn't support re-mapping of the CSI-2 lanes. Especially
sensor drivers have a default number of lanes. Instead of requiring the
caller (the driver) to provide such a unit mapping, provide one if no
mapping is configured.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Support driver-defined lane mapping defaults
Sakari Ailus [Fri, 20 Jul 2018 10:14:14 +0000 (06:14 -0400)]
media: v4l: fwnode: Support driver-defined lane mapping defaults

Make use of the default CSI-2 lane mapping from caller-passed
configuration.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Only assign configuration if there is no error
Sakari Ailus [Tue, 3 Jul 2018 11:06:20 +0000 (07:06 -0400)]
media: v4l: fwnode: Only assign configuration if there is no error

Only assign endpoint configuration if the endpoint is parsed successfully.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Read lane inversion information despite lane numbering
Sakari Ailus [Wed, 18 Jul 2018 13:33:45 +0000 (09:33 -0400)]
media: v4l: fwnode: Read lane inversion information despite lane numbering

Read the lane inversion independently of whether the "data-lanes" property
exists. This makes sense since the caller may pass the number of lanes as
the default configuration while the lane inversion configuration may still
be available in firmware.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Make use of newly specified bus types
Sakari Ailus [Tue, 2 Jan 2018 13:14:30 +0000 (08:14 -0500)]
media: v4l: fwnode: Make use of newly specified bus types

Add support for parsing CSI-2 D-PHY, parallel or Bt.656 bus explicitly.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Detect bus type correctly
Sakari Ailus [Tue, 31 Jul 2018 10:43:14 +0000 (06:43 -0400)]
media: v4l: fwnode: Detect bus type correctly

In case the device supports multiple video bus types on an endpoint, the
V4L2 fwnode framework attempts to detect the type based on the available
information. This wasn't working really well, and sometimes could lead to
the V4L2 fwnode endpoint struct as being mishandled between the bus types.

Default to Bt.656 if no properties suggesting a bus type are found.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Let the caller provide V4L2 fwnode endpoint
Sakari Ailus [Sat, 2 Jun 2018 16:19:35 +0000 (12:19 -0400)]
media: v4l: fwnode: Let the caller provide V4L2 fwnode endpoint

Instead of allocating the V4L2 fwnode endpoint in
v4l2_fwnode_endpoint_alloc_parse, let the caller to do this. This allows
setting default parameters for the endpoint which is a very common need
for drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY
Sakari Ailus [Tue, 3 Jul 2018 21:19:27 +0000 (17:19 -0400)]
media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY

The CSI-2 bus may use either D-PHY or C-PHY. Make this visible in media
bus enum.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Add definitions for CSI-2 D-PHY, parallel and Bt.656 busses
Sakari Ailus [Tue, 3 Jul 2018 21:40:37 +0000 (17:40 -0400)]
media: v4l: fwnode: Add definitions for CSI-2 D-PHY, parallel and Bt.656 busses

Add definitions corresponding to DT bindings to the CSI-2 D-PHY, parallel
and Bt.656 busses.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: Specify bus type for MIPI D-PHY, others, explicitly
Sakari Ailus [Tue, 2 Jan 2018 13:12:35 +0000 (08:12 -0500)]
media: dt-bindings: media: Specify bus type for MIPI D-PHY, others, explicitly

Allow specifying the bus type explicitly for MIPI D-PHY, parallel and
Bt.656 busses. This is useful for devices that can make use of different
bus types. There are CSI-2 transmitters and receivers but the PHY
selection needs to be made between C-PHY and D-PHY; many devices also
support parallel and Bt.656 interfaces but the means to pass that
information to software wasn't there.

Autodetection (value 0) is removed as an option as the property could be
simply omitted in that case.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: The CSI-2 clock is continuous if it's not non-continuous
Sakari Ailus [Fri, 20 Jul 2018 09:04:29 +0000 (05:04 -0400)]
media: v4l: fwnode: The CSI-2 clock is continuous if it's not non-continuous

The continuous clock flag was only set if there was a clock or data lanes.
This isn't needed as such a configuration is invalid to begin with. Always
set the continuous clock flag if the non-continuous property is not found.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Use fwnode_graph_for_each_endpoint
Sakari Ailus [Thu, 21 Dec 2017 12:11:19 +0000 (07:11 -0500)]
media: v4l: fwnode: Use fwnode_graph_for_each_endpoint

Use fwnode_graph_for_each_endpoint iterator for better readability.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: fwnode: Add debug prints for V4L2 endpoint property parsing
Sakari Ailus [Mon, 4 Dec 2017 21:25:06 +0000 (16:25 -0500)]
media: v4l: fwnode: Add debug prints for V4L2 endpoint property parsing

Print debug info as standard V4L2 endpoint are parsed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-subdev.rst: Update doc regarding subdev descriptors
Steve Longerbeam [Sat, 29 Sep 2018 19:54:20 +0000 (15:54 -0400)]
media: v4l2-subdev.rst: Update doc regarding subdev descriptors

Update the doc to describe the new method of adding subdevice
descriptors to async notifiers.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: async: Remove notifier subdevs array
Steve Longerbeam [Sat, 29 Sep 2018 19:54:19 +0000 (15:54 -0400)]
media: v4l2: async: Remove notifier subdevs array

All platform drivers have been converted to use
v4l2_async_notifier_add_subdev(), in place of adding
asd's to the notifier subdevs array. So the subdevs
array can now be removed from struct v4l2_async_notifier,
and remove the backward compatibility support for that
array in v4l2-async.c.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: Switch to v4l2_async_notifier_add_subdev
Steve Longerbeam [Sat, 29 Sep 2018 19:54:18 +0000 (15:54 -0400)]
media: platform: Switch to v4l2_async_notifier_add_subdev

Switch all media platform drivers to call v4l2_async_notifier_add_subdev()
to add asd's to a notifier, in place of referencing the notifier->subdevs[]
array. These drivers also must now call v4l2_async_notifier_init() before
adding asd's to their notifiers.

There may still be cases where a platform driver maintains a list of
asd's that is a duplicate of the notifier asd_list, in which case its
possible the platform driver list can be removed, and can reference the
notifier asd_list instead. One example of where a duplicate list has
been removed in this patch is xilinx-vipp.c. If there are such cases
remaining, those drivers should be optimized to remove the duplicate
platform driver asd lists.

None of the changes to the platform drivers in this patch have been
tested. Verify that the async subdevices needed by the platform are
bound at load time, and that the driver unloads and reloads correctly
with no memory leaking of asd objects.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: TODO: Remove one assumption about OF graph parsing
Steve Longerbeam [Sat, 29 Sep 2018 19:54:17 +0000 (15:54 -0400)]
media: staging/imx: TODO: Remove one assumption about OF graph parsing

The move to subdev notifiers fixes one assumption of OF graph parsing.
If a subdevice has non-video related ports, the subdev driver knows not
to follow those ports when adding remote devices to its subdev notifier.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: Switch to v4l2_async_notifier_add_*_subdev
Steve Longerbeam [Sat, 29 Sep 2018 19:54:16 +0000 (15:54 -0400)]
media: staging/imx: Switch to v4l2_async_notifier_add_*_subdev

Switch to v4l2_async_notifier_add_*_subdev() when adding async subdevs
to the imx-media root notifier. This removes the need to check for
an already added asd, since v4l2_async_notifier_add_*_subdev() does this
check. Also no need to allocate a subdevs array when registering the
root notifier, or keeping an internal master asd_list, since this is
moved to the notifier's asd_list.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: Rename root notifier
Steve Longerbeam [Sat, 29 Sep 2018 19:54:15 +0000 (15:54 -0400)]
media: staging/imx: Rename root notifier

Rename the imx-media root async notifier from "subdev_notifier" to
simply "notifier", so as not to confuse it with true subdev notifiers.
No functional changes.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: Loop through all registered subdevs for media links
Steve Longerbeam [Sat, 29 Sep 2018 19:54:14 +0000 (15:54 -0400)]
media: staging/imx: Loop through all registered subdevs for media links

The root imx-media notifier no longer sees all bound subdevices because
some of them will be bound to subdev notifiers. So imx_media_create_links()
now needs to loop through all subdevices registered with the v4l2-device,
not just the ones in the root notifier's done list. This should be safe
because imx_media_create_of_links() checks if a fwnode link already
exists before creating.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: of: Remove recursive graph walk
Steve Longerbeam [Sat, 29 Sep 2018 19:54:13 +0000 (15:54 -0400)]
media: staging/imx: of: Remove recursive graph walk

After moving to subdev notifiers, it's no longer necessary to recursively
walk the OF graph, because the subdev notifiers will discover and add
devices from the graph for us.

So the recursive of_parse_subdev() function is gone, replaced with
of_add_csi() which adds only the CSI port fwnodes to the imx-media
root notifier.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: mipi csi-2: Register a subdev notifier
Steve Longerbeam [Sat, 29 Sep 2018 19:54:12 +0000 (15:54 -0400)]
media: imx: mipi csi-2: Register a subdev notifier

Parse neighbor remote devices on the MIPI CSI-2 input port, add
them to a subdev notifier, and register the subdev notifier for the
MIPI CSI-2 receiver, by calling v4l2_async_register_fwnode_subdev().

csi2_parse_endpoints() is modified to be the parse_endpoint callback.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: csi: Register a subdev notifier
Steve Longerbeam [Sat, 29 Sep 2018 19:54:11 +0000 (15:54 -0400)]
media: imx: csi: Register a subdev notifier

Parse neighbor remote devices on the CSI port, and add them to a subdev
notifier, by calling v4l2_async_notifier_parse_fwnode_endpoints_by_port()
using the CSI's port id. And register the subdev notifier for the CSI.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: video-mux: Register a subdev notifier
Steve Longerbeam [Sat, 29 Sep 2018 19:54:10 +0000 (15:54 -0400)]
media: platform: video-mux: Register a subdev notifier

Parse neighbor remote devices on the video muxes input ports, add them to a
subdev notifier, and register the subdev notifier for the video mux, by
calling v4l2_async_register_fwnode_subdev().

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers
Steve Longerbeam [Sat, 29 Sep 2018 19:54:09 +0000 (15:54 -0400)]
media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers

Adds v4l2_async_register_fwnode_subdev(), which is a convenience function
for parsing a sub-device's fwnode port endpoints for connected remote
sub-devices, registering a sub-device notifier, and then registering
the sub-device itself.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev
Steve Longerbeam [Sat, 29 Sep 2018 19:54:08 +0000 (15:54 -0400)]
media: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev

The fwnode endpoint and reference parsing functions in v4l2-fwnode.c
are modified to make use of v4l2_async_notifier_add_subdev().
As a result the notifier->subdevs array is no longer allocated or
re-allocated, and by extension the max_subdevs value is also no
longer needed.

Callers of the fwnode endpoint and reference parsing functions must now
first initialize the notifier with a call to v4l2_async_notifier_init().
This includes the function v4l2_async_register_subdev_sensor_common(),
and the intel-ipu3, omap3isp, and rcar-vin drivers.

Since the notifier->subdevs array is no longer allocated in the
fwnode endpoint and reference parsing functions, the callers of
those functions must never reference that array, since it is now
NULL. Of the drivers that make use of the fwnode/ref parsing,
only the intel-ipu3 driver references the ->subdevs[] array,
(in the notifier completion callback), so that driver has been
modified to iterate through the notifier->asd_list instead.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: async: Add convenience functions to allocate and add asd's
Steve Longerbeam [Sat, 29 Sep 2018 19:54:07 +0000 (15:54 -0400)]
media: v4l2: async: Add convenience functions to allocate and add asd's

Add these convenience functions, which allocate an asd of match type
fwnode, i2c, or device-name, of size asd_struct_size, and then adds
them to the notifier asd_list.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: async: Add v4l2_async_notifier_add_subdev
Steve Longerbeam [Sat, 29 Sep 2018 19:54:06 +0000 (15:54 -0400)]
media: v4l2: async: Add v4l2_async_notifier_add_subdev

v4l2_async_notifier_add_subdev() adds an asd to the notifier. It checks
that no other equivalent asd's have already been added to this notifier's
asd list, or to other registered notifier's waiting or done lists, and
increments num_subdevs.

v4l2_async_notifier_add_subdev() does not make use of the notifier subdevs
array, otherwise it would have to re-allocate the array every time the
function was called. In place of the subdevs array, the function adds
the newly allocated asd to a new master asd_list. The function will
return error with a WARN() if it is ever called with the subdevs array
allocated.

Drivers are now required to call a v4l2_async_notifier_init(), before the
first call to v4l2_async_notifier_add_subdev(), in order to initialize
the asd_list.

In v4l2_async_notifier_has_async_subdev(), __v4l2_async_notifier_register(),
and v4l2_async_notifier_cleanup(), maintain backward compatibility with
the subdevs array, by alternatively operate on the subdevs array or a
non-empty notifier->asd_list.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: async: Allow searching for asd of any type
Steve Longerbeam [Sat, 29 Sep 2018 19:54:05 +0000 (15:54 -0400)]
media: v4l2: async: Allow searching for asd of any type

Generalize v4l2_async_notifier_fwnode_has_async_subdev() to allow
searching for any type of async subdev, not just fwnodes. Rename to
v4l2_async_notifier_has_async_subdev() and pass it an asd pointer.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: ignore endpoints that have no remote port parent
Steve Longerbeam [Sat, 29 Sep 2018 19:54:04 +0000 (15:54 -0400)]
media: v4l2-fwnode: ignore endpoints that have no remote port parent

Documentation/devicetree/bindings/media/video-interfaces.txt states that
the 'remote-endpoint' property is optional.

So v4l2_async_notifier_fwnode_parse_endpoint() should not return error
if the endpoint has no remote port parent. Just ignore the endpoint,
skip adding an asd to the notifier and return 0.
__v4l2_async_notifier_parse_fwnode_endpoints() will then continue
parsing the remaining port endpoints of the device.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: fix typo in comment for TXB CSI-2 transmitter power down
Niklas Söderlund [Tue, 18 Sep 2018 01:45:09 +0000 (21:45 -0400)]
media: i2c: adv748x: fix typo in comment for TXB CSI-2 transmitter power down

Fix copy-and-paste error in comment for TXB CSI-2 transmitter power down
sequence.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: Register only enabled inputs
Jacopo Mondi [Mon, 17 Sep 2018 11:30:57 +0000 (07:30 -0400)]
media: i2c: adv748x: Register only enabled inputs

The adv748x assumes input endpoints are always enabled, and registers
a subdevice for each of them when the corresponding output subdevice
is registered.

Fix this by conditionally registering the input subdevice only if it is
actually described in device tree.

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: Conditionally enable only CSI-2 outputs
Jacopo Mondi [Mon, 17 Sep 2018 11:30:56 +0000 (07:30 -0400)]
media: i2c: adv748x: Conditionally enable only CSI-2 outputs

The ADV748x has two CSI-2 output port and one TTL input/output port for
digital video reception/transmission. The TTL digital pad is unconditionally
enabled during the device reset even if not used. Same goes for the TXA
and TXB CSI-2 outputs, which are enabled by the initial settings blob
programmed into the chip.

In order to improve power saving, do not enable unused output interfaces:
keep TTL output disabled, as it is not used, and drop CSI-2 output enabling
from the initial settings list, as they get conditionally enabled later.

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: Handle TX[A|B] power management
Jacopo Mondi [Mon, 17 Sep 2018 11:30:55 +0000 (07:30 -0400)]
media: i2c: adv748x: Handle TX[A|B] power management

As the driver is now allowed to probe with a single output endpoint,
power management routines shall now take into account the case a CSI-2 TX
is not enabled.

Unify the adv748x_tx_power() routine to handle transparently TXA and TXB,
and enable the CSI-2 outputs conditionally.

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: Support probing a single output
Jacopo Mondi [Mon, 17 Sep 2018 11:30:54 +0000 (07:30 -0400)]
media: i2c: adv748x: Support probing a single output

Currently the adv748x driver will fail to probe unless both of its
output endpoints (TXA and TXB) are connected.

Make the driver support probing provided that there is at least one
input, and one output connected and protect the clean-up function from
accessing un-initialized fields.

Following patches will fix other uses of un-initialized TXs in the driver,
such as power management functions.

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: MAINTAINERS: fix reference to STI CEC driver
Benjamin Gaignard [Mon, 1 Oct 2018 07:46:40 +0000 (03:46 -0400)]
media: MAINTAINERS: fix reference to STI CEC driver

STI CEC driver has move from staging directory to media/platform/sti/cec/

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: zoran: fix spelling mistake "queing" -> "queuing"
Colin Ian King [Sat, 29 Sep 2018 11:25:39 +0000 (07:25 -0400)]
media: zoran: fix spelling mistake "queing" -> "queuing"

Trivial fix to spelling mistake in kernel warning message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: fix redeclaration of symbol
Niklas Söderlund [Wed, 26 Sep 2018 21:40:06 +0000 (17:40 -0400)]
media: rcar-vin: fix redeclaration of symbol

When adding support for parallel subdev for Gen3 it was missed that the
symbol 'i' in rvin_group_link_notify() was already declared, remove the
dupe as it's only used as a loop variable this have no functional
change. This fixes warning:

    rcar-core.c:117:52: originally declared here
    rcar-core.c:173:30: warning: symbol 'i' shadows an earlier one

Fixes: 1284605dc821cebd ("media: rcar-vin: Handle parallel subdev in link_notify")

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx-pxp: include linux/interrupt.h
Arnd Bergmann [Wed, 26 Sep 2018 13:01:26 +0000 (09:01 -0400)]
media: imx-pxp: include linux/interrupt.h

The newly added driver fails to build in some configurations due to a
missing header inclusion:

drivers/media/platform/imx-pxp.c:988:8: error: unknown type name 'irqreturn_t'
 static irqreturn_t pxp_irq_handler(int irq, void *dev_id)
        ^~~~~~~~~~~
drivers/media/platform/imx-pxp.c: In function 'pxp_irq_handler':
drivers/media/platform/imx-pxp.c:1012:9: error: 'IRQ_HANDLED' undeclared (first use in this function); did you mean 'IRQ_MODE'?
  return IRQ_HANDLED;
         ^~~~~~~~~~~
         IRQ_MODE
drivers/media/platform/imx-pxp.c:1012:9: note: each undeclared identifier is reported only once for each function it appears in
drivers/media/platform/imx-pxp.c: In function 'pxp_probe':
drivers/media/platform/imx-pxp.c:1660:8: error: implicit declaration of function 'devm_request_threaded_irq'; did you mean 'devm_request_region'? [-Werror=implicit-function-declaration]
  ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler,
        ^~~~~~~~~~~~~~~~~~~~~~~~~
        devm_request_region
drivers/media/platform/imx-pxp.c:1661:4: error: 'IRQF_ONESHOT' undeclared (first use in this function); did you mean 'SA_ONESHOT'?
    IRQF_ONESHOT, dev_name(&pdev->dev), dev);

Fixes: 51abcf7fdb70 ("media: imx-pxp: add i.MX Pixel Pipeline driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: stm32-dcmi: only enable IT frame on JPEG capture
Hugues Fruchet [Mon, 24 Sep 2018 12:54:59 +0000 (08:54 -0400)]
media: stm32-dcmi: only enable IT frame on JPEG capture

Only enable IT frame on JPEG capture, this saves some CPU
interruptions and processing on all the other cases.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pxa_camera: Fix check for pdev->dev.of_node
Nathan Chancellor [Fri, 21 Sep 2018 10:00:45 +0000 (06:00 -0400)]
media: pxa_camera: Fix check for pdev->dev.of_node

Clang warns that the address of a pointer will always evaluated as true
in a boolean context.

drivers/media/platform/pxa_camera.c:2400:17: warning: address of
'pdev->dev.of_node' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (&pdev->dev.of_node && !pcdev->pdata) {
             ~~~~~~~~~~^~~~~~~ ~~
1 warning generated.

Judging from the rest of the kernel, it seems like this was an error and
just the value of of_node should be checked rather than the address.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: qcom: remove duplicated include file
zhong jiang [Fri, 21 Sep 2018 03:30:20 +0000 (23:30 -0400)]
media: qcom: remove duplicated include file

We include device.h twice in camss.h. It's unnecessary.
hence just remove it.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: use well defined 32-bit RGB pixel format
Philipp Zabel [Tue, 18 Sep 2018 09:42:31 +0000 (05:42 -0400)]
media: imx: use well defined 32-bit RGB pixel format

The documentation in Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
tells us that the V4L2_PIX_FMT_RGB32 format is deprecated and must not
be used by new drivers. Replace it with V4L2_PIX_FMT_XRGB32.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: VPU: mediatek: don't pass an unused parameter
Dan Carpenter [Mon, 17 Sep 2018 13:56:22 +0000 (09:56 -0400)]
media: VPU: mediatek: don't pass an unused parameter

The load_requested_vpu() function returns a freed vpu_fw pointer.  It's
not used so it doesn't cause any problems, but Smatch complains about
it:

    drivers/media/platform/mtk-vpu/mtk_vpu.c:578 vpu_load_firmware()
    warn: passing freed memory 'vpu_fw'

We can clean up the code a bit and silence the static checker warning
by not passing the parameter at all.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vidioc-dqevent.rst: clarify V4L2_EVENT_SRC_CH_RESOLUTION
Hans Verkuil [Mon, 17 Sep 2018 11:37:18 +0000 (07:37 -0400)]
media: vidioc-dqevent.rst: clarify V4L2_EVENT_SRC_CH_RESOLUTION

Clarify that when you receive V4L2_EVENT_SOURCE_CHANGE with flag
V4L2_EVENT_SRC_CH_RESOLUTION set, and the new resolution appears
identical to the old resolution, then you still must restart the
streaming I/O.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: ir-rc6-decoder: enable toggle bit for Kathrein RCU-676 remote
Matthias Reichl [Tue, 28 Aug 2018 13:49:42 +0000 (09:49 -0400)]
media: rc: ir-rc6-decoder: enable toggle bit for Kathrein RCU-676 remote

The Kathrein RCU-676 remote uses the 32-bit rc6 protocol and toggles
bit 15 (0x8000) on repeated button presses, like MCE remotes.

Add it's customer code 0x80460000 to the 32-bit rc6 toggle
handling code to get proper scancodes and toggle reports.

Signed-off-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macros
Sean Young [Tue, 21 Aug 2018 19:57:52 +0000 (15:57 -0400)]
media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macros

This can be done with c99 initializers, which makes the code cleaner
and more transparent. It does require gcc 4.6, because of this bug
in earlier versions:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676

Since commit cafa0010cd51 ("Raise the minimum required gcc version to
4.6"), this is the case.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rc: nec keymaps should specify the nec variant they use
Sean Young [Tue, 17 Jul 2018 21:33:05 +0000 (17:33 -0400)]
media: rc: nec keymaps should specify the nec variant they use

The rc_proto field should list the exact variant used by the remote. This
does not change the decoder used, but helps with using keymaps for
transmit purposes.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: smiapp: Remove unused loop
Ricardo Ribalda Delgado [Wed, 26 Sep 2018 06:12:42 +0000 (02:12 -0400)]
media: smiapp: Remove unused loop

The loop seemed to be made to calculate max, but max is not used in that
function.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: use JPEG mode 3 for 720p
Hugues Fruchet [Mon, 24 Sep 2018 13:33:27 +0000 (09:33 -0400)]
media: ov5640: use JPEG mode 3 for 720p

Change 720p JPEG mode to mode 3 as per other resolutions.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Remove support for crop default target in subdev drivers
Sakari Ailus [Mon, 24 Sep 2018 14:38:11 +0000 (10:38 -0400)]
media: v4l: Remove support for crop default target in subdev drivers

The V4L2 sub-device API does not support the crop default target. A number
of drivers apparently still did support this, likely as it was needed by
the SoC camera framework. Drop support for the default crop rectaingle in
sub-device drivers, and use the bounds rectangle in SoC camera instead.

Reported-by: Helmut Grohne <h.grohne@intenta.de>
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: i2c: Add a comment not to use static sub-device names in the future
Sakari Ailus [Mon, 24 Sep 2018 14:24:43 +0000 (10:24 -0400)]
media: v4l: i2c: Add a comment not to use static sub-device names in the future

A number of sub-device drivers used a static name for the sub-device, and
thus the media entity. As the entity name must be unique within a media
device, this makes it impossible to have more than one instance of each
device in a media device. This is a rather severe limitation.

Instead of fixing these drivers, add a comment to the drivers noting that
such static names may not be used in the future.

The alternative of fixing the drivers is troublesome as the entity (as
well as sub-device) name is part of the uAPI. Changing that is almost
certain to break something. As these devices are old but no-one has
encountered a problem with the static names, leave it as-is.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: davinci: Fix implicit enum conversion warning
Nathan Chancellor [Sat, 15 Sep 2018 06:16:15 +0000 (02:16 -0400)]
media: davinci: Fix implicit enum conversion warning

Clang warns when one enumerated type is implicitly converted to another.

drivers/media/platform/davinci/vpbe_display.c:524:24: warning: implicit
conversion from enumeration type 'enum osd_v_exp_ratio' to different
enumeration type 'enum osd_h_exp_ratio' [-Wenum-conversion]
                        layer_info->h_exp = V_EXP_6_OVER_5;
                                          ~ ^~~~~~~~~~~~~~
1 warning generated.

This appears to be a copy and paste error judging from the couple of
lines directly above this statement and the way that height is handled
in the if block above this one.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: bt8xx: Remove unnecessary self-assignment
Nathan Chancellor [Sat, 15 Sep 2018 06:06:13 +0000 (02:06 -0400)]
media: bt8xx: Remove unnecessary self-assignment

Clang warns when a variable is assigned to itself.

drivers/media/pci/bt8xx/bttv-driver.c:2043:13: warning: explicitly
assigning value of variable of type '__s32' (aka 'int') to itself
[-Wself-assign]
        min_height = min_height;
        ~~~~~~~~~~ ^ ~~~~~~~~~~
1 warning generated.

There doesn't appear to be any good reason for this and this statement
was added in commit e5bd0260e7d3 ("V4L/DVB (5077): Bttv cropping
support") back in 2007. Just remove it.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-common: fix typo in documentation for v4l_bound_align_image()
Niklas Söderlund [Thu, 13 Sep 2018 00:07:38 +0000 (20:07 -0400)]
media: v4l2-common: fix typo in documentation for v4l_bound_align_image()

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx23885: handle adding to list failure
Nicholas Mc Guire [Sun, 9 Sep 2018 16:02:32 +0000 (12:02 -0400)]
media: pci: cx23885: handle adding to list failure

altera_hw_filt_init() which calls append_internal() assumes
that the node was successfully linked in while in fact it can
silently fail. So the call-site needs to set return to -ENOMEM
on append_internal() returning NULL and exit through the err path.

Fixes: 349bcf02e361 ("[media] Altera FPGA based CI driver module")

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: au0828: Fix incorrect error messages
Brad Love [Thu, 6 Sep 2018 21:07:49 +0000 (17:07 -0400)]
media: au0828: Fix incorrect error messages

Correcting red herring error messages.

Where appropriate, replaces au0282_dev_register with:
- au0828_analog_register
- au0828_dvb_register

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: au0828: cannot kfree dev before usb disconnect
Brad Love [Thu, 6 Sep 2018 21:07:48 +0000 (17:07 -0400)]
media: au0828: cannot kfree dev before usb disconnect

If au0828_analog_register fails, the dev is kfree'd and then flow
jumps to done, which can call au0828_usb_disconnect. Since all USB
error codes are negative, au0828_usb_disconnect will be called. The
problem is au0828_usb_disconnect uses dev, if dev is NULL then there
is immediate oops encountered.

[    7.454307] au0828: au0828_usb_probe() au0282_dev_register failed to register on V4L2
[    7.454323] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
[    7.454421] PGD 0 P4D 0
[    7.454457] Oops: 0002 [#1] SMP PTI
[    7.454500] CPU: 1 PID: 262 Comm: systemd-udevd Tainted: P           O      4.18.3 #1
[    7.454584] Hardware name: Google Panther/Panther, BIOS MattDevo 04/27/2015
[    7.454670] RIP: 0010:_raw_spin_lock_irqsave+0x2c/0x50
[    7.454725] Code: 44 00 00 55 48 89 e5 41 54 53 48 89 fb 9c 58 0f 1f 44 00 00 49 89 c4 fa 66 0f 1f 44 00 00 e8 db 23 1b ff 31 c0 ba 01 00 00 00 <f0> 0f b1 13 85 c0 75 08 4c 89 e0 5b 41 5c 5d c3 89 c6 48 89 df e8
[    7.455004] RSP: 0018:ffff9130f53ef988 EFLAGS: 00010046
[    7.455063] RAX: 0000000000000000 RBX: 0000000000000050 RCX: 0000000000000000
[    7.455139] RDX: 0000000000000001 RSI: 0000000000000003 RDI: 0000000000000050
[    7.455216] RBP: ffff9130f53ef998 R08: 0000000000000018 R09: 0000000000000090
[    7.455292] R10: ffffed4cc53cb000 R11: ffffed4cc53cb108 R12: 0000000000000082
[    7.455369] R13: ffff9130cf2c6188 R14: 0000000000000000 R15: 0000000000000018
[    7.455447] FS:  00007f2ff8514cc0(0000) GS:ffff9130fcb00000(0000) knlGS:0000000000000000
[    7.455535] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    7.455597] CR2: 0000000000000050 CR3: 00000001753f0002 CR4: 00000000000606a0
[    7.455675] Call Trace:
[    7.455713]  __wake_up_common_lock+0x65/0xc0
[    7.455764]  __wake_up+0x13/0x20
[    7.455808]  ir_lirc_unregister+0x57/0xe0 [rc_core]
[    7.455865]  rc_unregister_device+0xa0/0xc0 [rc_core]
[    7.455935]  au0828_rc_unregister+0x25/0x40 [au0828]
[    7.455999]  au0828_usb_disconnect+0x33/0x80 [au0828]
[    7.456064]  au0828_usb_probe.cold.16+0x8d/0x2aa [au0828]
[    7.456130]  usb_probe_interface+0xf1/0x300
[    7.456184]  driver_probe_device+0x2e3/0x460
[    7.456235]  __driver_attach+0xe4/0x110
[    7.456282]  ? driver_probe_device+0x460/0x460
[    7.456335]  bus_for_each_dev+0x74/0xb0
[    7.456385]  ? kmem_cache_alloc_trace+0x15d/0x1d0
[    7.456441]  driver_attach+0x1e/0x20
[    7.456485]  bus_add_driver+0x159/0x230
[    7.456532]  driver_register+0x70/0xc0
[    7.456578]  usb_register_driver+0x7f/0x140
[    7.456626]  ? 0xffffffffc0474000
[    7.456674]  au0828_init+0xbc/0x1000 [au0828]
[    7.456725]  do_one_initcall+0x4a/0x1c9
[    7.456771]  ? _cond_resched+0x19/0x30
[    7.456817]  ? kmem_cache_alloc_trace+0x15d/0x1d0
[    7.456873]  do_init_module+0x60/0x210
[    7.456918]  load_module+0x221b/0x2710
[    7.456966]  ? vfs_read+0xf5/0x120
[    7.457010]  __do_sys_finit_module+0xbd/0x120
[    7.457061]  ? __do_sys_finit_module+0xbd/0x120
[    7.457115]  __x64_sys_finit_module+0x1a/0x20
[    7.457166]  do_syscall_64+0x5b/0x110
[    7.457210]  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: helpers: use true and false for boolean values
Gustavo A. R. Silva [Sun, 5 Aug 2018 00:12:57 +0000 (20:12 -0400)]
media: venus: helpers: use true and false for boolean values

Return statements in functions returning bool should use true or false
instead of an integer value.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: don't overwrite h.264 profile_idc on decoder instance
Lucas Stach [Wed, 1 Aug 2018 14:18:04 +0000 (10:18 -0400)]
media: coda: don't overwrite h.264 profile_idc on decoder instance

On a decoder instance, after the profile has been parsed from the stream
__v4l2_ctrl_s_ctrl() is called to notify userspace about changes in the
read-only profile control. This ends up calling back into the CODA driver
where a missing check on the s_ctrl caused the profile information that has
just been parsed from the stream to be overwritten with the default
baseline profile.

Later on the driver fails to enable frame reordering, based on the wrong
profile information.

Fixes: 347de126d1da (media: coda: add read-only h.264 decoder
                     profile/level controls)

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vb2: check for sane values from queue_setup
Johan Fjeldtvedt [Mon, 17 Sep 2018 08:36:47 +0000 (04:36 -0400)]
media: vb2: check for sane values from queue_setup

Warn and return error from the reqbufs ioctl when driver sets 0 number
of planes or 0 as plane sizes, as these values don't make any sense.
Checking this here stops obviously wrong values from propagating
further and causing various problems that are hard to trace back to
either of these values being 0.

Signed-off-by: Johan Fjeldtvedt <johfjeld@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: remove redundant null pointer check before of_node_put
zhong jiang [Sun, 16 Sep 2018 13:16:51 +0000 (09:16 -0400)]
media: platform: remove redundant null pointer check before of_node_put

of_node_put has taken the null pinter check into account. So it is
safe to remove the duplicated check before of_node_put.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: remove redundant null pointer check before of_node_put
zhong jiang [Sun, 16 Sep 2018 13:04:49 +0000 (09:04 -0400)]
media: coda: remove redundant null pointer check before of_node_put

of_node_put has taken the null pointer check into account. So it is
safe to remove the duplicated check before of_node_put.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media colorspaces*.rst: rename AdobeRGB to opRGB
Hans Verkuil [Thu, 13 Sep 2018 11:47:28 +0000 (07:47 -0400)]
media: media colorspaces*.rst: rename AdobeRGB to opRGB

Drop all Adobe references and use the official opRGB standard
instead.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: stable@vger.kernel.org
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: hdmi.h: rename ADOBE_RGB to OPRGB and ADOBE_YCC to OPYCC
Hans Verkuil [Thu, 13 Sep 2018 11:47:29 +0000 (07:47 -0400)]
media: hdmi.h: rename ADOBE_RGB to OPRGB and ADOBE_YCC to OPYCC

These names have been renamed in the CTA-861 standard due to trademark
issues. Replace them here as well so they are in sync with the standard.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Cc: stable@vger.kernel.org
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: replace ADOBERGB by OPRGB
Hans Verkuil [Fri, 14 Sep 2018 08:58:03 +0000 (04:58 -0400)]
media: replace ADOBERGB by OPRGB

The CTA-861 standards have been updated to refer to opRGB instead
of AdobeRGB. The official standard is in fact named opRGB, so
switch to that.

The two old defines referring to ADOBERGB in the public API are
put under #ifndef __KERNEL__ and a comment mentions that they are
deprecated.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: stable@vger.kernel.org
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx-pxp: fix compilation on i386 or x86_64
Philipp Zabel [Fri, 14 Sep 2018 07:10:56 +0000 (03:10 -0400)]
media: imx-pxp: fix compilation on i386 or x86_64

Include the missing interrupt.h header to fix compilation on i386 or
x86_64:

 ../drivers/media/platform/imx-pxp.c:988:1: error: unknown type name 'irqreturn_t'
  static irqreturn_t pxp_irq_handler(int irq, void *dev_id)
  ^
 ../drivers/media/platform/imx-pxp.c: In function 'pxp_irq_handler':
 ../drivers/media/platform/imx-pxp.c:1012:9: error: 'IRQ_HANDLED' undeclared (first use in this function)
   return IRQ_HANDLED;
          ^
 ../drivers/media/platform/imx-pxp.c:1012:9: note: each undeclared identifier is reported only once for each function it appears in
 ../drivers/media/platform/imx-pxp.c: In function 'pxp_probe':
 ../drivers/media/platform/imx-pxp.c:1660:2: error: implicit declaration of function 'devm_request_threaded_irq' [-Werror=implicit-function-declaration]
   ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler,
   ^
 ../drivers/media/platform/imx-pxp.c:1661:4: error: 'IRQF_ONESHOT' undeclared (first use in this function)
     IRQF_ONESHOT, dev_name(&pdev->dev), dev);

Fixes: 51abcf7fdb70 ("media: imx-pxp: add i.MX Pixel Pipeline driver")

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: Drop unused job_abort()
Ezequiel Garcia [Mon, 10 Sep 2018 15:21:54 +0000 (11:21 -0400)]
media: vicodec: Drop unused job_abort()

The vicodec does not use the aborting field. In fact, this driver
can't really cancel any work, since it performs all the work
in device_run().

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: Drop unneeded symbol dependency
Ezequiel Garcia [Mon, 10 Sep 2018 15:21:53 +0000 (11:21 -0400)]
media: vicodec: Drop unneeded symbol dependency

The vicodec doesn't use the Subdev API, so drop the dependency.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: set state->info before calling the encode/decode funcs
Hans Verkuil [Mon, 10 Sep 2018 15:00:40 +0000 (11:00 -0400)]
media: vicodec: set state->info before calling the encode/decode funcs

state->info was NULL since I completely forgot to set state->info.
Oops.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
[hans.verkuil@cisco.com: re-add q_out which was removed by commit 703fe34bac]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: check for valid format in v4l2_fwht_en/decode
Hans Verkuil [Mon, 10 Sep 2018 15:00:39 +0000 (11:00 -0400)]
media: vicodec: check for valid format in v4l2_fwht_en/decode

These functions did not return an error if state->info was NULL
or an unsupported pixelformat was selected (should not happen,
but just to be on the safe side).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: saa7134: add P7131_4871 analog inputs
Alexandre GRIVEAUX [Sun, 2 Sep 2018 12:36:40 +0000 (08:36 -0400)]
media: saa7134: add P7131_4871 analog inputs

The saa7134 Tiger board has a front panel connector at the back (labeled
panel 2 on the PCB), with S-VIDEO, composite and audio.

This patch adds those inputs.

Signed-off-by: Alexandre GRIVEAUX <agriveaux@deutnet.info>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>