platform/kernel/linux-rpi.git
4 years agomedia: ipu3-imgu: Fixed some coding style issues in ipu3-css.c
Felix Winkler [Tue, 25 Jun 2019 15:03:46 +0000 (17:03 +0200)]
media: ipu3-imgu: Fixed some coding style issues in ipu3-css.c

Improved readability by fixing some issues related to maximum line length.

Signed-off-by: Felix Winkler <fxmw.tnt@gmail.com>
Signed-off-by: Niklas Witzel <nik.witzel@horsepower-hannover.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp/pci/atomisp_ioctl.c: strlcpy -> strscpy
Hans Verkuil [Thu, 17 Sep 2020 09:43:10 +0000 (11:43 +0200)]
media: atomisp/pci/atomisp_ioctl.c: strlcpy -> strscpy

strscpy is preferred over strlcpy and is the standard in the media subsystem.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp:pci/runtime/queue: modify the return error value
Xiaoliang Pang [Thu, 17 Sep 2020 03:44:51 +0000 (05:44 +0200)]
media: atomisp:pci/runtime/queue: modify the return error value

modify the return error value is -EDOM

Fixes: 2cac05dee6e30("drm/amd/powerplay: add the hw manager for vega12 (v4)")
Cc: Evan Quan <evan.quan@amd.com>
Signed-off-by: Xiaoliang Pang <dawning.pang@gmail.com>
Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: atomisp: Remove unnecessary 'fallthrough'
Cengiz Can [Mon, 31 Aug 2020 13:51:04 +0000 (15:51 +0200)]
media: staging: atomisp: Remove unnecessary 'fallthrough'

commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
with 'fallthrough' pseudo-keyword.

However, in one of the switch-case statements, Coverity Static Analyzer
throws a warning that 'fallthrough' is unreachable due to the adjacent
'return false' statement. (Coverity ID CID 1466511)

In order to fix the unreachable code warning, remove unnecessary
fallthrough keyword.

Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: media: atomisp: Fix bool-related style issues
Alex Dewar [Mon, 21 Sep 2020 21:53:59 +0000 (23:53 +0200)]
media: staging: media: atomisp: Fix bool-related style issues

Address the following issues:
 * unnecessary comparison to true/false
 * use of 0/1 instead of bool values
 * unnecessary conversion to bool

These were fixed using the following Coccinelle scripts:
 * scripts/coccinelle/misc/bool{init,conv,return}.cocci

Build-tested with allmodconfig.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging: media: atomisp: Don't do unnecessary zeroing of memory
Alex Dewar [Mon, 21 Sep 2020 21:53:55 +0000 (23:53 +0200)]
media: staging: media: atomisp: Don't do unnecessary zeroing of memory

In a few places in pci/sh_css_params.c, memset is used to zero memory
immediately before it is freed. As none of these structs appear to
contain sensitive information, just remove the calls to memset.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: remove an impossible condition
Mauro Carvalho Chehab [Thu, 17 Sep 2020 09:48:17 +0000 (11:48 +0200)]
media: vidtv: remove an impossible condition

As warned by smatch:

drivers/media/test-drivers/vidtv/vidtv_psi.c:93 vidtv_psi_update_version_num() warn: impossible condition '(h->version > 32) => (0-31 > 32)'

h_version is declared as:

u8  version:5;

Meaning that its value ranges from 0 to 31. Incrementing 31 on such
data will overflow to zero, as expected.

So, just drop the uneeded overflow check.

While here, use "foo++" instead of "++foo", as this is a much
more common pattern.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: cleanup the logic which estimates buffer size
Mauro Carvalho Chehab [Thu, 17 Sep 2020 09:03:37 +0000 (11:03 +0200)]
media: vidtv: cleanup the logic which estimates buffer size

There's no need to use u64 over there. In a matter of fact,
the div is not even needed, as it is multiplying by 1000 and
dividing by 1000.

So, simplify the logic.

While here, constrain the buffer size to a certain range
(between the current value and 10 times it)

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: fix build on 32bit architectures
Daniel W. S. Almeida [Wed, 16 Sep 2020 20:05:40 +0000 (22:05 +0200)]
media: vidtv: fix build on 32bit architectures

Fix the following error for builds on 32bit architectures:

ERROR: modpost: "__udivdi3"
[drivers/media/test-drivers/vidtv/dvb-vidtv-bridge.ko] undefined!

Which is due to 64bit divisions that did not go through the helpers
in linux/math64.h

As vidtv_mux_check_mux_rate was not operational in its current form,
drop the entire function while it is not fixed properly.

For now, call vidtv_mux_pad_with_nulls with a constant number of packets
to avoid warnings due to unused functions when building this driver.

The 64bit division used in the s302m is not needed, remove them and use
a fixed number of frames and a constant PTS increment instead.

Fixes: f90cf6079bf67988 ("media: vidtv: add a bridge driver")
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: Add a music instead of playing a single tone
Mauro Carvalho Chehab [Tue, 15 Sep 2020 13:50:52 +0000 (15:50 +0200)]
media: vidtv: Add a music instead of playing a single tone

Keep playing a single tone is not too nice, and prevents
checking some weird things.

So, instead, implement a simple tone generator, changing
the code to play a public domain song (5th Symphony of
Beethoven), using sinusoidal waves.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: get rid of its own sinusoidal waveform
Mauro Carvalho Chehab [Tue, 15 Sep 2020 11:24:42 +0000 (13:24 +0200)]
media: vidtv: get rid of its own sinusoidal waveform

Instead, use the code from linux/fixp-arith.h.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add a poor guy's simulation to preBER stats
Mauro Carvalho Chehab [Tue, 15 Sep 2020 08:06:52 +0000 (10:06 +0200)]
media: vidtv: add a poor guy's simulation to preBER stats

A typical digital TV stream has errors that are corrected
by Viterbi. While the error rate after Viterbi is usually
zero, with good signals, there are some chances of getting
random errors before that, which are auto-corrected by
the error code algorithm.

Add a poor guy's implementation that would show some
noise at the pre-BER part of the demod.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv.rst: update it to better describe the frequencies
Mauro Carvalho Chehab [Tue, 15 Sep 2020 07:18:32 +0000 (09:18 +0200)]
media: vidtv.rst: update it to better describe the frequencies

