platform/kernel/linux-starfive.git
6 years agomedia: af9013: add pid filter support
Antti Palosaari [Mon, 26 Jun 2017 08:57:09 +0000 (04:57 -0400)]
media: af9013: add pid filter support

af9013 demod has pid filter. Add support for it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: remove all legacy media attach releated stuff
Antti Palosaari [Fri, 23 Jun 2017 09:31:49 +0000 (05:31 -0400)]
media: af9013: remove all legacy media attach releated stuff

No one is binding that driver through media attach so remove it and
all related dead code.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9015: attach demod using i2c binding
Antti Palosaari [Fri, 23 Jun 2017 09:17:00 +0000 (05:17 -0400)]
media: af9015: attach demod using i2c binding

af9013 demod driver has i2c binding. Use it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: add i2c mux adapter for tuner bus
Antti Palosaari [Thu, 22 Jun 2017 16:18:21 +0000 (12:18 -0400)]
media: af9013: add i2c mux adapter for tuner bus

Add muxed i2c adapter for demod tuner i2c bus gate control.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: convert inittabs suitable for regmap_update_bits
Antti Palosaari [Thu, 22 Jun 2017 08:24:00 +0000 (04:24 -0400)]
media: af9013: convert inittabs suitable for regmap_update_bits

Convert inttabs to format (reg, mask, val) which are suitable
parameters to pass directly for regmap_update_bits.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9015: fix logging
Antti Palosaari [Wed, 21 Jun 2017 20:55:54 +0000 (16:55 -0400)]
media: af9015: fix logging

Pass correct device to dev_* logging functions, which allows us to
remove redundant KBUILD_MODNAME and __func__ parameters from log format.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: wrap dvbv3 statistics via dvbv5
Antti Palosaari [Mon, 19 Jun 2017 06:31:56 +0000 (02:31 -0400)]
media: af9013: wrap dvbv3 statistics via dvbv5

Driver has calculated dvbv5 statistics, so use those as a base for
legacy dvbv3 statistics. Wrap and convert needed values to dvbv3,
remove old dvbv3 statistic implementations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: dvbv5 ber and per
Antti Palosaari [Sun, 18 Jun 2017 17:26:35 +0000 (13:26 -0400)]
media: af9013: dvbv5 ber and per

Implement dvbv5 ber and per.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: dvbv5 cnr
Antti Palosaari [Sun, 18 Jun 2017 10:23:15 +0000 (06:23 -0400)]
media: af9013: dvbv5 cnr

Implement dvbv5 cnr.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: dvbv5 signal strength
Antti Palosaari [Sun, 18 Jun 2017 05:17:49 +0000 (01:17 -0400)]
media: af9013: dvbv5 signal strength

Implement dvbv5 signal strength estimate. We know tuner dependent
-80dBm and -50dBm agc values, construct line equation and use it to
map agc value to signal strength estimate.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: af9013: change lock detection slightly
Antti Palosaari [Wed, 21 Jun 2017 15:02:42 +0000 (11:02 -0400)]
media: af9013: change lock detection slightly

Whilst rewritten largely, the basic logic remains same with one
exception: do not return immediately on success case. We are going to
add statistics that function and cannot return too early.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: mceusb: pid 0x0609 vid 0x031d does not under report carrier cycles
Sean Young [Sun, 18 Mar 2018 10:46:02 +0000 (06:46 -0400)]
media: rc: mceusb: pid 0x0609 vid 0x031d does not under report carrier cycles

