OSDN Git Service

android-x86/kernel.git
6 years agomedia: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:38 +0000 (13:21 -0400)]
media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able

i2c message buf might be on stack.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-usb-v2/gl861: use usleep_range() for short delay
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:37 +0000 (13:21 -0400)]
media: dvb-usb-v2/gl861: use usleep_range() for short delay

As the kernel doc "timers-howto.txt" reads,
short delay with msleep() can take much longer.
In a case of raspbery-pi platform where CONFIG_HZ_100 was set,
it actually affected the init of Friio devices
since it issues lots of i2c transactions with short delay.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/dvb-pll: add tua6034 ISDB-T tuner used in Friio
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:35 +0000 (13:21 -0400)]
media: dvb-frontends/dvb-pll: add tua6034 ISDB-T tuner used in Friio

This driver already contains tua6034-based device settings,
but they are not for ISDB-T and have different parameters.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/dvb-pll: add i2c driver support
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:34 +0000 (13:21 -0400)]
media: dvb-frontends/dvb-pll: add i2c driver support

registers the module as an i2c driver,
but keeps dvb_pll_attach() untouched for compatibility.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l2-dev: use pr_foo() for printing messages
Mauro Carvalho Chehab [Thu, 5 Apr 2018 10:34:39 +0000 (06:34 -0400)]
media: v4l2-dev: use pr_foo() for printing messages

Instead of using printk() directly, use the pr_foo()
macros.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: platform: video-mux: propagate format from sink to source
Chris Lesiak [Tue, 3 Apr 2018 19:50:22 +0000 (15:50 -0400)]
media: platform: video-mux: propagate format from sink to source

Propagate the v4l2_mbus_framefmt to the source pad when either a sink
pad is activated or when the format of the active sink pad changes.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Fix open brace placement codding style
Nasser Afshin [Mon, 2 Apr 2018 22:23:19 +0000 (18:23 -0400)]
media: i2c: tvp5150: Fix open brace placement codding style

This patch resolves the following checkpatch.pl error:
    ERROR: that open brace { should be on the previous line

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Use the correct comment style
Nasser Afshin [Mon, 2 Apr 2018 22:23:18 +0000 (18:23 -0400)]
media: i2c: tvp5150: Use the correct comment style

This patch resolves checkpatch.pl warnings:
    WARNING: Block comments use * on subsequent lines
    WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Add a space after commas
Nasser Afshin [Mon, 2 Apr 2018 22:23:17 +0000 (18:23 -0400)]
media: i2c: tvp5150: Add a space after commas

This patch resolves checkpatch.pl errors:
    ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Use parentheses for sizeof
Nasser Afshin [Mon, 2 Apr 2018 22:23:20 +0000 (18:23 -0400)]
media: i2c: tvp5150: Use parentheses for sizeof

This patch resolves a checkpatch.pl warning:
    WARNING: sizeof *cap should be sizeof(*cap)

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: bttv: Fixed oops error when capturing at yuv410p
Samuel Williams [Sun, 1 Apr 2018 15:00:27 +0000 (11:00 -0400)]
media: bttv: Fixed oops error when capturing at yuv410p

When capturing at yuv410p, sg_next was called too many times when chroma is
false, eventually returning NULL. This patch does fix this for my hardware.

Signed-off-by: Samuel Williams <sam8641@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: tuners/qm1d1c0042: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:22 +0000 (13:08 -0400)]
media: tuners/qm1d1c0042: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: tuners/mxl301rf: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:21 +0000 (13:08 -0400)]
media: tuners/mxl301rf: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb/pci/pt3: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:20 +0000 (13:08 -0400)]
media: dvb/pci/pt3: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/tc90522: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:19 +0000 (13:08 -0400)]
media: dvb-frontends/tc90522: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-core/dvb_frontend: set better default for ISDB-T
Akihiro Tsukada [Tue, 27 Mar 2018 16:56:58 +0000 (12:56 -0400)]
media: dvb-core/dvb_frontend: set better default for ISDB-T

DTV_ISDBT_LAYER_ENABLED parameter should be set to "All" by default,
instead of "None", as described in the API document.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/tc90522: fix bit shift mistakes
Akihiro Tsukada [Tue, 27 Mar 2018 15:51:21 +0000 (11:51 -0400)]
media: dvb-frontends/tc90522: fix bit shift mistakes

GIT_AUTHOR_NAME=Akihiro TSUKADA
GIT_AUTHOR_EMAIL=tskd08@gmail.com

they were obviously wrong.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ov13858: Remove owner assignment from i2c_driver
Fabio Estevam [Sat, 24 Mar 2018 14:01:34 +0000 (10:01 -0400)]
media: ov13858: Remove owner assignment from i2c_driver

Structure i2c_driver does not need to set the owner field, as this will
be populated by the driver core.

Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ov5695: Remove owner assignment from i2c_driver
Fabio Estevam [Sat, 24 Mar 2018 14:01:33 +0000 (10:01 -0400)]
media: ov5695: Remove owner assignment from i2c_driver

Structure i2c_driver does not need to set the owner field, as this will
be populated by the driver core.

Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci.

Cc: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx-cards: output regular messages as info
Chris Mayo [Fri, 23 Mar 2018 19:47:13 +0000 (15:47 -0400)]
media: em28xx-cards: output regular messages as info

Messages expected during device probe were being marked as errors.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: pt3: no need to check if null for dvb_module_release()
Mauro Carvalho Chehab [Fri, 4 May 2018 18:23:43 +0000 (14:23 -0400)]
media: pt3: no need to check if null for dvb_module_release()

Such check is already there at the routine. So, no need to
repeat it outside.

Cc: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: media/dvb: earth-pt3: use the new i2c binding helper
Akihiro Tsukada [Mon, 19 Mar 2018 16:00:23 +0000 (12:00 -0400)]
media: media/dvb: earth-pt3: use the new i2c binding helper

This patch slightly simplifies the binding code by introducing commit
8f569c0b4e6b ("media: dvb-core: add helper functions for I2C binding").

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb: add alternative USB PID for Hauppauge WinTV-soloHD
Rainer Keller [Sun, 18 Mar 2018 12:40:16 +0000 (08:40 -0400)]
media: dvb: add alternative USB PID for Hauppauge WinTV-soloHD

Newer DVB receivers of this type have a different USB PID.