The virtual driver has now a minimal set of frequencies for a
single transponder to be found by each DVB standard.

Document it, and update related information about the
simulated LNBf.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: fix DVB-S/S2 tuning logic
Mauro Carvalho Chehab [Tue, 15 Sep 2020 06:25:56 +0000 (08:25 +0200)]
media: vidtv: fix DVB-S/S2 tuning logic

Satellite setups are different than terrestrial and cable ones,
as there is a device coupled at the antenna, called LNBf, which
converts the frequency from a GHz range at C-Band or Ku-Band
into an intermediate frequency at S-Band (ranging up to ~2GHz).

There are several different models of LNBf, with different
IF conversions, but the most common nowadays is called
Universal LNBf. Those got their frequency ranges extended in the
past, when Astra 19.2E sattellite was launched.

The universal LNBf has two local oscilators:

- 9.75 GHz
- 10.6 GHz

The first one is used when the frequency is between 10.7 GHz
up to 11.7 GHz. The second one is for frequencies between
11.7 GHz to 12.75 GHz.

With that, the IF signal will be at 950 MHz to 2,150 MHz range.

Add support for doing the above math, and make clear that
the frequencies expected by the driver should be at Ku-Band
range.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add DiSEqC dummy ops
Mauro Carvalho Chehab [Tue, 15 Sep 2020 06:42:04 +0000 (08:42 +0200)]
media: vidtv: add DiSEqC dummy ops

Those are needed for real applications to work with Satellite
systems.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: don't initialize cnr2qual var
Mauro Carvalho Chehab [Mon, 14 Sep 2020 13:55:35 +0000 (15:55 +0200)]
media: vidtv: don't initialize cnr2qual var

As reported by gcc:

drivers/media/test-drivers/vidtv/vidtv_demod.c: In function 'vidtv_demod_set_frontend':
drivers/media/test-drivers/vidtv/vidtv_demod.c:265:42: warning: variable 'cnr2qual' set but not used [-Wunused-but-set-variable]
  265 |  const struct vidtv_demod_cnr_to_qual_s *cnr2qual = NULL;
      |                                          ^~~~~~~~

It turns that the var is not needed at all. So, just drop it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: adjust signal strength range
Mauro Carvalho Chehab [Mon, 14 Sep 2020 13:17:18 +0000 (15:17 +0200)]
media: vidtv: adjust signal strength range

On real devices, signal strength is always a negative
number when represented in dBm. A more interesting
range is to use dBmV (which is what Kaffeine does,
for example). The conversion from the two units are
simple:

dBmV = dBm - 108

Usually, signal strength ranges up to 100dBmV. Adjust the
maximum value to be around 74 dBmV, when there's no
frequency shift, which represents a good signal.

With that, Kaffeine displays it a lot better.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: increment byte and block counters
Mauro Carvalho Chehab [Mon, 14 Sep 2020 06:34:26 +0000 (08:34 +0200)]
media: vidtv: increment byte and block counters

Add support for incrementing DVBv5 stats for block counters
and post/pre BER byte counts.

For now, the errors won't be incremented yet.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: get rid of the work queue
Mauro Carvalho Chehab [Sun, 13 Sep 2020 12:03:50 +0000 (14:03 +0200)]
media: vidtv: get rid of the work queue

The dvb_frontend will already call status periodically, when
a channel is tuned. So, no need to have a work queue for
such purpose.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add basic support for DVBv5 stats
Mauro Carvalho Chehab [Sun, 13 Sep 2020 09:01:23 +0000 (11:01 +0200)]
media: vidtv: add basic support for DVBv5 stats

The current stats code is broken on so many ways. It ends
reporting 0 for signal strengh, and the work queue doesn't
run. If it would run, the code would crash.

Fix such issues and add the minimum stuff for DVBv5 stats.

Right now, only strength and cnr and UCB are implemented.
pre/post BER stats will always return zero.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: properly initialize the internal state struct
Mauro Carvalho Chehab [Sun, 13 Sep 2020 11:08:05 +0000 (13:08 +0200)]
media: vidtv: properly initialize the internal state struct

Right now, the config data passed from the bridge driver is
just ignored.

Also, let's initialize the delayed work at probing time.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: remove a wrong endiannes check from s302m generator
Mauro Carvalho Chehab [Sun, 13 Sep 2020 05:31:08 +0000 (07:31 +0200)]
media: vidtv: remove a wrong endiannes check from s302m generator

The code there is already doing the right thing, as it uses
value & 0xff, value & 0xff00, which already ensures the
expected endiannes.

So, it doesn't make any sense to touch the order depending on
the CPU endiannes.

Yet, as pointed by Daniel at the mailing list:
https://lore.kernel.org/linux-media/e614351c-215c-c048-52af-7c200b164f41@xs4all.nl/T/#m8d221684a151833966359c2ed8bdce0f0ee4e5fd

The reverse code is needed by the decoder. So, keep it
no matter the endiannes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add an initial channel frequency
Mauro Carvalho Chehab [Sat, 12 Sep 2020 18:47:25 +0000 (20:47 +0200)]
media: vidtv: add an initial channel frequency

Use 474 MHz frequency for DVB-T/DVB-C, as this is the at the
channel range that it is valid on most places for DVB-T.

In the case of DVB-S, let's add Astra 19.2E initial
frequency at the scan files as the default, e. g. 12.5515 GHz.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: fix frequency tuning logic
Mauro Carvalho Chehab [Sat, 12 Sep 2020 18:50:34 +0000 (20:50 +0200)]
media: vidtv: fix frequency tuning logic

Right now, there are some issues at the tuning logic:

1) the config struct is not copied at the tuner driver.
   so, it won't use any frequency table at all;
2) the code that checks for frequency shifts is called
   at set_params. So, lock_status will never be zeroed;
3) the signal strength will also report a strong
   signal, even if not tuned;
4) the logic is not excluding non-set frequencies.

Fix those issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: get rid of ENDIAN_BITFIELD nonsense
Mauro Carvalho Chehab [Mon, 14 Sep 2020 09:28:18 +0000 (11:28 +0200)]
media: vidtv: get rid of ENDIAN_BITFIELD nonsense