This mceusb does not need the carrier count quirk, with it set it reports
the carrier higher than it is.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mceusb: add IR learning support features (IR carrier frequency measurement...
A Sun [Fri, 16 Mar 2018 19:52:09 +0000 (15:52 -0400)]
media: mceusb: add IR learning support features (IR carrier frequency measurement and wide-band/short-range receiver)

Windows Media Center IR transceivers include two IR receivers;
wide-band/short-range and narrow-band/long-range. The short-range
(5cm distance) receiver is for IR learning and has IR carrier
frequency measuring ability.

Add mceusb driver support to select the short range IR receiver
and enable pass through of its IR carrier frequency measurements.

RC and LIRC already support these mceusb driver additions.

Test platform:

Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
mceusb 1-1.2:1.0: Registered Pinnacle Systems PCTV Remote USB with mce emulator interface version 1
mceusb 1-1.2:1.0: 2 tx ports (0x0 cabled) and 2 rx sensors (0x1 active)

Sony TV remote control

ir-ctl from v4l-utils

pi@raspberrypi:~ $ ir-ctl -V
IR raw version 1.12.3
pi@raspberrypi:~ $ ir-ctl -m -r
...
pulse 650
space 550
pulse 650
space 600
pulse 600
space 600
pulse 1200
space 600
pulse 650
space 550
pulse 650
space 600
pulse 600
space 600
pulse 550
carrier 40004
space 16777215
^C
pi@raspberrypi:~ $ exit

Signed-off-by: A Sun <as1033x@comcast.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: meson-ir: lower timeout and make configurable
Sean Young [Mon, 12 Mar 2018 21:23:00 +0000 (17:23 -0400)]
media: rc: meson-ir: lower timeout and make configurable

A timeout of 200ms is much longer than necessary, and delays the decoding
decoding of a single scancode and the last scancode when a button is being
held. This makes the remote seem sluggish.

If the min_timeout and max_timeout values are set, the timeout is
configurable via the LIRC_SET_REC_TIMEOUT ioctl.

Tested-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: meson-ir: add timeout on idle
Sean Young [Thu, 8 Mar 2018 14:42:44 +0000 (09:42 -0500)]
media: rc: meson-ir: add timeout on idle

Meson doesn't seem to be able to generate timeout events in hardware. So
install a software timer to generate the timeout events required by the
decoders to prevent "ghost keypresses".

Reported-by: Matthias Reichl <hias@horus.com>
Tested-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cpia2_usb: drop bogus interface-release call
Johan Hovold [Wed, 7 Mar 2018 09:49:36 +0000 (04:49 -0500)]
media: cpia2_usb: drop bogus interface-release call

Drop bogus call to usb_driver_release_interface() from the disconnect()
callback. As the interface is already being unbound at this point,
usb_driver_release_interface() simply returns early.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx: add 8-bit grayscale support
Philipp Zabel [Mon, 22 Jan 2018 16:16:32 +0000 (11:16 -0500)]
media: imx: add 8-bit grayscale support

The IPUv3 code has 8-bit grayscale capture support.
Enable imx-media to use it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: adv7604: Add support for i2c_new_secondary_device
Jean-Michel Hautbois [Tue, 13 Feb 2018 17:48:56 +0000 (12:48 -0500)]
media: adv7604: Add support for i2c_new_secondary_device

The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I2C ports. Each map has it own I2C address and acts as a standard slave
device on the I2C bus.

Allow a device tree node to override the default addresses so that
address conflicts with other devices on the same bus may be resolved at
the board description level.

[Kieran: Re-adapted for mainline]

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: media: adv7604: Extend bindings to allow specifying slave map...
Jean-Michel Hautbois [Tue, 13 Feb 2018 17:48:53 +0000 (12:48 -0500)]
media: dt-bindings: media: adv7604: Extend bindings to allow specifying slave map addresses

The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I2C ports. Each map has it own I2C address and acts as a standard slave
device on the I2C bus.

Extend the device tree node bindings to be able to override the default
addresses so that address conflicts with other devices on the same bus
may be resolved at the board description level.

[Kieran: Re-adapted for mainline]

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Add support for i2c_new_secondary_device
Kieran Bingham [Tue, 27 Feb 2018 15:05:50 +0000 (10:05 -0500)]
media: i2c: adv748x: Add support for i2c_new_secondary_device

The ADV748x has twelve 256-byte maps that can be accessed via the main
I2C ports. Each map has it own I2C address and acts as a standard slave
device on the I2C bus.

Allow a device tree node to override the default addresses so that
address conflicts with other devices on the same bus may be resolved at
the board description level.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Add missing CBUS page
Kieran Bingham [Tue, 27 Feb 2018 15:05:49 +0000 (10:05 -0500)]
media: i2c: adv748x: Add missing CBUS page

The ADV748x has 12 pages mapped onto I2C addresses.

In the existing implementation only 11 are mapped correctly in the page
enumerations, which causes an off-by-one fault on pages above the
infoframe definition due to a missing 'CBUS' page.

This causes the address for the CEC, SDP, TXA, and TXB to be incorrectly
programmed during the iterations in adv748x_initialise_clients().

Until now this has gone un-noticed due to the fact that following the
creation of the clients - the device is reset and the addresses are
reprogrammed in manually by the call to "adv748x_write_regs(state,
adv748x_set_slave_address);"

As part of moving to dynamic i2c address allocations repair this by
providing the missing CBUS page definition.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Simplify regmap configuration
Kieran Bingham [Tue, 27 Feb 2018 15:05:48 +0000 (10:05 -0500)]
media: i2c: adv748x: Simplify regmap configuration

The ADV748x has identical map configurations for each register map. The
duplication of each map can be simplified using a helper macro such that
each map is represented on a single line.

Define ADV748X_REGMAP_CONF for this purpose use it to create the tables.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add tuner standby op, use where needed
Hans Verkuil [Wed, 21 Feb 2018 07:49:25 +0000 (02:49 -0500)]
media: add tuner standby op, use where needed

The v4l2_subdev core s_power op was used for two different things: power on/off
sensors or video decoders/encoders and to put a tuner in standby (and only the
tuner!). There is no 'tuner wakeup' op, that's done automatically when the tuner
is accessed.

The danger with calling (s_power, 0) to put a tuner into standby is that it is
usually broadcast for all subdevs. So a video receiver subdev that supports
s_power will also be powered off, and since there is no corresponding (s_power, 1)
they will never be powered on again.

In addition, this is specifically meant for tuners only since they draw the most
current.

This patch adds a new tuner op called 'standby' and replaces all calls to
(core, s_power, 0) by (tuner, standby). This prevents confusion between the two
uses of s_power. Note that there is no overlap: bridge drivers either just want
to put the tuner into standby, or they deal with powering on/off sensors. Never
both.

This also makes it easier to replace s_power for the remaining bridge drivers
with some PM code later.

Whether we want something cleaner for tuners in the future is a separate topic.
There is a lot of legacy code surrounding tuners, and I am very hesitant about
making changes there.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vb2-core: vb2_ops: document non-interrupt-context calling
Luca Ceresoli [Thu, 8 Mar 2018 12:26:22 +0000 (07:26 -0500)]
media: vb2-core: vb2_ops: document non-interrupt-context calling

Driver writers can benefit in knowing if/when callbacks are called in
interrupt context. But it is not completely obvious here, so document
it.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vb2-core: document the REQUEUEING state
Luca Ceresoli [Thu, 8 Mar 2018 12:26:21 +0000 (07:26 -0500)]
media: vb2-core: document the REQUEUEING state