Signed-off-by: Rainer Keller <mail@rainerkeller.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge, cxd2099: include guard, fix unneeded NULL init, strings
Daniel Scheller [Sat, 17 Mar 2018 14:55:32 +0000 (10:55 -0400)]
media: ddbridge, cxd2099: include guard, fix unneeded NULL init, strings

Three really tiny minors in this single commit which all on their own
would just clutter up the commit history unnecessarily:

* ddbridge-regs.h is lacking an include guard. Add it.
* Fix an unnecessary NULL initialisation in ddbridge-ci. The declaration
  of the ci struct ptr is immediately followed by kzalloc().
* Clarify that the CXD2099AR is a Sony device in the cxd2099 driver at a
  few places including Kconfig.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cxd2880-spi: avoid out-of-bounds access warning
Arnd Bergmann [Tue, 13 Mar 2018 12:09:11 +0000 (08:09 -0400)]
media: cxd2880-spi: avoid out-of-bounds access warning

The -Warray-bounds warning in gcc-8 triggers for a newly added file:

drivers/media/spi/cxd2880-spi.c: In function 'cxd2880_write_reg':
drivers/media/spi/cxd2880-spi.c:111:3: error: 'memcpy' forming offset [133, 258] is out of the bounds [0, 132] of object 'send_data' with type 'u8[132]' {aka 'unsigned char[132]'} [-Werror=array-bounds]

The problem appears to be that we have two range checks in this function,
first comparing against BURST_WRITE_MAX (128) and then comparing against
a literal '255'. The logic checking the buffer size looks at the second
one and decides that this might be the actual maximum data length.

This is understandable behavior from the compiler, but the code is actually
safe. Since the first check is already shorter, we can remove the loop
and only leave that. To be on the safe side in case BURST_WRITE_MAX might
be increased, I'm leaving the check against U8_MAX.

Fixes: bd24fcddf6b8 ("media: cxd2880-spi: Add support for CXD2880 SPI interface")

Cc: Martin Sebor <msebor@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: don't use an uninitialized state
Mauro Carvalho Chehab [Fri, 4 May 2018 15:16:49 +0000 (11:16 -0400)]
media: lgdt330x: don't use an uninitialized state

If state is not initialized or is freed, we can't use it:
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: potential null dereference 'state'.  (kzalloc returns null)
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: we previously assumed 'state' could be null (see line 878)
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: dereferencing freed memory 'state'

Fixes: 23ba635d45f5 ("media: lgdt330x: convert it to the new I2C binding way")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: add block error counts via DVBv5
Mauro Carvalho Chehab [Fri, 9 Mar 2018 16:15:41 +0000 (11:15 -0500)]
media: lgdt330x: add block error counts via DVBv5

Show the UCB error counts via DVBv5.

Please notice that there's no scale indication at the driver.
As we don't have the datasheet, let's assume that it is receiving
data at a rate of 10.000 packets per second. Ideally, this should
be read or estimated.

In order to avoid flooding I2C bus with data, the maximum
polling rate for those stats was set to 1 second.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: get rid of read_ber stub
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:35 +0000 (10:53 -0500)]
media: lgdt330x: get rid of read_ber stub

This routine does nothing. Remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: provide DVBv5 Carrier S/N measurements
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:34 +0000 (10:53 -0500)]
media: lgdt330x: provide DVBv5 Carrier S/N measurements

Change the logic at the driver to provide CNR stats via
DVBv5 API.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: move *read_status functions
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:33 +0000 (10:53 -0500)]
media: lgdt330x: move *read_status functions

In preparation to implement DVBv5 stats on this driver, move
the *read_status functions to happen after SNR and signal
strength routines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: constify several register init arrays
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:32 +0000 (10:53 -0500)]
media: lgdt330x: constify several register init arrays

There are several register init arrays there that can be
constified.

The change reduced a little bit the amount of initialized
data:

   text    data     bss     dec     hex filename
   6372     360       4    6736    1a50 old/drivers/media/dvb-frontends/lgdt330x.o
   6500     264       4    6768    1a70 new/drivers/media/dvb-frontends/lgdt330x.o

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: do some cleanups at status logic
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:31 +0000 (10:53 -0500)]
media: lgdt330x: do some cleanups at status logic

Simplify a few ifs there.

While here, add debug messages for the 8-vsb and qam log status
flags.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: convert it to the new I2C binding way
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:30 +0000 (10:53 -0500)]
media: lgdt330x: convert it to the new I2C binding way

Convert the driver to allow its usage with the new I2C
binding way.

Please notice that this patch doesn't convert the
callers to bind to it using the new way.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: print info when device gets probed
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:29 +0000 (10:53 -0500)]
media: lgdt330x: print info when device gets probed

It is useful to know if the driver load succeded. So,
add a printk info there.

While here, improve the .init debug printed message.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: use pr_foo() macros
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:28 +0000 (10:53 -0500)]
media: lgdt330x: use pr_foo() macros

Cleanup the usecases of dprintk() by using pr_fmt() and replace
printk by pr_foo().

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: fix coding style issues
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:27 +0000 (10:53 -0500)]
media: lgdt330x: fix coding style issues

As we're about to convert this driver to use the new i2c
binding way, let's first solve most coding style issues,
in order to avoid mixing coding style changes with code
changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: use kernel-doc instead of inlined comments
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:26 +0000 (10:53 -0500)]
media: lgdt330x: use kernel-doc instead of inlined comments

Change the lgdt330x_config documentation to use kernel-doc
style.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx: fix a regression with HVR-950
Mauro Carvalho Chehab [Fri, 9 Mar 2018 12:21:45 +0000 (07:21 -0500)]
media: em28xx: fix a regression with HVR-950

Commit be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner
functionality") removed the logic with sets the alternate for the DVB
device. Without setting the right alternate, the device won't be
able to submit URBs, and userspace fails with -EMSGSIZE:

ERROR     DMX_SET_PES_FILTER failed (PID = 0x2000): 90 Message too long

Tested with Hauppauge HVR-950 model A1C0.

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

Cc: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l2-core: get rid of videobuf-dvb
Mauro Carvalho Chehab [Fri, 9 Mar 2018 08:30:48 +0000 (03:30 -0500)]
media: v4l2-core: get rid of videobuf-dvb

Videobuf has been replaced by videobuf2. Now, no drivers use
the videobuf-dvb helper module anymore. So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: get rid of videobuf-dvb dependency
Mauro Carvalho Chehab [Fri, 9 Mar 2018 08:30:47 +0000 (03:30 -0500)]
media: cx231xx: get rid of videobuf-dvb dependency