The two places where ENDIAN_BITFIELD is used is for a single
8-bits integer. No need to correct endiannes on such cases.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: get rid of some endiannes nonsense
Mauro Carvalho Chehab [Sun, 13 Sep 2020 05:29:15 +0000 (07:29 +0200)]
media: vidtv: get rid of some endiannes nonsense

Genmask is always highest order to low order. It doesn't make
any sense to make it depends on endiannes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: fix 32-bit warnings
Mauro Carvalho Chehab [Sat, 12 Sep 2020 09:21:19 +0000 (11:21 +0200)]
media: vidtv: fix 32-bit warnings

There are several warnings produced when the driver is built
for 32-bit archs. Solve them.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: prefer using dev_foo() instead of pr_foo()
Mauro Carvalho Chehab [Sat, 12 Sep 2020 08:58:55 +0000 (10:58 +0200)]
media: vidtv: prefer using dev_foo() instead of pr_foo()

It is better to use the higher level dev_foo() than pr_foo()
for printks.

Change them at vidtv at the more trivial places.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add modaliases for the bridge driver
Mauro Carvalho Chehab [Sat, 12 Sep 2020 08:14:17 +0000 (10:14 +0200)]
media: vidtv: add modaliases for the bridge driver

As this virtual driver is probed manually, add modaliases
for this driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: firmware: Set virtual address ranges
Stanimir Varbanov [Mon, 17 Aug 2020 08:27:23 +0000 (10:27 +0200)]
media: venus: firmware: Set virtual address ranges

In order to boot some of the new Venus firmware versions TZ call to set
virtual address ranges is needed. Add virtual address ranges for CP and
CP_NONPIX in resource structure and use them when loading and booting
the firmware on remote processor.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: firmware: qcom_scm: Add memory protect virtual address ranges
Stanimir Varbanov [Mon, 17 Aug 2020 08:27:22 +0000 (10:27 +0200)]
media: firmware: qcom_scm: Add memory protect virtual address ranges

This adds a new SCM memprotect command to set virtual address ranges.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Elliot Berman <eberman@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: venc: Use helper to set profile and level
Stanimir Varbanov [Tue, 8 Sep 2020 12:19:14 +0000 (14:19 +0200)]
media: venus: venc: Use helper to set profile and level

We have a new helper to set profile and level use it
instead.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: vdec: Use helper to get profile and level
Stanimir Varbanov [Tue, 8 Sep 2020 12:12:10 +0000 (14:12 +0200)]
media: venus: vdec: Use helper to get profile and level

Currently the returned profile and level is not aligned with
v4l2 ctrl id. Correct that by use the helpers which translate
the v4l2 <-> hfi mapping internally.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: vdec: Set/Get VP9 profile/level
Stanimir Varbanov [Mon, 31 Aug 2020 12:01:38 +0000 (14:01 +0200)]
media: venus: vdec: Set/Get VP9 profile/level

Get and set VP9 codec profile and levels.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: helpers: Add a helper to map v4l2 ids to HFI ids
Stanimir Varbanov [Tue, 8 Sep 2020 08:50:21 +0000 (10:50 +0200)]
media: venus: helpers: Add a helper to map v4l2 ids to HFI ids

Introduce a helper to set and get profile and levels which
includes the translation between v4l2 ctrl ids and HFI ids.
The input arguments are always in v4l2 ids space.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: hfi_helper: Add VP9 profile and levels
Stanimir Varbanov [Tue, 8 Sep 2020 12:03:28 +0000 (14:03 +0200)]
media: venus: hfi_helper: Add VP9 profile and levels

Add HFI defines for VP9 codec profile and levels.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrl: Add VP9 codec levels
Stanimir Varbanov [Sat, 11 Jul 2020 12:52:36 +0000 (14:52 +0200)]
media: v4l2-ctrl: Add VP9 codec levels

Add menu control for VP9 codec levels. A total of 14 levels are
defined for Profile 0 (8bit) and Profile 2 (10bit). Each level
is a set of constrained bitstreams coded with targeted resolutions,
frame rates, and bitrates.

The definitions have been taken from webm project [1].

[1] https://www.webmproject.org/vp9/levels/

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: venus: core: Drop local dma_parms
Robin Murphy [Thu, 3 Sep 2020 21:14:26 +0000 (23:14 +0200)]
media: venus: core: Drop local dma_parms

Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
for platform devices"), struct platform_device already provides a
dma_parms structure, so we can save allocating another one.

Also the DMA segment size is simply a size, not a bitmask.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: media/test-drivers/Kconfig: fix broken Kconfig
Hans Verkuil [Sat, 12 Sep 2020 07:59:27 +0000 (09:59 +0200)]
media: media/test-drivers/Kconfig: fix broken Kconfig

menuconfig DVB_TEST_DRIVERS should be added after the V4L_TEST_DRIVERS,
otherwise there are no drivers listed in these two menus.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 24fb190e92e0 ("media: vidtv: implement a tuner driver")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: fix driver unbind/remove
Mauro Carvalho Chehab [Fri, 11 Sep 2020 11:14:36 +0000 (13:14 +0200)]
media: vidtv: fix driver unbind/remove

The current remove logic is broken and causes an OOPS.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: Documentation: vidtv: Add ReST documentation for vidtv
Daniel W. S. Almeida [Fri, 21 Aug 2020 12:58:48 +0000 (14:58 +0200)]
media: Documentation: vidtv: Add ReST documentation for vidtv

Add documentation for the Virtual Digital TV driver (vidtv) in the
Restructured Text (ReST) format.

This discusses:
- What is vidtv
- Why vidtv is needed
- How to build and run vidtv
- How vidtv is structured
- How to test vidtv
- How to improve vidtv

[mchehab: fixed bad whitespaces]

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: add a bridge driver
Daniel W. S. Almeida [Fri, 21 Aug 2020 12:58:47 +0000 (14:58 +0200)]
media: vidtv: add a bridge driver

Digital TV devices consist of several independent hardware components
which are controlled by different drivers.
Each media device is controlled by a group of cooperating drivers with the
bridge driver as the main driver.

This patch adds a bridge driver for the Virtual Digital TV driver [vidtv].