VB2_BUF_STATE_REQUEUEING is accepted by vb2_buffer_done() but not
documented, so add it along with notes about calls in interrupt
context.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vb2-core: vb2_buffer_done: consolidate docs
Luca Ceresoli [Thu, 8 Mar 2018 12:26:20 +0000 (07:26 -0500)]
media: vb2-core: vb2_buffer_done: consolidate docs

Documentation about what start_streaming() should do on failure are
scattered in two places and mostly duplicated, so consolidate them in
one of the two places.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: radio: Critical interrupt bugfix for si470x over i2c
Douglas Fischer [Fri, 2 Mar 2018 15:25:43 +0000 (10:25 -0500)]
media: radio: Critical interrupt bugfix for si470x over i2c

Fixed si470x_start() disabling the interrupt signal, causing tune
operations to never complete. This does not affect USB radios
because they poll the registers instead of using the IRQ line.

Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
[hans.verkuil@cisco.com: fixed 80 column checkpatch warning]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: radio: Critical v4l2 registration bugfix for si470x over i2c
Douglas Fischer [Mon, 26 Feb 2018 23:22:02 +0000 (18:22 -0500)]
media: radio: Critical v4l2 registration bugfix for si470x over i2c

Added the call to v4l2_device_register() required to add a new radio device.
Without this patch, it is impossible for the driver to load. This does not
affect USB devices.

Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: radio: Tuning bugfix for si470x over i2c
Douglas Fischer [Mon, 26 Feb 2018 02:24:06 +0000 (21:24 -0500)]
media: radio: Tuning bugfix for si470x over i2c