This driver doesn't use videobuf-dvb. So, stop adding an
unused struct and unused header on it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-usb-v2: stop using coherent memory for URBs
Mauro Carvalho Chehab [Thu, 8 Mar 2018 19:09:03 +0000 (14:09 -0500)]
media: dvb-usb-v2: stop using coherent memory for URBs

There's no need to use coherent buffers there. So, let the
DVB core do the allocation. That should give some performance
gain outside x86.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvbsky: fix driver unregister logic
Mauro Carvalho Chehab [Thu, 8 Mar 2018 18:47:39 +0000 (13:47 -0500)]
media: dvbsky: fix driver unregister logic

There's a user-after-free there, if the frontend is attached
via the new I2C way:

[  112.539806] usbcore: deregistering interface driver dvb_usb_dvbsky
[  112.568489] ==================================================================
[  112.568600] BUG: KASAN: use-after-free in dvb_unregister_frontend+0x18/0xb0 [dvb_core]
[  112.568610] Read of size 8 at addr ffff8803a6f61530 by task rmmod/2246

[  112.568622] CPU: 0 PID: 2246 Comm: rmmod Not tainted 4.16.0-rc4+ #103
[  112.568624] Hardware name:  /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017
[  112.568625] Call Trace:
[  112.568631]  dump_stack+0x5c/0x7c
[  112.568636]  print_address_description+0x6a/0x270
[  112.568640]  kasan_report+0x258/0x380
[  112.568657]  ? dvb_unregister_frontend+0x18/0xb0 [dvb_core]
[  112.568673]  dvb_unregister_frontend+0x18/0xb0 [dvb_core]
[  112.568681]  dvb_usbv2_exit+0x156/0x4a0 [dvb_usb_v2]
[  112.568689]  dvb_usbv2_disconnect+0xa0/0x140 [dvb_usb_v2]
[  112.568694]  usb_unbind_interface+0xd8/0x3f0
[  112.568700]  device_release_driver_internal+0x1ce/0x2f0
[  112.568705]  driver_detach+0x66/0xc0
[  112.568709]  bus_remove_driver+0x86/0x150
[  112.568713]  usb_deregister+0x90/0x180
[  112.568718]  SyS_delete_module+0x293/0x330
[  112.568721]  ? free_module+0x330/0x330
[  112.568725]  ? _cond_resched+0x16/0x50
[  112.568729]  ? task_work_run+0x7d/0xd0
[  112.568732]  ? mem_cgroup_handle_over_high+0x1c/0xc0
[  112.568736]  ? free_module+0x330/0x330
[  112.568740]  do_syscall_64+0xe7/0x250
[  112.568744]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  112.568747] RIP: 0033:0x7facafa272a7
[  112.568749] RSP: 002b:00007fffdea14cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[  112.568753] RAX: ffffffffffffffda RBX: 00007fffdea14d28 RCX: 00007facafa272a7
[  112.568755] RDX: 000000000000000a RSI: 0000000000000800 RDI: 00005599557337c8
[  112.568756] RBP: 0000559955733760 R08: 000000000000000a R09: 0000000000000000
[  112.568758] R10: 00007facafaa0280 R11: 0000000000000206 R12: 00007fffdea14ef0
[  112.568761] R13: 00007fffdea16eac R14: 0000559955733260 R15: 0000559955733760

[  112.568808] Allocated by task 638:
[  112.568816]  kasan_kmalloc+0xa0/0xd0
[  112.568820]  kmem_cache_alloc_trace+0x114/0x230
[  112.568826]  m88ds3103_probe+0x9a/0x643 [m88ds3103]
[  112.568830]  i2c_device_probe+0x2e9/0x3c0
[  112.568833]  driver_probe_device+0x46e/0x6a0
[  112.568836]  bus_for_each_drv+0xd6/0x130
[  112.568838]  __device_attach+0x166/0x1f0
[  112.568841]  bus_probe_device+0xea/0x110
[  112.568844]  device_add+0x6a3/0x9f0
[  112.568847]  i2c_new_device+0x28f/0x5c0
[  112.568861]  dvb_module_probe+0x91/0x110 [dvb_core]
[  112.568867]  dvbsky_s960c_attach+0x1c4/0x460 [dvb_usb_dvbsky]
[  112.568873]  dvb_usbv2_probe+0x1191/0x1950 [dvb_usb_v2]
[  112.568877]  usb_probe_interface+0x1b3/0x430
[  112.568880]  driver_probe_device+0x46e/0x6a0
[  112.568882]  __driver_attach+0xeb/0x110
[  112.568885]  bus_for_each_dev+0xe4/0x140
[  112.568888]  bus_add_driver+0x249/0x380
[  112.568891]  driver_register+0xc6/0x170
[  112.568893]  usb_register_driver+0xec/0x200
[  112.568896]  do_one_initcall+0x8f/0x1ee
[  112.568900]  do_init_module+0xde/0x320
[  112.568902]  load_module+0x3ed0/0x4850
[  112.568905]  SYSC_finit_module+0x192/0x1c0
[  112.568908]  do_syscall_64+0xe7/0x250
[  112.568911]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2

[  112.568916] Freed by task 2246:
[  112.568923]  __kasan_slab_free+0x136/0x180
[  112.568925]  kfree+0xa5/0x1e0
[  112.568931]  m88ds3103_remove+0x42/0x60 [m88ds3103]
[  112.568934]  i2c_device_remove+0x72/0xd0
[  112.568937]  device_release_driver_internal+0x1ce/0x2f0
[  112.568940]  bus_remove_device+0x197/0x270
[  112.568942]  device_del+0x239/0x550
[  112.568945]  device_unregister+0x16/0x70
[  112.568949]  dvbsky_exit+0x4c/0x70 [dvb_usb_dvbsky]
[  112.568955]  dvb_usbv2_disconnect+0x98/0x140 [dvb_usb_v2]
[  112.568958]  usb_unbind_interface+0xd8/0x3f0
[  112.568961]  device_release_driver_internal+0x1ce/0x2f0
[  112.568964]  driver_detach+0x66/0xc0
[  112.568967]  bus_remove_driver+0x86/0x150
[  112.568970]  usb_deregister+0x90/0x180
[  112.568973]  SyS_delete_module+0x293/0x330
[  112.568976]  do_syscall_64+0xe7/0x250
[  112.568979]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2

[  112.568985] The buggy address belongs to the object at ffff8803a6f61100
                which belongs to the cache kmalloc-2048 of size 2048