The bridge driver binds to the other drivers, that is, vidtv_tuner and
vidtv_demod and implements the digital demux logic, providing userspace
with a MPEG Transport Stream.

The MPEG related code is split in the following way:

- vidtv_ts: code to work with MPEG TS packets, such as TS headers,
adaptation fields, PCR packets and NULL packets.

- vidtv_psi: this is the PSI generator.
PSI packets contain general information about a MPEG Transport Stream.
A PSI generator is needed so userspace apps can retrieve information
about the Transport Stream and eventually tune into a (dummy) channel.

Because the generator is implemented in a separate file, it can be
reused elsewhere in the media subsystem.

Currently vidtv supports working with 3 PSI tables:
PAT, PMT and SDT.

- vidtv_pes: implements the PES logic to convert encoder data into
MPEG TS packets. These can then be fed into a TS multiplexer and
eventually into userspace.

- vidtv_s302m: implements a S302M encoder to make it possible to
insert PCM audio data in the generated MPEG Transport Stream.

This shall enable passing an audio signal into userspace so it can be
decoded and played by media software.

- vidtv_channels: Implements a 'channel' abstraction

When vidtv boots, it will create some hardcoded channels:

Their services will be concatenated to populate the SDT.
Their programs will be concatenated to populate the PAT
For each program in the PAT, a PMT section will be created
The PMT section for a channel will be assigned its streams.
Every stream will have its corresponding encoder polled to produce TS
packets
These packets may be interleaved by the mux and then delivered to the
bridge

- vidtv_mux - Implements a MPEG TS mux, loosely based on the ffmpeg
implementation

The multiplexer is responsible for polling encoders,
interleaving packets, padding the resulting stream with NULL packets if
necessary and then delivering the resulting TS packets to the bridge
driver so it can feed the demux.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: implement a demodulator driver
Daniel W. S. Almeida [Fri, 21 Aug 2020 12:58:46 +0000 (14:58 +0200)]
media: vidtv: implement a demodulator driver

Implement a I2C demodulator driver, simulating support for DVB-T, DVB-C
and DVB-S.

This demodulator will periodically check the signal quality against a table
and drop the TS lock if it drops below a threshold value, regaining it in
the event that the signal improves.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vidtv: implement a tuner driver
Daniel W. S. Almeida [Fri, 21 Aug 2020 12:58:45 +0000 (14:58 +0200)]
media: vidtv: implement a tuner driver

The virtual DVB test driver serves as a reference DVB driver and helps
validate the existing APIs in the media subsystem. It can also aid
developers working on userspace applications.

This dummy tuner should support common TV standards such as DVB-T/T2/S/S2,
ISDB-T and ATSC when completed.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: av7110: don't do float point math
Mauro Carvalho Chehab [Fri, 11 Sep 2020 07:27:35 +0000 (09:27 +0200)]
media: av7110: don't do float point math

It sounds that earlier versions of GCC have troubles when
doing const math at compile time, if no typecast is used:

on i386:
ERROR: modpost: "__floatunsidf" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: modpost: "__ltdf2" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!

The warning was generated on gcc (SUSE Linux) 7.5.0.
Gcc 9.2 compiles it fine.

As an added bonus, it also fixes this objtool warning:

drivers/media/pci/ttpci/av7110_v4l.c:163:11: error: SSE register return with SSE disabled

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ov8856: Add support for 3264x2448 mode
Robert Foss [Wed, 2 Sep 2020 14:10:37 +0000 (16:10 +0200)]
media: ov8856: Add support for 3264x2448 mode

OV8856 supports 3264x2448 @ 30 FPS, which is added
in this commit.

Signed-off-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ov8856: Add support for 1632x1224 mode
Robert Foss [Wed, 2 Sep 2020 14:10:36 +0000 (16:10 +0200)]
media: ov8856: Add support for 1632x1224 mode

OV8856 supports 1632x1224 @ 60 FPS, which is added
in this commit.

Signed-off-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fwnode: Document new usage patterns of v4l2_fwnode_endpoint_parse
Sakari Ailus [Tue, 8 Sep 2020 08:23:29 +0000 (10:23 +0200)]
media: v4l2-fwnode: Document new usage patterns of v4l2_fwnode_endpoint_parse

Document that it is possible to provide defaults for multiple bus types to
v4l2_fwnode_endpoint_parse and v4l2_fwnode_endpoint_alloc_parse. Also
underline the fact that detecting the bus type without bus-type property
is only for the old drivers.

Also correct capitalisation of BT.656.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fwnode: Make bus configuration a struct
Sakari Ailus [Tue, 8 Sep 2020 08:20:28 +0000 (10:20 +0200)]
media: v4l2-fwnode: Make bus configuration a struct

The bus specific parameters were a union. This made providing bus specific
defaults impossible as the memory used to store the defaults for multiple
different busses was the same.

Make it struct instead. It's not large so the size isn't really an issue.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fwnode: Make number of data lanes a character
Sakari Ailus [Tue, 8 Sep 2020 08:16:57 +0000 (10:16 +0200)]
media: v4l2-fwnode: Make number of data lanes a character

The maximum is currently four (4). No short is needed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: max9286: Allocate v4l2_async_subdev dynamically
Laurent Pinchart [Tue, 11 Aug 2020 20:59:39 +0000 (22:59 +0200)]
media: i2c: max9286: Allocate v4l2_async_subdev dynamically

v4l2_async_notifier_add_subdev() requires the asd to be allocated
dynamically, but the max9286 driver embeds it in the max9286_source
structure. This causes memory corruption when the notifier is destroyed
at remove time with v4l2_async_notifier_cleanup().

Fix this issue by registering the asd with
v4l2_async_notifier_add_fwnode_subdev(), which allocates it dynamically
internally. A new max9286_asd structure is introduced, to store a
pointer to the corresonding max9286_source that needs to be accessed
from bound and unbind callbacks. There's no need to take an extra
explicit reference to the fwnode anymore as
v4l2_async_notifier_add_fwnode_subdev() does so internally.

While at it, use %u instead of %d to print the unsigned index in the
error message from the v4l2_async_notifier_add_fwnode_subdev() error
path.

Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rcar-csi2: Allocate v4l2_async_subdev dynamically
Laurent Pinchart [Tue, 11 Aug 2020 20:59:38 +0000 (22:59 +0200)]
media: rcar-csi2: Allocate v4l2_async_subdev dynamically