Fixed si470x_set_channel() trying to tune before chip is turned
on, which causes warnings in dmesg and when probing, makes driver
wait for 3s for tuning timeout. This issue did not affect USB
devices because they have a different probing sequence.

Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
[hans.verkuil@cisco.com: fixed space-after-( checkpatch warning]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: stm32-dcmi: add JPEG support
Hugues Fruchet [Wed, 28 Feb 2018 17:20:16 +0000 (12:20 -0500)]
media: stm32-dcmi: add JPEG support

Add DCMI JPEG support.

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@s-opensource.com>
6 years agomedia: stm32-dcmi: fix unnecessary parentheses
Hugues Fruchet [Thu, 22 Feb 2018 09:51:27 +0000 (04:51 -0500)]
media: stm32-dcmi: fix unnecessary parentheses

Fix unnecessary parentheses in if conditions.
Detected by checkpatch.pl --strict.

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@s-opensource.com>
6 years agomedia: stm32-dcmi: rework overrun/error case
Hugues Fruchet [Thu, 8 Mar 2018 10:46:23 +0000 (05:46 -0500)]
media: stm32-dcmi: rework overrun/error case

Do not stop/restart dma on overrun or errors.
Dma will be restarted on current frame transfer
completion. Frame transfer completion is ensured
even if overrun or error occurs by DCMI continuous
capture mode which restarts data transfer at next
frame sync.
Do no warn on overrun while in irq thread, this slows down
system and lead to more overrun errors. Use a counter
instead and log errors at stop streaming.

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@s-opensource.com>
6 years agomedia: stm32-dcmi: fix lock scheme
Hugues Fruchet [Thu, 22 Feb 2018 09:49:14 +0000 (04:49 -0500)]
media: stm32-dcmi: fix lock scheme

Fix lock scheme leading to spurious freeze.

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@s-opensource.com>
6 years agomedia: v4l: common: Remove v4l2_find_nearest_format
Sakari Ailus [Thu, 8 Feb 2018 12:00:48 +0000 (07:00 -0500)]
media: v4l: common: Remove v4l2_find_nearest_format

v4l2_find_nearest_format is not useful for drivers in finding the best
matching format as it assumes a V4L2 specific struct. Drivers will use
v4l2_find_nearest_size instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vivid: Use v4l2_find_nearest_size
Sakari Ailus [Thu, 8 Feb 2018 12:00:02 +0000 (07:00 -0500)]
media: vivid: Use v4l2_find_nearest_size

Use v4l2_find_nearest_size instead of a driver specific function to find
nearest matching size.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5670: Use v4l2_find_nearest_size
Sakari Ailus [Thu, 8 Feb 2018 11:25:20 +0000 (06:25 -0500)]
media: ov5670: Use v4l2_find_nearest_size

Use v4l2_find_nearest_size instead of a driver specific function to find
nearest matching size.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov13858: Use v4l2_find_nearest_size
Sakari Ailus [Thu, 8 Feb 2018 11:24:34 +0000 (06:24 -0500)]
media: ov13858: Use v4l2_find_nearest_size

Use v4l2_find_nearest_size instead of a driver specific function to find
nearest matching size.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: common: Add a function to obtain best size from a list
Sakari Ailus [Fri, 23 Feb 2018 09:50:14 +0000 (04:50 -0500)]
media: v4l: common: Add a function to obtain best size from a list

Add a function (as well as a helper macro) to obtain the best size in a
list of device specific sizes. This helps writing drivers as well as
aligns interface behaviour across drivers.

The struct in which this information is contained in is typically specific
to the driver, therefore the existing function v4l2_find_nearest_format()
does not address the need.

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@s-opensource.com>
6 years agomedia: imon: rename protocol from other to imon
Sean Young [Wed, 7 Mar 2018 10:55:38 +0000 (05:55 -0500)]
media: imon: rename protocol from other to imon

This renames the protocol for the imon rc driver from other to imon,
since it is now an known protocol. Although different name will show up
in the sysfs protocol file, loading a keymap using existing ir-keytable
versions still works.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: add new imon protocol decoder and encoder
Sean Young [Sun, 3 Dec 2017 16:06:54 +0000 (11:06 -0500)]
media: rc: add new imon protocol decoder and encoder

This makes it possible to use the various iMON remotes with any raw IR
RC device.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: oops in ir_timer_keyup after device unplug
Sean Young [Tue, 6 Mar 2018 13:57:57 +0000 (08:57 -0500)]
media: rc: oops in ir_timer_keyup after device unplug

If there is IR in the raw kfifo when ir_raw_event_unregister() is called,
then kthread_stop() causes ir_raw_event_thread to be scheduled, decode
some scancodes and re-arm timer_keyup. The timer_keyup then fires when
the rc device is long gone.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: new driver for early iMon device
Sean Young [Fri, 5 Jan 2018 19:58:51 +0000 (14:58 -0500)]
media: rc: new driver for early iMon device

These devices were supported by the lirc_imon.c driver which was removed
from staging in commit f41003a23a02 ("[media] staging: lirc_imon: port
remaining usb ids to imon and remove").

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: add keymap for iMON RSC remote
Sean Young [Mon, 5 Mar 2018 13:32:14 +0000 (08:32 -0500)]
media: rc: add keymap for iMON RSC remote

Note that the stick on the remote is not supported yet.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: Revert "[media] staging: lirc_imon: port remaining usb ids to imon and remove"
Sean Young [Sat, 6 Jan 2018 12:24:50 +0000 (07:24 -0500)]
media: Revert "[media] staging: lirc_imon: port remaining usb ids to imon and remove"

This code was ported without the necessary hardware to test. There
are multiple problems which are more easily solved by writing a
separate driver.

This reverts commit f41003a23a02dc7299539300f74360c2a932714a.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt: bindings: Update binding documentation for sunxi IR controller
Philipp Rossak [Tue, 13 Feb 2018 12:29:48 +0000 (07:29 -0500)]
media: dt: bindings: Update binding documentation for sunxi IR controller

This patch updates documentation for Device-Tree bindings for sunxi IR
controller and adds the new optional property for the base clock
frequency.

Signed-off-by: Philipp Rossak <embed3d@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: update sunxi-ir driver to get base clock frequency from devicetree
Philipp Rossak [Tue, 13 Feb 2018 12:29:47 +0000 (07:29 -0500)]
media: rc: update sunxi-ir driver to get base clock frequency from devicetree

This patch updates the sunxi-ir driver to set the base clock frequency from
devicetree.

This is necessary since there are different ir receivers on the
market, that operate with different frequencies. So this value could be
set if the attached ir receiver needs a different base clock frequency,
than the default 8 MHz.

Signed-off-by: Philipp Rossak <embed3d@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: em28xx-cards: fix em28xx_duplicate_dev()
Dan Carpenter [Thu, 8 Mar 2018 09:31:00 +0000 (04:31 -0500)]
media: em28xx-cards: fix em28xx_duplicate_dev()

There is a double sizeof() typo here so we don't duplicate the struct
properly.

Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
6 years agomedia: ngene: use common DVB I2C client handling helpers
Daniel Scheller [Wed, 7 Mar 2018 20:07:56 +0000 (15:07 -0500)]
media: ngene: use common DVB I2C client handling helpers

Like in ddbridge, get rid of all duplicated I2C client handling constructs
and rather make use of the newly added dvb_module_*() helpers. Makes
things more clean and removes the (cosmetic) need for some variables.

The check on a valid ptr on ci->en isn't really needed since the cxd2099
driver will set it at a time where it is going to return successfully
from probing.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: use common DVB I2C client handling helpers
Daniel Scheller [Wed, 7 Mar 2018 20:07:55 +0000 (15:07 -0500)]
media: ddbridge: use common DVB I2C client handling helpers

Instead of keeping duplicated I2C client handling construct, make use of
the newly introduced dvb_module_*() helpers. This not only keeps things
way cleaner and removes the need for duplicated I2C client attach code,
but even allows to get rid of some variables that won't help in making
things look cleaner anymore.

The check on a valid ptr on port->en isn't really needed since the cxd2099
driver will set it at a time where it is going to return successfully
from probing.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/Kconfig: move the SP2 driver to the CI section
Daniel Scheller [Wed, 7 Mar 2018 19:23:48 +0000 (14:23 -0500)]
media: dvb-frontends/Kconfig: move the SP2 driver to the CI section

The CIMaX SP2 driver is a EN50221 CI controller I2C driver similar to the
cxd2099 driver. Move it's Kconfig block into the newly introduced CI
subsection.

Cc: Olli Salonen <olli.salonen@iki.fi>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/cxd2099: Kconfig additions
Daniel Scheller [Wed, 7 Mar 2018 19:23:47 +0000 (14:23 -0500)]
media: dvb-frontends/cxd2099: Kconfig additions

The cxd2099 driver makes use of the Regmap I2C kernel API, thus add
"select REGMAP_I2C" to it's Kconfig block. Also, make it default "m" if
!MEDIA_SUBDRV_AUTOSELECT, just like every other dvb-frontend driver.
And, while at it, remove the hyphens around the help tag.

Cc: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: Kconfig: fix DVB dependencies
Mauro Carvalho Chehab [Wed, 7 Mar 2018 14:51:17 +0000 (09:51 -0500)]
media: Kconfig: fix DVB dependencies

If I2C is present and it is module, the DVB core should also
be a module, otherwise build will now fail with:

  drivers/media/dvb-core/dvbdev.o: In function `dvb_module_probe':
     drivers/media/dvb-core/dvbdev.c:965: undefined reference to `i2c_new_device'
     drivers/media/dvb-core/dvbdev.c:972: undefined reference to `i2c_unregister_device'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: si2168: fix a comment about firmware version
Mauro Carvalho Chehab [Wed, 7 Mar 2018 13:57:05 +0000 (08:57 -0500)]
media: si2168: fix a comment about firmware version

There's a comment there at s82168 that it is wrong.

With firmware 4.0.11, sleep/resume works well without
need of download it every time. But firmware 4.0.19
needs to be downloaded again after sleep.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-subdev: document remaining undocumented functions
Mauro Carvalho Chehab [Tue, 19 Dec 2017 11:18:23 +0000 (06:18 -0500)]
media: v4l2-subdev: document remaining undocumented functions

There are several undocumented v4l2-subdev functions that are
part of kAPI. Document them.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-subdev: get rid of __V4L2_SUBDEV_MK_GET_TRY() macro
Mauro Carvalho Chehab [Tue, 19 Dec 2017 11:03:55 +0000 (06:03 -0500)]
media: v4l2-subdev: get rid of __V4L2_SUBDEV_MK_GET_TRY() macro

X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com
media: v4l2-subdev: get rid of __V4L2_SUBDEV_MK_GET_TRY() macro

The __V4L2_SUBDEV_MK_GET_TRY() macro is used to define
3 functions that have the same arguments. The code of those
functions is simple enough to just declare them, de-obfuscating
the code.

While here, replace BUG_ON() by WARN_ON() as there's no reason
why to panic the Kernel if this fails.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: s5c73m3-core: fix logic on a timeout condition
Mauro Carvalho Chehab [Tue, 19 Dec 2017 11:43:37 +0000 (06:43 -0500)]
media: s5c73m3-core: fix logic on a timeout condition

As warned by smatch:
drivers/media/i2c/s5c73m3/s5c73m3-core.c:268 s5c73m3_check_status() error: uninitialized symbol 'status'.

if s5c73m3_check_status() is called too late, time_is_after_jiffies(end)
will return 0, causing the while to abort before reading status.

The current code will do the wrong thing here, as it will still
check if status != value. The right fix here is to change
the logic to ensure that it will always read the status.

Suggested-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: remove unused vars
Mauro Carvalho Chehab [Wed, 7 Mar 2018 10:11:29 +0000 (05:11 -0500)]
media: cxd2880: remove unused vars

drivers/media/dvb-frontends/cxd2880/cxd2880_top.c: In function ‘cxd2880_set_ber_per_period_t’:
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c:677:34: warning: variable ‘c’ set but not used [-Wunused-but-set-variable]
  struct dtv_frontend_properties *c;
                                  ^
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c: In function ‘cxd2880_set_ber_per_period_t2’:
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c:790:34: warning: variable ‘c’ set but not used [-Wunused-but-set-variable]
  struct dtv_frontend_properties *c;
                                  ^
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c: In function ‘cxd2880_get_frontend’:
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c:1799:23: warning: variable ‘priv’ set but not used [-Wunused-but-set-variable]
  struct cxd2880_priv *priv = NULL;
                       ^~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: don't return unitialized values
Mauro Carvalho Chehab [Wed, 7 Mar 2018 10:09:30 +0000 (05:09 -0500)]
media: cxd2880: don't return unitialized values

drivers/media/dvb-frontends/cxd2880/cxd2880_devio_spi.c:59 cxd2880_io_spi_read_reg() error: uninitialized symbol 'ret'.
drivers/media/dvb-frontends/cxd2880/cxd2880_devio_spi.c:111 cxd2880_io_spi_write_reg() error: uninitialized symbol 'ret'.
drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.c:2985 cxd2880_tnrdmd_set_cfg() error: uninitialized symbol 'ret'.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Makefile: remove an include
Mauro Carvalho Chehab [Wed, 7 Mar 2018 09:58:49 +0000 (04:58 -0500)]
media: cxd2880: Makefile: remove an include

It is not needed anymore to include the dvb-core directory,
as all the public headers that used to be there was moved
to include/media.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add all Makefile, Kconfig files and Update MAINTAINERS file for the...
Yasunari Takiguchi [Thu, 18 Jan 2018 08:59:42 +0000 (03:59 -0500)]
media: cxd2880: Add all Makefile, Kconfig files and Update MAINTAINERS file for the driver

This is the Makefile, Kconfig files of driver
and MAINTAINERS file update about the driver
for the Sony CXD2880 DVB-T2/T tuner + demodulator.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Fix location of DVB headers
Mauro Carvalho Chehab [Wed, 7 Mar 2018 10:02:37 +0000 (05:02 -0500)]
media: cxd2880: Fix location of DVB headers

Fix a trivial conflict, where the location of DVB headers
got moved.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add DVB-T2 monitor functions
Yasunari Takiguchi [Thu, 18 Jan 2018 08:57:01 +0000 (03:57 -0500)]
media: cxd2880: Add DVB-T2 monitor functions

Provide monitor functions (DVB-T2)
for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add DVB-T2 control functions for the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:55:32 +0000 (03:55 -0500)]
media: cxd2880: Add DVB-T2 control functions for the driver

Provide definitions, interfaces and functions needed for DVB-T2
of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add DVB-T monitor functions
Yasunari Takiguchi [Thu, 18 Jan 2018 08:54:33 +0000 (03:54 -0500)]
media: cxd2880: Add DVB-T monitor functions

Provide monitor functions (DVB-T)
for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add DVB-T control functions the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:53:23 +0000 (03:53 -0500)]
media: cxd2880: Add DVB-T control functions the driver

Provide definitions, interfaces and functions needed for DVB-T
of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add top level of the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:52:17 +0000 (03:52 -0500)]
media: cxd2880: Add top level of the driver

This provides the main dvb frontend operation functions
for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add integration layer for the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:51:10 +0000 (03:51 -0500)]
media: cxd2880: Add integration layer for the driver

These functions monitor the driver and watch for task completion.
This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add tuner part of the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:50:20 +0000 (03:50 -0500)]
media: cxd2880: Add tuner part of the driver

This part of the driver has the main routines to handle
the tuner and demodulator functionality.  The tnrdmd_mon.* files
have monitor functions for the driver.
This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add spi device IO routines
Yasunari Takiguchi [Thu, 18 Jan 2018 08:48:58 +0000 (03:48 -0500)]
media: cxd2880: Add spi device IO routines

Add functions for initializing, reading and writing to the SPI
device for the Sony CXD2880 DVB-T2/T tuner + demodulator.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880: Add common files for the driver
Yasunari Takiguchi [Thu, 18 Jan 2018 08:47:38 +0000 (03:47 -0500)]
media: cxd2880: Add common files for the driver

These are common files for the driver for the
Sony CXD2880 DVB-T2/T tuner + demodulator.
These contains helper functions for the driver.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2880-spi: Add support for CXD2880 SPI interface
Yasunari Takiguchi [Thu, 18 Jan 2018 08:46:10 +0000 (03:46 -0500)]
media: cxd2880-spi: Add support for CXD2880 SPI interface

This is the SPI adapter part of the driver for the
Sony CXD2880 DVB-T2/T tuner + demodulator.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: Add document file for CXD2880 SPI I/F
Yasunari Takiguchi [Thu, 18 Jan 2018 08:43:51 +0000 (03:43 -0500)]
media: Add document file for CXD2880 SPI I/F

This is the document file for Sony CXD2880 DVB-T2/T tuner + demodulator.
It contains the description of the SPI adapter binding.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbdev: fix building on ia64
Mauro Carvalho Chehab [Wed, 7 Mar 2018 09:11:50 +0000 (04:11 -0500)]
media: dvbdev: fix building on ia64

Not sure why, but, on ia64, with Linaro's gcc 7.3 compiler,
using #ifdef (CONFIG_I2C) is not OK.

So, replace it by IS_ENABLED(CONFIG_I2C), in order to fix the
builds there.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Override 888 ImpactVCBe crystal frequency
Brad Love [Tue, 6 Mar 2018 19:15:37 +0000 (14:15 -0500)]
media: cx23885: Override 888 ImpactVCBe crystal frequency

Hauppauge produced a revision of ImpactVCBe using an 888,
with a 25MHz crystal, instead of using the default third
overtone 50Mhz crystal. This overrides that frequency so
that the cx25840 is properly configured. Without the proper
crystal setup the cx25840 cannot load the firmware or
decode video.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Set subdev host data to clk_freq pointer
Brad Love [Tue, 6 Mar 2018 19:15:36 +0000 (14:15 -0500)]
media: cx23885: Set subdev host data to clk_freq pointer

Currently clk_freq is ignored entirely, because the cx235840 driver
configures the xtal at the chip defaults. This is an issue if a
board is produced with a non-default frequency crystal. If clk_freq
is not zero the cx25840 will attempt to use the setting provided,
or fall back to defaults otherwise.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: change 887/888 default to 888
Brad Love [Tue, 6 Mar 2018 19:15:35 +0000 (14:15 -0500)]
media: cx23885: change 887/888 default to 888

Proper cx2388x chip type is detected in cx25840 probe, the clock
rate is untouched however in probe. The cx25840 only checks for
non default clock values for 888 and provides custom settings for
25MHz 888. This change ensures that cx23888 chips with default 50MHz
crystals will not get configured as if they have 25MHz crystals. A
cx23887 board will continue to be configured for 25MHz crystal as
there is no custom clock support included for it.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx25840: Use subdev host data for PLL override
Brad Love [Tue, 6 Mar 2018 19:15:34 +0000 (14:15 -0500)]
media: cx25840: Use subdev host data for PLL override

The cx25840 driver currently configures 885, 887, and 888 using
default divisors for each chip. This check to see if the cx23885
driver has passed the cx25840 a non-default clock rate for a
specific chip. If a cx23885 board has left clk_freq at 0, the
clock default values will be used to configure the PLLs.

This patch only has effect on 888 boards who set clk_freq to 25M.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Fix gpio on Hauppauge QuadHD PCIe cards
Brad Love [Tue, 6 Mar 2018 19:15:02 +0000 (14:15 -0500)]
media: cx23885: Fix gpio on Hauppauge QuadHD PCIe cards

The GPIO settings for quadHD boards are wrong. Fix them.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Add second i2c demod to Hauppauge 975
Brad Love [Tue, 6 Mar 2018 19:15:01 +0000 (14:15 -0500)]
media: cx231xx: Add second i2c demod to Hauppauge 975

Hauppauge HVR-975 is a hybrid, dual frontend, single tuner USB device.
It contains lgdt3306a and si2168 frontends and one si2157 tuner. The
lgdt3306a frontend is currently enabled. This creates the second
demodulator and attaches it to the tuner.

Enables lgdt3306a|si2168 + si2157

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Use constant instead of hard code for max
Brad Love [Tue, 6 Mar 2018 19:15:00 +0000 (14:15 -0500)]
media: cx231xx: Use constant instead of hard code for max

Nit regarding hard coded value.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Set mfe_shared if second frontend found
Brad Love [Tue, 6 Mar 2018 19:14:59 +0000 (14:14 -0500)]
media: cx231xx: Set mfe_shared if second frontend found

If frontend[1] exists, then enable the dvb adapter mfe lock system.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Add tuner type and analog inputs to 1265
Brad Love [Tue, 6 Mar 2018 19:14:58 +0000 (14:14 -0500)]
media: cx23885: Add tuner type and analog inputs to 1265

Add missing composite and s-video inputs.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Use frontend i2c adapter with tuner
Brad Love [Tue, 6 Mar 2018 19:14:57 +0000 (14:14 -0500)]
media: cx231xx: Use frontend i2c adapter with tuner

Utilize the i2c mux adapter returned by the frontend.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: em28xx: Change hex to lower case
Brad Love [Tue, 6 Mar 2018 19:14:56 +0000 (14:14 -0500)]
media: em28xx: Change hex to lower case

Coding style fix.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: lgdt3306a: remove symbol count mismatch fix
Brad Love [Tue, 6 Mar 2018 19:14:55 +0000 (14:14 -0500)]
media: lgdt3306a: remove symbol count mismatch fix

This symbol mismatch is handled by NULL'ing out the release
callback if the driver is loaded as an i2c device.

This patch reverts:
- commit 94448e21cf08 ("media: lgdt3306a: Fix a double kfree on i2c
  device remove")
- commit 835d66173a38 ("media: lgdt3306a: Fix module count mismatch
  on usb unplug")

The symbol count mismatch is handled by:
- commit 5b3a8e906973 ("media: lgdt3306a: Set fe ops.release to
  NULL if probed")

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: compensate for TS buffer offset shifts
Daniel Scheller [Tue, 6 Mar 2018 17:46:37 +0000 (12:46 -0500)]
media: ngene: compensate for TS buffer offset shifts

A possible hardware bug was discovered when using CA addon hardware
attached to the ngene hardware, in that the TS input buffer much likely
will shift and thus become unaligned to 188 byte blocks (a full TS frame)
when things like CA module initialisation (which happens via differing
communication paths) take place. This causes the TS NULL removal in
tsin_exchange() to fail to detect this previously inserted data and thus
causes userspace applications to receive data they didn't sent beforehand
and ultimately cause troubles.

On driver load with an inserted CAM, buffers are fine at first (note that
the driver has to keep the communication running from/to the card by
inserting TS NULL frames, this is done in tsout_exchange() via
FillTSBuffer() - that data is simply sent back by the hardware):

  offset | 0    1   2   3   4   5 .... 188 189 190 191 192 193 .... 376
  data   | 47  1f  ff  10  6f  6f ....  47  1f  ff  10  6f  6f ....  47

After a few seconds, the CA module is recognised and initialised, which is
signalled by

  dvb_ca_en50221: dvb_ca adapter X: DVB CAM detected and initialised successfully

This is where the first shift happens (this is always four bytes), buffer
becomes like this:

  offset | 0    1   2   3   4   5 .... 188 189 190 191 192 193 .... 376
  data   | 6f  6f  6f  6f  47  1f ....  6f  6f  6f  6f  47  1f ....  6f

Next, VDR, TVHeadend or any other CI aware application is started, buffers
will shift by even more bytes. It is believed this is due to the hardware
not handling control and data bytes properly distinct, and control data
having an influence on the actual data stream, which we cannot properly
detect at the driver level.

Workaround this hardware quirk by adding a detection for the TS sync byte
0x47 before each TS frame copy, scan for a new SYNC byte and a TS NULL
packet if buffers become unaligned, take note of that offset and apply
that when copying data to the DVB ring buffers. The last <188 bytes from
the hardware buffers are stored in a temp buffer (tsin_buffer), for which
the remainder will be in the beginning of the next hardware buffer (next
iteration of tsin_exchange()). That remainder will be appended to the
temp buffer and finally sent to the DVB ring buffer. The resulting TS
stream is perfectly fine, and the TS NULL packets inserted by the driver
which are sent back are properly removed. The resulting offset is being
clamped to 188 byte segments (one TS packet). Though this can result in
a repeated TS packet if the overall offset grows beyond this (and it
will grow only on CA initialisation), this is still way better than
unaligned TS frames and data sent to userspace that just isn't supposed
to be there.

This compensation can be toggled by the ci_tsfix modparam, which defaults
to 1 (enabled). In the case of problems, this can be turned off by setting
the parameter to 0 to restore the old behaviour.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: move the tsin_exchange() stripcopy block into a function
Daniel Scheller [Tue, 6 Mar 2018 17:46:36 +0000 (12:46 -0500)]
media: ngene: move the tsin_exchange() stripcopy block into a function

Move the copy logic that will skip previously inserted TS NULL frames when
moving data to the DVB ring buffers into an own function. This is done to
not duplicate code all over the place with the following TS offset shift
fixup patch.

While we're touching this part of the code, get rid of the DEBUG_CI_XFER
debug-ifdeffery. This could be toggleable either by a Kconfig or a module
param, but in the end this will accidentally be enabled and cause lots
of kernel log messages, and such devel debug shouldn't be there anyway.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: media: Replace "dont" with "don't"
Arushi Singhal [Sun, 4 Mar 2018 15:48:27 +0000 (10:48 -0500)]
media: staging: media: Replace "dont" with "don't"

Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: media: Replace "be be" with "be"
Arushi Singhal [Sun, 4 Mar 2018 15:48:25 +0000 (10:48 -0500)]
media: staging: media: Replace "be be" with "be"

This patch replace "be be" with "be".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: media: Remove unnecessary semicolon
Arushi Singhal [Sat, 3 Mar 2018 19:26:29 +0000 (14:26 -0500)]
media: staging: media: Remove unnecessary semicolon

Remove unnecessary semicolon found using semicolon.cocci Coccinelle
script.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: siano: Fix coherent memory allocation failure on arm64
Tomoki Sekiyama [Sat, 3 Mar 2018 18:20:56 +0000 (13:20 -0500)]
media: siano: Fix coherent memory allocation failure on arm64

On some architectures such as arm64, siano chip based TV-tuner
USB devices are not recognized correctly due to coherent memory
allocation failure with the following error:

[  663.556135] usbcore: deregistering interface driver smsusb
[  683.624809] smsusb:smsusb_probe: board id=18, interface number 0
[  683.633530] smsusb:smsusb_init_device: smscore_register_device(...) failed, rc -12
[  683.641501] smsusb:smsusb_probe: Device initialized with return code -12
[  683.652978] smsusb: probe of 1-1:1.0 failed with error -12

This is caused by dma_alloc_coherent(NULL, ...) returning NULL in
smscoreapi.c.

To fix this error, allocate the buffer memory for the USB devices
via kmalloc() and let the USB core do the DMA mapping and free.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: doc: poll: fix links to dual-ioctl sections
Luca Ceresoli [Fri, 2 Mar 2018 09:37:20 +0000 (04:37 -0500)]
media: doc: poll: fix links to dual-ioctl sections

Links like :ref:`VIDIOC_STREAMON` expand to "ioctl VIDIOC_STREAMON,
VIDIOC_STREAMOFF". Thus our reader will think we are talking about
STREAMON _and_ STREAMOFF, but only one of the two actually applies
in some cases.

Fix by adding a link title, so the reader will read only the correct
ioctl name.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5695: Off by one in ov5695_enum_frame_sizes()
Dan Carpenter [Thu, 1 Mar 2018 10:07:14 +0000 (05:07 -0500)]
media: ov5695: Off by one in ov5695_enum_frame_sizes()

The ">" should be ">=" so that we don't read one element beyond the end
of the array.

Fixes: 8a77009be4be ("media: ov5695: add support for OV5695 sensor")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov2685: Not delay latch for gain
Shunqian Zheng [Thu, 1 Mar 2018 08:44:16 +0000 (03:44 -0500)]
media: ov2685: Not delay latch for gain

Update the register 0x3503 to use 'no delay latch' for gain.
This makes sensor to output the first frame as normal rather
than a very dark one.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: renesas-ceu: mark PM functions as __maybe_unused
Arnd Bergmann [Wed, 28 Feb 2018 23:19:37 +0000 (18:19 -0500)]
media: renesas-ceu: mark PM functions as __maybe_unused

The PM runtime operations are unused when CONFIG_PM is disabled,
leading to a harmless warning:

drivers/media/platform/renesas-ceu.c:1003:12: error: 'ceu_runtime_suspend' defined but not used [-Werror=unused-function]
 static int ceu_runtime_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~
drivers/media/platform/renesas-ceu.c:987:12: error: 'ceu_runtime_resume' defined but not used [-Werror=unused-function]
 static int ceu_runtime_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~

This adds a __maybe_unused annotation to shut up the warning.

Fixes: 32e5a70dc8f4 ("media: platform: Add Renesas CEU driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: renesas-ceu: Fix CSTRST_CPON mask
Jacopo Mondi [Tue, 27 Feb 2018 17:32:52 +0000 (12:32 -0500)]
media: platform: renesas-ceu: Fix CSTRST_CPON mask

The CSTRST_CPON mask was wrongly assigned to BIT(1) instead of BIT(0).
Fix that by changing the mask opportunely.

Reported-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: MAINTAINERS: add entry for cxd2099
Jasmin Jessich [Tue, 6 Mar 2018 16:39:13 +0000 (11:39 -0500)]
media: MAINTAINERS: add entry for cxd2099

The cxd2099 driver is now maintained and being taken care of by

  * Jasmin Jessich <jasmin@anw.at>

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/cxd2099: remove remainders from old attach way
Daniel Scheller [Tue, 6 Mar 2018 16:39:12 +0000 (11:39 -0500)]
media: dvb-frontends/cxd2099: remove remainders from old attach way

As all drivers using the cxd2099 are converted to handle attach/detach
the generic I2C client way, the static inline cxd2099_attach isn't
required anymore. Thus cleanup cxd2099.h from the remainders, the adr
struct member also isn't used anymore.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add I2C_FUNC_I2C to the I2C interface functionality
Daniel Scheller [Tue, 6 Mar 2018 16:39:11 +0000 (11:39 -0500)]
media: ngene: add I2C_FUNC_I2C to the I2C interface functionality

Report I2C_FUNC_I2C in .functionality() as well. The I2C interface can
handle this fine and even is required for all I2C client drivers that
utilise the regmap API which are used from within the ngene driver.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: adapt cxd2099 attach to new i2c_client way
Daniel Scheller [Tue, 6 Mar 2018 16:39:10 +0000 (11:39 -0500)]
media: ddbridge: adapt cxd2099 attach to new i2c_client way

Change the way the cxd2099 hardware is being attached to the new I2C
client interface way.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>