[  112.568998] The buggy address is located 1072 bytes inside of
                2048-byte region [ffff8803a6f61100ffff8803a6f61900)
[  112.569008] The buggy address belongs to the page:
[  112.569015] page:ffffea000e9bd800 count:1 mapcount:0 mapping:0000000000000000 index:0x0 compound_mapcount: 0
[  112.569025] flags: 0x17ffe000008100(slab|head)
[  112.569034] raw: 0017ffe000008100 0000000000000000 0000000000000000 00000001000f000f
[  112.569044] raw: ffffea000ee2d000 0000000500000005 ffff880407002a80 0000000000000000
[  112.569053] page dumped because: kasan: bad access detected

[  112.569062] Memory state around the buggy address:
[  112.569070]  ffff8803a6f61400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  112.569079]  ffff8803a6f61480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  112.569088] >ffff8803a6f61500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  112.569095]                                      ^
[  112.569103]  ffff8803a6f61580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  112.569112]  ffff8803a6f61600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  112.569119] ==================================================================
[  112.569127] Disabling lock debugging due to kernel taint
[  112.571161] dvb_usb_v2: 'DVBSky S960CI:2-2' successfully deinitialized and disconnected

Fix it by letting the dvb-usb-v2 core to know that the frontend
was already removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvbsky: use the new dvb_module_probe() API
Mauro Carvalho Chehab [Thu, 8 Mar 2018 18:47:38 +0000 (13:47 -0500)]
media: dvbsky: use the new dvb_module_probe() API

Instead of repeating countless times a complex logic, use
the new dvb_module_probe()/dvb_module_release(), simplifying
the module.

That reduced about 15% at the module's size:

   text    data     bss     dec     hex filename
   7083    1108      12    8203    200b old/drivers/media/usb/dvb-usb-v2/dvbsky.o
   5817    1108      12    6937    1b19 new/drivers/media/usb/dvb-usb-v2/dvbsky.o

Tested with a DVBSky S960C DVB-S2 tuner (0572:960c)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: set driver version to 0.9.33-integrated
Daniel Scheller [Mon, 9 Apr 2018 16:47:52 +0000 (12:47 -0400)]
media: ddbridge: set driver version to 0.9.33-integrated

Set DDBRIDGE_VERSION in ddbridge.h to 0.9.33-integrated to reflect the
updated driver.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: recognize and attach the MaxSX8 cards
Daniel Scheller [Mon, 9 Apr 2018 16:47:51 +0000 (12:47 -0400)]
media: ddbridge: recognize and attach the MaxSX8 cards

Add needed logic into dvb_input_attach(), ddb_port_probe() and
ddb_ports_init() to initialize and support these new cards.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: add hardware defs and PCI IDs for MCI cards
Daniel Scheller [Mon, 9 Apr 2018 16:47:50 +0000 (12:47 -0400)]
media: ddbridge: add hardware defs and PCI IDs for MCI cards

Add PCI IDs and ddb_info for the new MCI-based MaxSX8 cards. Also add
needed defines so the cards can be hooked up into ddbridge's probe and
attach handling.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge/max: implement MCI/MaxSX8 attach function
Daniel Scheller [Mon, 9 Apr 2018 16:47:49 +0000 (12:47 -0400)]
media: ddbridge/max: implement MCI/MaxSX8 attach function

Implement frontend attachment as ddb_fe_attach_mci() into the
ddbridge-max module. The MaxSX8 MCI cards are part of the Max card series
and make use of the LNB controller driven by the already existing lnb
functionality, so here's where this code belongs to.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: initial support for MCI-based MaxSX8 cards
Daniel Scheller [Mon, 9 Apr 2018 16:47:48 +0000 (12:47 -0400)]
media: ddbridge: initial support for MCI-based MaxSX8 cards

This adds initial support for the new MCI-based (micro-code interface)
DD cards, with the first one being the MaxSX8 eight-tuner DVB-S/S2/S2X
PCIe card. The MCI is basically a generalized interface implemented in
the card's FPGA firmware and usable for all kind of cards, without the
need to implement any demod/tuner drivers as this interface "hides" any
I2C interface to the actual ICs, in other words any required driver is
implemented in the card firmware.

At this stage, the MCI interface is quite rudimentary with things like
signal statistics reporting missing, but is already working to serve
DVB streams to DVB applications. Missing functionality will be enabled
over time.

This implements only the ddbridge-mci sub-object and hooks it up to the
Makefile so the object gets build. The upcoming commits hook this module
into all other ddbridge parts where required, including device IDs etc.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: support dummy tuners with 125MByte/s dummy data stream
Daniel Scheller [Mon, 9 Apr 2018 16:47:47 +0000 (12:47 -0400)]
media: ddbridge: support dummy tuners with 125MByte/s dummy data stream

The Octopus V3 and Octopus Mini devices support set up of a dummy tuner
mode on port 0 that will deliver a continuous data stream of 125MBytes
per second while raising IRQs and filling the DMA buffers, which comes
handy for some stress, PCIe link and IRQ handling testing. The dummy
frontend is registered using dvb_dummy_fe's QAM dummy frontend. Set
ddbridge.dummy_tuner to 1 to enable this on the supported cards.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: make DMA buffer count and size modparam-configurable
Daniel Scheller [Mon, 9 Apr 2018 16:47:46 +0000 (12:47 -0400)]
media: ddbridge: make DMA buffer count and size modparam-configurable

Make the number of DMA buffers and their size configurable using module
parameters. Being able to set these to a higher number might help on
busy systems when handling overall high data rates without having to
edit the driver sources and recompile things.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: set devid entry for link 0
Daniel Scheller [Mon, 9 Apr 2018 16:47:45 +0000 (12:47 -0400)]
media: ddbridge: set devid entry for link 0

Currently, /sys/class/ddbridgeX/devid always reports 0 due to devid not
being set at all. Set the devid field alongside while storing all other
hardware ID data.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: fix output buffer check
Daniel Scheller [Mon, 9 Apr 2018 16:47:44 +0000 (12:47 -0400)]
media: ddbridge: fix output buffer check

A 188 byte gap has to be left between the writer and the consumer. This
requires 2*188 bytes available to be able to write to the output buffers.
So, change ddb_output_free() to report free bytes according to this rule.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: use spin_lock_irqsave() in output_work()
Daniel Scheller [Mon, 9 Apr 2018 16:47:43 +0000 (12:47 -0400)]
media: ddbridge: use spin_lock_irqsave() in output_work()