v4l2_async_notifier_add_subdev() requires the asd to be allocated
dynamically, but the rcar-csi2 driver embeds it in the rcar_csi2
structure. This causes memory corruption when the notifier is destroyed
at remove time with v4l2_async_notifier_cleanup().

Fix this issue by registering the asd with
v4l2_async_notifier_add_fwnode_subdev(), which allocates it dynamically
internally.

Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rcar_drif: Allocate v4l2_async_subdev dynamically
Laurent Pinchart [Tue, 11 Aug 2020 20:59:37 +0000 (22:59 +0200)]
media: rcar_drif: Allocate v4l2_async_subdev dynamically

v4l2_async_notifier_add_subdev() requires the asd to be allocated
dynamically, but the rcar-drif driver embeds it in the
rcar_drif_graph_ep structure. This causes memory corruption when the
notifier is destroyed at remove time with v4l2_async_notifier_cleanup().

Fix this issue by registering the asd with
v4l2_async_notifier_add_fwnode_subdev(), which allocates it dynamically
internally.

Fixes: d079f94c9046 ("media: platform: Switch to v4l2_async_notifier_add_subdev")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rcar_drif: Fix fwnode reference leak when parsing DT
Laurent Pinchart [Tue, 11 Aug 2020 20:59:36 +0000 (22:59 +0200)]
media: rcar_drif: Fix fwnode reference leak when parsing DT

The fwnode reference corresponding to the endpoint is leaked in an error
path of the rcar_drif_parse_subdevs() function. Fix it, and reorganize
fwnode reference handling in the function to release references early,
simplifying error paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-async: Document asd allocation requirements
Laurent Pinchart [Tue, 11 Aug 2020 20:59:35 +0000 (22:59 +0200)]
media: v4l2-async: Document asd allocation requirements

The v4l2_async_notifier_add_subdev() function requires the asd pointer
it receives to be allocated dynamically, but doesn't explicitly say so.
Only one driver out of 13 get its right (atmel-sama5d2-isc.c, but with
memory leaks in the error paths), clearly showing we have an issue.

Update the v4l2_async_notifier_add_subdev() documentation to clearly
state the allocation requirement. Whether this will be enough to avoid
new offending code isn't certain, but it's a good first step
nonetheless.

Fixes: 9ca465312132 ("media: v4l: fwnode: Support generic parsing of graph endpoints in a device")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Fail probe on unsupported bus_type
Lad Prabhakar [Fri, 4 Sep 2020 20:18:35 +0000 (22:18 +0200)]
media: i2c: ov5640: Fail probe on unsupported bus_type

Fail probe if unsupported bus_type is detected.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Add support for BT656 mode
Lad Prabhakar [Fri, 4 Sep 2020 20:18:34 +0000 (22:18 +0200)]
media: i2c: ov5640: Add support for BT656 mode

Enable support for BT656 mode.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Configure HVP lines in s_power callback
Lad Prabhakar [Fri, 4 Sep 2020 20:18:33 +0000 (22:18 +0200)]
media: i2c: ov5640: Configure HVP lines in s_power callback

Configure HVP lines in s_power callback instead of configuring everytime
in ov5640_set_stream_dvp().

Alongside also disable MIPI in DVP mode.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Enable data pins on poweron for DVP mode
Lad Prabhakar [Fri, 4 Sep 2020 20:18:32 +0000 (22:18 +0200)]
media: i2c: ov5640: Enable data pins on poweron for DVP mode

During testing this sensor on iW-RainboW-G21D-Qseven platform in 8-bit DVP
mode with rcar-vin bridge noticed the capture worked fine for the first run
(with yavta), but for subsequent runs the bridge driver waited for the
frame to be captured. Debugging further noticed the data lines were
enabled/disabled in stream on/off callback and dumping the register
contents 0x3017/0x3018 in ov5640_set_stream_dvp() reported the correct
values, but yet frame capturing failed.

To get around this issue data lines are enabled in s_power callback.
(Also the sensor remains in power down mode if not streaming so power
consumption shouldn't be affected)

Fixes: f22996db44e2d ("media: ov5640: add support of DVP parallel interface")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Separate out mipi configuration from s_power
Lad Prabhakar [Fri, 4 Sep 2020 20:18:31 +0000 (22:18 +0200)]
media: i2c: ov5640: Separate out mipi configuration from s_power

In preparation for adding DVP configuration in s_power callback
move mipi configuration into separate function

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5640: Remain in power down for DVP mode unless streaming
Lad Prabhakar [Fri, 4 Sep 2020 20:18:30 +0000 (22:18 +0200)]
media: i2c: ov5640: Remain in power down for DVP mode unless streaming

Keep the sensor in software power down mode and wake up only in
ov5640_set_stream_dvp() callback.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fwnode: Use debug level for printing link frequencies
Sakari Ailus [Wed, 2 Sep 2020 12:04:12 +0000 (14:04 +0200)]
media: v4l2-fwnode: Use debug level for printing link frequencies

pr_info() was accidentally used to print the link frequencies whereas the
rest of the information is printed on debug level. Fix that by using
pr_debug() also for link frequencies.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: Remove Alan Chiang's e-mail address
Sakari Ailus [Wed, 2 Sep 2020 06:23:57 +0000 (08:23 +0200)]
media: i2c: Remove Alan Chiang's e-mail address

Alan Chiang's e-mail address no longer works. Remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Update Copyright year and fix indentation issues
Andy Shevchenko [Mon, 17 Aug 2020 16:07:33 +0000 (18:07 +0200)]
media: ipu3-cio2: Update Copyright year and fix indentation issues

Update Copyright year to cover the previous changes and at the same time
address indentation issues.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Drop useless assignments
Andy Shevchenko [Mon, 17 Aug 2020 16:07:32 +0000 (18:07 +0200)]
media: ipu3-cio2: Drop useless assignments

There are assignments inside the functions which are useless.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Drop bogus check and error message
Andy Shevchenko [Mon, 17 Aug 2020 16:07:31 +0000 (18:07 +0200)]
media: ipu3-cio2: Drop bogus check and error message

pcim_iomap_table() won't fail if previous pcim_iomap_regions() hasn't.
Since we check pcim_iomap_regions() for failure the check close to
pcim_iomap_table() is bogus and not needed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Get rid of pci_set_master() duplication
Andy Shevchenko [Mon, 17 Aug 2020 16:07:30 +0000 (18:07 +0200)]
media: ipu3-cio2: Get rid of pci_set_master() duplication

It's unclear why driver repeats the code from PCI core.
Drop it for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Use readl_poll_timeout() helper
Andy Shevchenko [Mon, 17 Aug 2020 16:07:29 +0000 (18:07 +0200)]
media: ipu3-cio2: Use readl_poll_timeout() helper

We may use special helper macro to poll IO till condition or timeout
occurs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Replace infinite loop by one with clear exit condition
Andy Shevchenko [Mon, 17 Aug 2020 16:07:28 +0000 (18:07 +0200)]
media: ipu3-cio2: Replace infinite loop by one with clear exit condition

Refactor cio2_buffer_done() to get rid of infinite loop by replacing it by
one with clear exit condition. This change also allows to check for an
error ahead.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Use macros from pfn.h
Andy Shevchenko [Mon, 17 Aug 2020 16:07:27 +0000 (18:07 +0200)]
media: ipu3-cio2: Use macros from pfn.h

There are few nice macros in pfn.h, some of which we may use here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu2-cio2: Replace custom definition with PAGE_SIZE
Andy Shevchenko [Mon, 17 Aug 2020 16:07:26 +0000 (18:07 +0200)]
media: ipu2-cio2: Replace custom definition with PAGE_SIZE

It's quite unlikely that another page size will be supported,
but in any case there is still an inconsistency between custom
page size definition and generic macros used in the driver.

Switch over to the generic PAGE_SIZE for sake of the consistency.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
Andy Shevchenko [Mon, 17 Aug 2020 16:07:25 +0000 (18:07 +0200)]
media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant

This constant is used in several places in the code, define it
for better maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: ipu3-cio2: Simplify cleanup code
Andy Shevchenko [Mon, 17 Aug 2020 16:07:24 +0000 (18:07 +0200)]
media: ipu3-cio2: Simplify cleanup code

The code looks more nicer if we use:
while (i--)
instead:
for (i = i - 1; i >= 0; i--)

This would also allow making 'i' unsigned again.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: omap3isp: Fix memleak in isp_probe
Dinghao Liu [Mon, 24 Aug 2020 06:53:52 +0000 (08:53 +0200)]
media: omap3isp: Fix memleak in isp_probe

When devm_ioremap_resource() fails, isp should be
freed just like other error paths in isp_probe.

Fixes: 8644cdf972dd6 ("[media] omap3isp: Replace many MMIO regions by two")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: staging/intel-ipu3: css: Correctly reset some memory
Christophe JAILLET [Sat, 22 Aug 2020 13:11:24 +0000 (15:11 +0200)]
media: staging/intel-ipu3: css: Correctly reset some memory

The intent here is to reset the whole 'scaler_coeffs_luma' array, not just
the first element.

Fixes: e11110a5b744 ("media: staging/intel-ipu3: css: Compute and program ccs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Convey full colorspace information to V4L2
Adam Goode [Wed, 2 Sep 2020 20:06:17 +0000 (22:06 +0200)]
media: uvcvideo: Convey full colorspace information to V4L2

The Color Matching Descriptor has been present in USB cameras since
the original version of UVC, but it has never been fully exposed
in Linux.

This change informs V4L2 of all of the UVC colorspace parameters:
color primaries, transfer characteristics, and YCbCr encoding.
videodev2.h doesn't have values for all the possible UVC color settings,
so it is mapped as closely as possible.

Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Ensure all probed info is returned to v4l2
Adam Goode [Sun, 23 Aug 2020 01:21:33 +0000 (03:21 +0200)]
media: uvcvideo: Ensure all probed info is returned to v4l2

bFrameIndex and bFormatIndex can be negotiated by the camera during
probing, resulting in the camera choosing a different format than
expected. v4l2 can already accommodate such changes, but the code was
not updating the proper fields.

Without such a change, v4l2 would potentially interpret the payload
incorrectly, causing corrupted output. This was happening on the
Elgato HD60 S+, which currently always renegotiates to format 1.

As an aside, the Elgato firmware is buggy and should not be renegotating,
but it is still a valid thing for the camera to do. Both macOS and Windows
will properly probe and read uncorrupted images from this camera.

With this change, both qv4l2 and chromium can now read uncorrupted video
from the Elgato HD60 S+.

[Add blank lines, remove periods at the of messages]

Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Silence shift-out-of-bounds warning
Laurent Pinchart [Tue, 18 Aug 2020 23:56:49 +0000 (01:56 +0200)]
media: uvcvideo: Silence shift-out-of-bounds warning

UBSAN reports a shift-out-of-bounds warning in uvc_get_le_value(). The
report is correct, but the issue should be harmless as the computed
value isn't used when the shift is negative. This may however cause
incorrect behaviour if a negative shift could generate adverse side
effects (such as a trap on some architectures for instance).

Regardless of whether that may happen or not, silence the warning as a
full WARN backtrace isn't nice.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Fix dereference of out-of-bound list iterator
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:30 +0000 (10:35 +0200)]
media: uvcvideo: Fix dereference of out-of-bound list iterator

Fixes the following coccinelle report:

drivers/media/usb/uvc/uvc_ctrl.c:1860:5-11:
ERROR: invalid reference to the index variable of the iterator on line 1854

by adding a boolean variable to check if the loop has found the

Found using - Coccinelle (http://coccinelle.lip6.fr)

[Replace cursor variable with bool found]

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Replace HTTP links with HTTPS ones
Alexander A. Klimov [Mon, 13 Jul 2020 16:22:46 +0000 (18:22 +0200)]
media: uvcvideo: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
  If not .svg:
    For each line:
      If doesn't contain `\bxmlns\b`:
  If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
            If both the HTTP and HTTPS versions
            return 200 OK and serve the same content:
              Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Cleanup uvc_ctrl_add_info() error handling
Hans de Goede [Tue, 28 Jul 2020 11:22:09 +0000 (13:22 +0200)]
media: uvcvideo: Cleanup uvc_ctrl_add_info() error handling

There is only 1 error exit in uvc_ctrl_add_info(), so using goto style
error handling is not necessary. Also the kfree(ctrl->uvc_data) on error
is not necessary, because the only error exit is for the kzalloc() of
ctrl->uvc_data failing.

Remove all the error handling cruft and simply do "return -ENOMEM" on
kzalloc() failure.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Fix uvc_ctrl_fixup_xu_info() not having any effect
Hans de Goede [Tue, 28 Jul 2020 11:22:08 +0000 (13:22 +0200)]
media: uvcvideo: Fix uvc_ctrl_fixup_xu_info() not having any effect

uvc_ctrl_add_info() calls uvc_ctrl_get_flags() which will override
the fixed-up flags set by uvc_ctrl_fixup_xu_info().

uvc_ctrl_init_xu_ctrl() already calls uvc_ctrl_get_flags() before
calling uvc_ctrl_add_info(), so the uvc_ctrl_get_flags() call in
uvc_ctrl_add_info() is not necessary for xu ctrls.

This commit moves the uvc_ctrl_get_flags() call for normal controls
from uvc_ctrl_add_info() to uvc_ctrl_init_ctrl(), so that we no longer
call uvc_ctrl_get_flags() twice for xu controls and so that we no longer
override the fixed-up flags set by uvc_ctrl_fixup_xu_info().

This fixes the xu motor controls not working properly on a Logitech
046d:08cc, and presumably also on the other Logitech models which have
a quirk for this in the uvc_ctrl_fixup_xu_info() function.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Set media controller entity functions
Laurent Pinchart [Sun, 7 Jun 2020 02:05:49 +0000 (04:05 +0200)]
media: uvcvideo: Set media controller entity functions

The media controller core prints a warning when an entity is registered
without a function being set. This affects the uvcvideo driver, as the
warning was added without first addressing the issue in existing
drivers. The problem is harmless, but unnecessarily worries users. Fix
it by mapping UVC entity types to MC entity functions as accurately as
possible using the existing functions.

Fixes: b50bde4e476d ("[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Add mapping for HEVC payloads
Dmitry Buzdyk [Fri, 29 May 2020 01:05:47 +0000 (03:05 +0200)]
media: uvcvideo: Add mapping for HEVC payloads

Add HEVC GUID and assotiate with HEVC pixel format so that frame
based format descriptors recognized by the UVC video driver.

Signed-off-by: Dmitry Buzdyk <dima.buzdyk@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: uvcvideo: Fix annotation for uvc_video_clock_update()
Jun Chen [Wed, 25 Dec 2019 02:34:17 +0000 (03:34 +0100)]
media: uvcvideo: Fix annotation for uvc_video_clock_update()

The formula (2) is to convert from SOF to host clock,
it should be fix as
"TS = ((TS2 - TS1) * SOF + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)"

Signed-off-by: Jun Chen <jun.chen@vatics.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: rcar-fcp: Drop local dma_parms
Robin Murphy [Thu, 3 Sep 2020 21:12:27 +0000 (23:12 +0200)]
media: rcar-fcp: Drop local dma_parms

Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
for platform devices"), struct platform_device already provides a
dma_parms structure, so we can save allocating another one.

Also the DMA segment size is simply a size, not a bitmask.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: usbvision: remove deprecated driver
Hans Verkuil [Tue, 1 Sep 2020 06:22:47 +0000 (08:22 +0200)]
media: usbvision: remove deprecated driver

To quote the TODO of this driver:

--------------------------------------------------------------
The driver is deprecated and scheduled for removal by the end
of 2020.

In order to prevent removal the following actions would have to
be taken:

- clean up the code
- convert to the vb2 framework
- fix the disconnect and free-on-last-user handling (i.e., add
  a release callback for struct v4l2_device and rework the code
  to use that correctly).
--------------------------------------------------------------

Nobody picked this up, so it's time to retire this driver.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: fix compile warning/error
Hans Verkuil [Tue, 8 Sep 2020 09:03:04 +0000 (11:03 +0200)]
media: vivid: fix compile warning/error

Fix this warning:

vivid-core.c: In function 'vivid_create_devnodes':
vivid-core.c:1318:11: warning: unused variable 'i' [-Wunused-variable]
 1318 |  int ret, i;
      |           ^

and this error:

vivid-core.c: In function 'vivid_create_instance':
vivid-core.c:1885:47: error: 'cec_tx_bus_cnt' undeclared (first use in this function)
 1885 |  ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt,
      |                                               ^~~~~~~~~~~~~~
vivid-core.c:1885:47: note: each undeclared identifier is reported only once for each function it appears in

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agoMerge tag 'v5.9-rc4' into patchwork
Mauro Carvalho Chehab [Mon, 7 Sep 2020 14:13:06 +0000 (16:13 +0200)]
Merge tag 'v5.9-rc4' into patchwork

Linux 5.9-rc4

* tag 'v5.9-rc4': (1001 commits)
  Linux 5.9-rc4
  io_uring: fix linked deferred ->files cancellation
  io_uring: fix cancel of deferred reqs with ->files
  include/linux/log2.h: add missing () around n in roundup_pow_of_two()
  mm/khugepaged.c: fix khugepaged's request size in collapse_file
  mm/hugetlb: fix a race between hugetlb sysctl handlers
  mm/hugetlb: try preferred node first when alloc gigantic page from cma
  mm/migrate: preserve soft dirty in remove_migration_pte()
  mm/migrate: remove unnecessary is_zone_device_page() check
  mm/rmap: fixup copying of soft dirty and uffd ptes
  mm/migrate: fixup setting UFFD_WP flag
  mm: madvise: fix vma user-after-free
  checkpatch: fix the usage of capture group ( ... )
  fork: adjust sysctl_max_threads definition to match prototype
  ipc: adjust proc_ipc_sem_dointvec definition to match prototype
  mm: track page table modifications in __apply_to_page_range()
  MAINTAINERS: IA64: mark Status as Odd Fixes only
  MAINTAINERS: add LLVM maintainers
  MAINTAINERS: update Cavium/Marvell entries
  mm: slub: fix conversion of freelist_corrupted()
  ...

4 years agomedia: atomisp: get rid of -Wsuggest-attribute=format warnings
Mauro Carvalho Chehab [Thu, 3 Sep 2020 11:56:30 +0000 (13:56 +0200)]
media: atomisp: get rid of -Wsuggest-attribute=format warnings

There are some warnings reported by gcc:
drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:164:2: warning: function ‘atomisp_css2_dbg_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:170:2: warning: function ‘atomisp_css2_dbg_ftrace_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:170:2: warning: function ‘atomisp_css2_dbg_ftrace_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:176:2: warning: function ‘atomisp_css2_err_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/staging/media/atomisp/pci/sh_css.c:1685:16: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]

That are due to the usage of printf-like messages without
enabling the error checking logic.

Add the proper attributes in order to shut up such warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: move a static constant out of a header file
Mauro Carvalho Chehab [Thu, 3 Sep 2020 13:35:19 +0000 (15:35 +0200)]
media: atomisp: move a static constant out of a header file

Gcc reports that input_formatter_alignment is not used:

In file included from ./drivers/staging/media/atomisp//pci/hive_isp_css_include/input_formatter.h:34,
                 from drivers/staging/media/atomisp//pci/runtime/debug/src/ia_css_debug.c:55:
./drivers/staging/media/atomisp//pci/hive_isp_css_common/host/input_formatter_local.h:118:27: warning: ‘input_formatter_alignment’ defined but not used [-Wunused-const-variable=]

However, it is, but only inside input_formatter.c.

So, move it out of the header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of unused vars
Mauro Carvalho Chehab [Thu, 3 Sep 2020 11:04:20 +0000 (13:04 +0200)]
media: atomisp: get rid of unused vars

There are several vars declared and set but unused:

drivers/staging/media/atomisp//pci/sh_css_param_shading.c:239:4: warning: variable ‘padded_width’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:1366:24: warning: variable ‘stream’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:2702:22: warning: variable ‘capture_pipe’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:2831:7: warning: variable ‘continuous’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:3534:15: warning: variable ‘num_output_pins’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:3937:55: warning: variable ‘vf_pp_binary’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:3937:38: warning: variable ‘preview_binary’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:3937:24: warning: variable ‘copy_binary’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:3936:26: warning: variable ‘me’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:5749:24: warning: variable ‘copy_binary’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:6013:7: warning: variable ‘continuous’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:6012:7: warning: variable ‘memory’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:7329:24: warning: variable ‘copy_binary’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:7459:26: warning: variable ‘num_vf_pp_stage’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css.c:10420:22: warning: variable ‘pipe_id’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css_params.c:1099:36: warning: variable ‘row_padding’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/sh_css_mipi.c:410:27: warning: variable ‘mipi_intermediate_info’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/atomisp_cmd.c:2814:31: warning: variable ‘stream_config’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/atomisp_cmd.c:2893:31: warning: variable ‘stream_config’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c:237:31: warning: variable ‘isp_data_ptr’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c:119:28: warning: variable ‘ver_num_isp’ set but not used [-Wunused-but-set-variable]
drivers/staging/media/atomisp//pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c:119:15: warning: variable ‘hor_num_isp’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: print a warning if error while setting downscaler
Mauro Carvalho Chehab [Thu, 3 Sep 2020 13:10:38 +0000 (15:10 +0200)]
media: atomisp: print a warning if error while setting downscaler

As warned by gcc:

    drivers/staging/media/atomisp//pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c:237:31: warning: variable ‘isp_data_ptr’ set but not used [-Wunused-but-set-variable]

ia_css_vf_configure() logic has an error var that detects troubles
when setting the kernel for downscaling. The driver just ignores
it, without producing any warning. Add at least a warning message
on such cases.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of some cleanup leftovers
Mauro Carvalho Chehab [Thu, 3 Sep 2020 11:10:36 +0000 (13:10 +0200)]
media: atomisp: get rid of some cleanup leftovers

The code that used to check for ISP2400/2401 version were
using the revision number in order to decide wheather
version should be used. With the new version, the code
doesn't need to check anymore for ISP version.

Fixes: ca133c395f2f ("media: atomisp: improve device detection code")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: fix error path
Mauro Carvalho Chehab [Wed, 2 Sep 2020 06:54:01 +0000 (08:54 +0200)]
media: vivid: fix error path

If something fails after calling v4l2_device_register(),
it should call v4l2_device_put().

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: move the devnode creation logic to a separate function
Mauro Carvalho Chehab [Tue, 1 Sep 2020 13:43:45 +0000 (15:43 +0200)]
media: vivid: move the devnode creation logic to a separate function

In order to reduce even further the size of the big
vivid_create_instance() function, let's place the part of the
logic which creates the device nodes into a separate function.

    With this and the past patches, those warnings finally
    vanishes:

            drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1189 vivid_create_instance() parse error: turning off implications after 60 seconds
            drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1257 vivid_create_instance() parse error: __split_smt: function too hairy.  Giving up after 303 seconds

The init code also seems more organized after breaking the long
function into a smaller set.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: move the create queues to a separate function
Mauro Carvalho Chehab [Tue, 1 Sep 2020 13:31:01 +0000 (15:31 +0200)]
media: vivid: move the create queues to a separate function

Instead of placing everything inside vivid_create_instance(),
we can move the part which creates per-type video queues
into a separate function.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: place dt timings init code on a separate function
Mauro Carvalho Chehab [Tue, 1 Sep 2020 13:22:21 +0000 (15:22 +0200)]
media: vivid: place dt timings init code on a separate function

Move those out of the big vivid_create_instance() function.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: move set_capabilities logic to a separate function
Mauro Carvalho Chehab [Tue, 1 Sep 2020 13:12:06 +0000 (15:12 +0200)]
media: vivid: move set_capabilities logic to a separate function

Move such logic from vivid_create_instance(), as otherwise
smatch takes forever.

The vivid_create_instance() is still a too big for my taste.
So, further cleanups are still needed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: vivid: place the logic which disables ioctl on a separate function
Mauro Carvalho Chehab [Tue, 1 Sep 2020 13:07:12 +0000 (15:07 +0200)]
media: vivid: place the logic which disables ioctl on a separate function

Move this code out of the long vivid_create_instance() function.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>