Make sure to save IRQ states before taking the dma lock, as already done
in it's input_work() counterpart.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: improve separated MSI IRQ handling
Daniel Scheller [Mon, 9 Apr 2018 16:47:42 +0000 (12:47 -0400)]
media: ddbridge: improve separated MSI IRQ handling

Improve IRQ handling in the separated MSG/I2C and IO/TSDATA handlers by
applying a mask for recognized bits immediately upon reading the IRQ mask
from the hardware, so only the bits/IRQs that actually were set will be
acked.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: add macros to handle IRQs in nibble and byte blocks
Daniel Scheller [Mon, 9 Apr 2018 16:47:41 +0000 (12:47 -0400)]
media: ddbridge: add macros to handle IRQs in nibble and byte blocks

Currently, each IRQ requires one IRQ_HANDLE() line to call each IRQ
handler that was set up. Add a IRQ_HANDLE_NIBBLE() and IRQ_HANDLE_BYTE()
macro to call all handlers in blocks of four (_NIBBLE) or eight (_BYTE)
handlers at a time, to make this construct more compact.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: add helper for IRQ handler setup
Daniel Scheller [Mon, 9 Apr 2018 16:47:40 +0000 (12:47 -0400)]
media: ddbridge: add helper for IRQ handler setup

Introduce the ddb_irq_set() helper function (along with a matching
prototype in ddbridge.h) to improve the set up of the IRQ handlers
and handler_data, and rework storing this data into the ddb_link
using a new ddb_irq struct. This also does the necessary rework
of affected variables. And while at it, always do queue_work in
input_handler() as there's not much of a difference to directly
calling input_work if there's no ptr at input->redi, or queueing
this call.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: request/free_irq using pci_irq_vector, enable MSI-X
Daniel Scheller [Mon, 9 Apr 2018 16:47:39 +0000 (12:47 -0400)]
media: ddbridge: request/free_irq using pci_irq_vector, enable MSI-X

Instead of trying to manage IRQ numbers on itself, utilise the
pci_irq_vector() function to do this, which will take care of correct IRQ
numbering for MSI and non-MSI IRQs. While at it, request and enable MSI-X
interrupts for hardware (boards and cards) that support this.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: move MSI IRQ cleanup to a helper function
Daniel Scheller [Mon, 9 Apr 2018 16:47:38 +0000 (12:47 -0400)]
media: ddbridge: move MSI IRQ cleanup to a helper function

Introduce the ddb_msi_exit() helper to be used for cleaning up previously
allocated MSI IRQ vectors. Deduplicates code and makes things look
cleaner as for all cleanup work the CONFIG_PCI_MSI ifdeffery is only
needed in the helper now. Also, replace the call to the deprecated
pci_disable_msi() function with pci_free_irq_vectors().

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: move ddb_wq and the wq+class initialisation to -core
Daniel Scheller [Mon, 9 Apr 2018 16:47:37 +0000 (12:47 -0400)]
media: ddbridge: move ddb_wq and the wq+class initialisation to -core

Move the ddbridge module initialisation and cleanup code to ddbridge-core
and set up the ddb_wq workqueue there, and create and destroy the ddb
device class there aswell. Due to this, the prototypes for ddb_wq,
ddb_class_create() and ddb_class_destroy() aren't required in ddbridge.h
anymore, so remove them. Also, declare ddb_wq and the ddb_class_*()
functions static.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge: move modparams to ddbridge-core.c
Daniel Scheller [Mon, 9 Apr 2018 16:47:36 +0000 (12:47 -0400)]
media: ddbridge: move modparams to ddbridge-core.c

Besides the 'msi' module option, all options are used from within
ddbridge-core only, so move them over from ddbridge-main, and declare the
associated variables static. Since the prototypes in ddbridge.h aren't
necessary anymore now, remove them. As a side effect, this has the benefit
of aligning things more with the dddvb upstream.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/stv0910: fix CNR reporting in read_snr()
Daniel Scheller [Mon, 9 Apr 2018 16:47:35 +0000 (12:47 -0400)]
media: dvb-frontends/stv0910: fix CNR reporting in read_snr()

The CNR value determined in read_snr() is reported via the wrong variable.
It uses FE_SCALE_DECIBEL, which implies the value to be reported in svalue
instead of uvalue. Fix this accordingly.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/stv0910: add init values for TSINSDELM/L
Daniel Scheller [Mon, 9 Apr 2018 16:47:34 +0000 (12:47 -0400)]
media: dvb-frontends/stv0910: add init values for TSINSDELM/L

The TSINSDEL registers were lacking initialisation in the stv0910 demod
driver. Initialise them (both demods) in the probe() function.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: video-i2c: get rid of two gcc warnings
Mauro Carvalho Chehab [Fri, 4 May 2018 14:18:05 +0000 (10:18 -0400)]
media: video-i2c: get rid of two gcc warnings

After adding this driver, gcc complains with:

drivers/media/i2c/video-i2c.c:55:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
 const static struct v4l2_fmtdesc amg88xx_format = {
 ^~~~~
drivers/media/i2c/video-i2c.c:59:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
 const static struct v4l2_frmsize_discrete amg88xx_size = {
 ^~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: omap2: allow building it with COMPILE_TEST && DRM_OMAP
Mauro Carvalho Chehab [Fri, 20 Apr 2018 17:42:52 +0000 (13:42 -0400)]
media: omap2: allow building it with COMPILE_TEST && DRM_OMAP

Now that FB_OMAP has stubs, the omap2 media drivers can be
built on ARM with COMPILE_TEST && DRM_OMAP.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: omapfb: omapfb_dss.h: add stubs to build with COMPILE_TEST && DRM_OMAP
Mauro Carvalho Chehab [Fri, 20 Apr 2018 17:42:51 +0000 (13:42 -0400)]
media: omapfb: omapfb_dss.h: add stubs to build with COMPILE_TEST && DRM_OMAP

Add stubs for omapfb_dss.h, in the case it is included by
some driver when CONFIG_FB_OMAP2 is not defined, with can
happen on ARM when DRM_OMAP is not 'n'.

That allows building such driver(s) with COMPILE_TEST.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ipu3: allow building it with COMPILE_TEST on non-x86 archs
Mauro Carvalho Chehab [Fri, 20 Apr 2018 17:42:50 +0000 (13:42 -0400)]
media: ipu3: allow building it with COMPILE_TEST on non-x86 archs

Despite depending on ACPI, this driver builds fine on non-x86
archtecture with COMPILE_TEST, as it doesn't depend on
ACPI-specific functions/structs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rc: allow build pnp-dependent drivers with COMPILE_TEST
Mauro Carvalho Chehab [Fri, 20 Apr 2018 17:42:49 +0000 (13:42 -0400)]
media: rc: allow build pnp-dependent drivers with COMPILE_TEST

The pnp header already provide enough stub to build those
drivers with COMPILE_TEST on non-x86 archs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: sta2x11_vip: allow build with COMPILE_TEST
Mauro Carvalho Chehab [Fri, 20 Apr 2018 12:32:14 +0000 (08:32 -0400)]
media: sta2x11_vip: allow build with COMPILE_TEST

This driver doesn't use any weird API. So, allow building it
with COMPILE_TEST.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: radio: allow building ISA drivers with COMPILE_TEST
Mauro Carvalho Chehab [Fri, 20 Apr 2018 12:32:13 +0000 (08:32 -0400)]
media: radio: allow building ISA drivers with COMPILE_TEST

Several radio devices only build on i386, because they depend
on ISA. Allow them to build on other archs by adding a
COMPILE_TEST check.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: flexcop-i2c: get rid of KERN_CONT
Mauro Carvalho Chehab [Mon, 23 Apr 2018 12:29:09 +0000 (08:29 -0400)]
media: flexcop-i2c: get rid of KERN_CONT

Coverity complains about werid stuff at the debug logic:

CID 113542 (#1 of 1): Out-of-bounds access (ARRAY_VS_SINGLETON)10.
callee_ptr_arith: Passing buf to function flexcop_i2c_write4
which uses it as an array. This might corrupt or misinterpret
adjacent memory locations.

Instead of directly addressing the issue there, let's rework at
the logic there.

On newer kernels, KERN_CONT does nothing, as the previous message
won't wait for a continuation. Also, both flexcop_i2c_read4() and
flexcop_i2c_write4(), called by it, will print stuff if (debug &4).

So, the way it is is too buggy.

There are two kinds of debug stuff there: deb_i2c() and a code hidden
under #ifdef DUMP_I2C_MESSAGES, with can't be selected without touching
the source code.

Also, if both debug & 0x4 and DUMP_I2C_MESSAGES, flexcop_i2c_request()
will emit two debug messages per call with different data,
with sounds messy.

Simplify it by getting rid of DUMP_I2C_MESSAGES and adding a new
flag to debug (0x40), and making the debug logic there more
consistent.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: davinci: don't override the error code
Mauro Carvalho Chehab [Mon, 23 Apr 2018 11:22:19 +0000 (07:22 -0400)]
media: davinci: don't override the error code

As warned by Coverity:
CID 1415211 (#1 of 1): Unused value (UNUSED_VALUE)assigned_value:
Assigning value -22 to ret here, but that stored value is
overwritten before it can be used.

On all cases where the there's a goto 'unlock_out' or 'streamof',
ret was filled with a non-sero value. It toesn't make sense to override
such error code with a videobuf_streamoff() error.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx: Don't use ops->resume if NULL
Mauro Carvalho Chehab [Mon, 23 Apr 2018 11:02:39 +0000 (07:02 -0400)]
media: em28xx: Don't use ops->resume if NULL

Changeset  be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD
second tuner functionality") introduced a potential NULL pointer
dereference, as pointed by Coverity:

CID 1434731 (#1 of 1): Dereference after null check (FORWARD_NULL)16. var_deref_op: Dereferencing null pointer ops->resume.

var_compare_op: Comparing ops->resume to null implies that ops->resume might be null.
1174                if (ops->resume)
1175                        ops->resume(dev);
1176                if (dev->dev_next)
1177                        ops->resume(dev->dev_next);

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

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: s5p-jpeg: don't return a value on a void function
Mauro Carvalho Chehab [Fri, 20 Apr 2018 19:01:55 +0000 (15:01 -0400)]
media: s5p-jpeg: don't return a value on a void function

Building this driver on arm64 gives this warning:
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c:430:16: error: return expression in void function

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: siano: be sure to not override devpath size
Mauro Carvalho Chehab [Mon, 23 Apr 2018 13:14:30 +0000 (09:14 -0400)]
media: siano: be sure to not override devpath size

Right now, at siano driver, all places where devpath is
defined has sizeof(devpath) == 32. So, there's no practical
risc of going past devpath array anywhere.

Still, code changes might cause troubles. It also confuses
Coverity:
CID 139059 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
9. fixed_size_dest: You might overrun the 32-character
   fixed-size string entry->devpath by copying devpath
   without checking the length.
10. parameter_as_source: Note: This defect has an
    elevated risk because the source argument
    is a parameter of the current function.

So, explicitly limit strcmp() and strcpy() to ensure that the
devpath size (32) will be respected.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: siano: get rid of __le32/__le16 cast warnings
Mauro Carvalho Chehab [Fri, 20 Apr 2018 12:32:16 +0000 (08:32 -0400)]
media: siano: get rid of __le32/__le16 cast warnings

Those are all false-positives that appear with smatch when building for
arm:

  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
  drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
  drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16

Get rid of them by adding explicit forced casts.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agodrivers: omap2: Kconfig: make FB_OMAP2_DSS_INIT depend on OF
Anders Roxell [Fri, 20 Apr 2018 11:25:51 +0000 (13:25 +0200)]
drivers: omap2: Kconfig: make FB_OMAP2_DSS_INIT depend on OF

Commit 7378f1149884 ("media: omap2: omapfb: allow building it with
COMPILE_TEST") broke compilation without CONFIG_OF selected.
  CC      drivers/video/fbdev/core/fbmem.o
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c: In function ‘omapdss_update_prop’:
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c:68:2: error: implicit declaration of function ‘of_update_property’; did you mean ‘of_get_property’? [-Werror=implicit-function-declaration]
  of_update_property(node, prop);
  ^~~~~~~~~~~~~~~~~~
  of_get_property
cc1: some warnings being treated as errors
scripts/Makefile.build:312: recipe for target 'drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.o' failed
make[7]: *** [drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.o] Error 1
scripts/Makefile.build:559: recipe for target 'drivers/video/fbdev/omap2/omapfb/dss' failed
make[6]: *** [drivers/video/fbdev/omap2/omapfb/dss] Error 2
make[6]: *** Waiting for unfinished jobs....

Add OF dependency in order to make all configurations work again.

of_update_property() has no inline stub, and that that could be added as
an alternative.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rc: probe zilog transmitter when zilog receiver is found
Sean Young [Thu, 3 May 2018 10:38:40 +0000 (06:38 -0400)]
media: rc: probe zilog transmitter when zilog receiver is found

Both Hauppauge WinTV 44981 (bt878) and the HVR 1110 (saa7134) have a Zilog
Z8F0811. The transmitter was not probed. Receive and transmit tested on
both cards.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rc: imon decoder: support the stick
Sean Young [Wed, 18 Apr 2018 20:44:58 +0000 (16:44 -0400)]
media: rc: imon decoder: support the stick

The iMON PAD controller has a analog stick, which can be switched to
keyboard mode (cursor keys) or work as a crappy mouse.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rc: only register protocol for rc device if enabled
Sean Young [Sun, 12 Nov 2017 21:34:59 +0000 (16:34 -0500)]
media: rc: only register protocol for rc device if enabled

The raw_register function exists to create input devices associated with
that IR protocol.

If the mce_kbd module is loaded, then every rc device will have mce_kbd
input devices, even if the protocol is not enabled. Change this to call
the register function to when the protocol is enabled.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Rename BRU to BRx
Laurent Pinchart [Mon, 26 Feb 2018 16:06:21 +0000 (11:06 -0500)]
media: v4l: vsp1: Rename BRU to BRx

Some VSP instances have two blending units named BRU (Blend/ROP Unit)
and BRS (Blend/ROP Sub unit). The BRS is a smaller version of the BRU
with only two inputs, but otherwise offers similar features and offers
the same register interface. The BRU and BRS can be used exchangeably in
VSP pipelines (provided no more than two inputs are needed).

Due to historical reasons, the VSP1 driver implements support for both
the BRU and BRS through objects named vsp1_bru. The code uses the name
BRU to refer to either the BRU or the BRS, except in a few places where
noted explicitly. This creates confusion.

In an effort to avoid confusion, rename the vsp1_bru object and the
corresponding API to vsp1_brx, and use BRx to refer to blend unit
instances regardless of their type. The names BRU and BRS are retained
where reference to a particular blend unit type is needed, as well as in
hardware registers to stay close to the datasheet.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Add BRx dynamic assignment debugging messages
Laurent Pinchart [Fri, 23 Feb 2018 23:58:48 +0000 (18:58 -0500)]
media: v4l: vsp1: Add BRx dynamic assignment debugging messages

Dynamic assignment of the BRU and BRS to pipelines is prone to
regressions, add messages to make debugging easier. Keep it as a
separate commit to ease removal of those messages once the code will
deem to be completely stable.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Assign BRU and BRS to pipelines dynamically
Laurent Pinchart [Thu, 22 Feb 2018 19:26:21 +0000 (14:26 -0500)]
media: v4l: vsp1: Assign BRU and BRS to pipelines dynamically

The VSPDL variant drives two DU channels through two LIF and two
blenders, BRU and BRS. The DU channels thus share the five available
VSPDL inputs and expose them as five KMS planes.

The current implementation assigns the BRS to the second LIF and thus
artificially limits the number of planes for the second display channel
to two at most.

Lift this artificial limitation by assigning the BRU and BRS to the
display pipelines on demand based on the number of planes used by each
pipeline. When a display pipeline needs more than two inputs and the BRU
is already in use by the other pipeline, this requires reconfiguring the
other pipeline to free the BRU before processing, which can result in
frame drop on both pipelines.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Generalize detection of entity removal from DRM pipeline
Laurent Pinchart [Mon, 26 Feb 2018 09:22:40 +0000 (04:22 -0500)]
media: v4l: vsp1: Generalize detection of entity removal from DRM pipeline

When disabling a DRM plane, the corresponding RPF is only marked as
removed from the pipeline in the atomic update handler, with the actual
removal happening when configuring the pipeline at atomic commit time.
This is required as the RPF has to be disabled in the hardware, which
can't be done from the atomic update handler.

The current implementation is RPF-specific. Make it independent of the
entity type by using the entity's pipe pointer to mark removal from the
pipeline. This will allow using the mechanism to remove BRU instances.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Add per-display list internal completion notification support
Laurent Pinchart [Thu, 22 Feb 2018 19:26:21 +0000 (14:26 -0500)]
media: v4l: vsp1: Add per-display list internal completion notification support

Display list completion is already reported to the frame end handler,
but that mechanism is global to all display lists. In order to implement
BRU and BRS reassignment in DRM pipelines we will need to commit a
display list and wait for its completion internally, without reporting
it to the DRM driver. Extend the display list API to support such an
internal use of the display list.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Turn frame end completion status into a bitfield
Laurent Pinchart [Wed, 4 Apr 2018 21:30:49 +0000 (17:30 -0400)]
media: v4l: vsp1: Turn frame end completion status into a bitfield

We will soon need to return more than a boolean completion status from
the vsp1_dlm_irq_frame_end() IRQ handler. Turn the return value into a
bitfield to prepare for that. No functional change is introduced here.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Move DRM pipeline output setup code to a function
Laurent Pinchart [Thu, 22 Feb 2018 19:26:21 +0000 (14:26 -0500)]
media: v4l: vsp1: Move DRM pipeline output setup code to a function

In order to make the vsp1_du_setup_lif() easier to read, and for
symmetry with the DRM pipeline input setup, move the pipeline output
setup code to a separate function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Replace manual DRM pipeline input setup in vsp1_du_setup_lif
Laurent Pinchart [Thu, 22 Feb 2018 19:26:21 +0000 (14:26 -0500)]
media: v4l: vsp1: Replace manual DRM pipeline input setup in vsp1_du_setup_lif

The vsp1_du_setup_lif() function sets up the DRM pipeline input
manually. This duplicates the code from the
vsp1_du_pipeline_setup_inputs() function. Replace the manual
implementation by a call to the function.

As the pipeline has no enabled input in vsp1_du_setup_lif(), the
vsp1_du_pipeline_setup_inputs() function will not setup any RPF, and
will thus not setup formats on the BRU sink pads. This isn't a problem
as all inputs are disabled, and the BRU sink pads will be reconfigured
from the atomic commit handler when inputs will be enabled.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Setup BRU at atomic commit time
Laurent Pinchart [Thu, 22 Feb 2018 19:26:21 +0000 (14:26 -0500)]
media: v4l: vsp1: Setup BRU at atomic commit time

To implement fully dynamic plane assignment to pipelines, we need to
reassign the BRU and BRS to the DRM pipelines in the atomic commit
handler. In preparation for this setup factor out the BRU source pad
code and call it both at LIF setup and atomic commit time.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Move DRM atomic commit pipeline setup to separate function
Laurent Pinchart [Fri, 23 Feb 2018 20:35:00 +0000 (15:35 -0500)]
media: v4l: vsp1: Move DRM atomic commit pipeline setup to separate function

The DRM pipeline setup code used at atomic commit time is similar to the
setup code used when enabling the pipeline. Move it to a separate
function in order to share it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Share duplicated DRM pipeline configuration code
Laurent Pinchart [Fri, 23 Feb 2018 20:35:00 +0000 (15:35 -0500)]
media: v4l: vsp1: Share duplicated DRM pipeline configuration code

Move the duplicated DRM pipeline configuration code to a function and
call it from vsp1_du_setup_lif() and vsp1_du_atomic_flush().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Use vsp1_entity.pipe to check if entity belongs to a pipeline
Laurent Pinchart [Thu, 22 Feb 2018 22:27:47 +0000 (17:27 -0500)]
media: v4l: vsp1: Use vsp1_entity.pipe to check if entity belongs to a pipeline

The DRM pipeline handling code uses the entity's pipe list head to check
whether the entity is already included in a pipeline. This method is a
bit fragile in the sense that it uses list_empty() on a list_head that
is a list member. Replace it by a simpler check for the entity pipe
pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Store pipeline pointer in vsp1_entity
Laurent Pinchart [Thu, 22 Feb 2018 22:22:43 +0000 (17:22 -0500)]
media: v4l: vsp1: Store pipeline pointer in vsp1_entity

Various types of objects subclassing vsp1_entity currently store a
pointer to the pipeline. Move the pointer to vsp1_entity to simplify the
code and avoid storing the pipeline in more entity subclasses later.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Remove unused field from vsp1_drm_pipeline structure
Laurent Pinchart [Fri, 23 Feb 2018 20:21:40 +0000 (15:21 -0500)]
media: v4l: vsp1: Remove unused field from vsp1_drm_pipeline structure

The vsp1_drm_pipeline enabled field is set but never used. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l: vsp1: Don't start/stop media pipeline for DRM
Laurent Pinchart [Thu, 22 Feb 2018 17:12:36 +0000 (12:12 -0500)]
media: v4l: vsp1: Don't start/stop media pipeline for DRM

The DRM support code manages a pipeline of VSP entities, each backed by
a media entity. When starting or stopping the pipeline, it starts and
stops the media pipeline through the media API in order to store the
pipeline pointer in every entity.

The driver doesn't use the pipe pointer in media entities, neither does
it rely on the other effects of the media_pipeline_start() and
media_pipeline_stop() functions. Furthermore, as the media links for the
DRM pipeline are never set up correctly, and as the pipeline can be
modified dynamically when enabling or disabling planes, the current
implementation is not correct. Remove the incorrect and unneeded code.

While at it remove the outdated comment that states that entities are
not started when the LIF is setup, as they now are.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Use the constant for supported standards
Hugo Grostabussiat [Sun, 8 Apr 2018 21:12:01 +0000 (17:12 -0400)]
media: usbtv: Use the constant for supported standards

Use the USBTV_TV_STD define instead of repeating ourselves.

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Enforce standard for color decoding
Hugo Grostabussiat [Sun, 8 Apr 2018 21:12:00 +0000 (17:12 -0400)]
media: usbtv: Enforce standard for color decoding

Depending on the chosen standard, configure the decoder to use the
appropriate color encoding standard (PAL-like, NTSC-like or SECAM).

Until now, the decoder was not configured for a specific color standard,
making it autodetect the color encoding.

While this may sound fine, it potentially causes the wrong image tuning
parameters to be applied (e.g. tuning parameters for NTSC are applied to
a PAL source), and may confuse users about what the actual standard is
in use.

This commit explicitly configures the color standard the decoder will
use, making it visually obvious if a wrong standard was chosen.

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Keep norm parameter specific
Hugo Grostabussiat [Sun, 8 Apr 2018 21:11:59 +0000 (17:11 -0400)]
media: usbtv: Keep norm parameter specific

The user-supplied norm value gets overwritten by the generic .norm
member from the norm_params. That way, we lose the specific norm the
user may want to set.

For instance, if the user specifies V4L2_STD_PAL_60, the value actually
used will be V4L2_STD_525_60, which in the end will be as if the user
had specified V4L2_STD_NTSC, since this is always the first bitfield we
match the norm value against before configuring the hardware.

The norm_params array is only there to match a norm with an output
resolution. The norm value itself should not be changed.

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Use V4L2 defines to select capture resolution
Hugo Grostabussiat [Sun, 8 Apr 2018 21:11:58 +0000 (17:11 -0400)]
media: usbtv: Use V4L2 defines to select capture resolution

Make use of the V4L2_STD_525_60 and V4L2_STD_625_50 defines to
determine the vertical resolution to use when capturing.

V4L2_STD_525_60 (resp. V4L2_STD_625_50) is the set of standards using
525 (resp. 625) lines per frame, independently of the color encoding.

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Add SECAM support
Hugo Grostabussiat [Sun, 8 Apr 2018 21:11:57 +0000 (17:11 -0400)]
media: usbtv: Add SECAM support

Add support for the SECAM norm, using the "AVSECAM" decoder configuration
sequence found in Windows driver's .INF file.

For reference, the "AVSECAM" sequence in the .INF file is:
0x04,0x73,0xDC,0x72,0xA2,0x90,0x35,0x01,0x30,0x04,0x08,0x2D,0x28,0x08,
0x02,0x69,0x16,0x35,0x21,0x16,0x36

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: usbtv: Use same decoder sequence as Windows driver
Hugo Grostabussiat [Sun, 8 Apr 2018 21:11:56 +0000 (17:11 -0400)]
media: usbtv: Use same decoder sequence as Windows driver

Re-format the register {address, value} pairs so they follow the same
order as the decoder configuration sequences in the Windows driver's .INF
file.

For instance, for PAL, the "AVPAL" sequence in the .INF file is:
0x04,0x68,0xD3,0x72,0xA2,0xB0,0x15,0x01,0x2C,0x10,0x20,0x2e,0x08,0x02,
0x02,0x59,0x16,0x35,0x17,0x16,0x36

Signed-off-by: Hugo Grostabussiat <bonstra@bonstra.fr.eu.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>