Commit graph

950409 commits

Author SHA1 Message Date
Yunfei Dong
bf1d556ad4 media: mtk-vcodec: abstract firmware interface
MT8183's codec firmware is run by a different remote processor from
MT8173. While the firmware interface is basically the same, the way to
invoke it differs. Abstract all firmware calls under a layer that will
allow us to handle both firmware types transparently.

[acourbot: refactor, cleanup and split]
[pihsun: fix error path and add mtk_vcodec_fw_release]
[hverkuil: fixed some checkpatch alignment warnings]
[hverkuil: fixed merge conflicts]

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Co-developed-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-26 09:53:52 +02:00
Alexandre Courbot
cbd2dca749 remoteproc: scp: add COMPILE_TEST dependency
This will improve this driver's build coverage.

Reported-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-26 09:40:05 +02:00
Mauro Carvalho Chehab
01cc2ec6ea media: atomisp: cleanup __printf() atributes on printk messages
There are still some warnings produced by -Wsuggest-attribute=format,
like this one:

	drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c: In function ‘dtrace_dot’:
	drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2466:2: warning: function ‘dtrace_dot’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
	 2466 |  ia_css_debug_vdtrace(IA_CSS_DEBUG_INFO, fmt, ap);
	      |  ^~~~~~~~~~~~~~~~~~~~

Also, on some places, is is using __atribute, while on others it
is using the __printf() macro.

Uniform those to always use the __printf() macro, placing it
before the function, and fix the logic in order to cleanup
all such warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-23 10:19:19 +02:00
Mauro Carvalho Chehab
8e3d5d4baf media: atomisp: fix gcc warnings
Depending on the gcc version, after changeset
72a9ff3bf7 ("media: atomisp: get rid of -Wsuggest-attribute=format warnings"),
we're now getting two warnings, which are breaking the Jenkins
CI instance at https://builder.linuxtv.org:

	../drivers/staging/media/atomisp/pci/atomisp_compat_css20.c: In function ‘__set_css_print_env’:
	../drivers/staging/media/atomisp/pci/atomisp_compat_css20.c:860:50: error: assignment to ‘int (*)(const char *, char *)’ from incompatible pointer type ‘int (__attribute__((regparm(0))) *)(const char *, char *)’ [-Werror=incompatible-pointer-types]
	   isp->css_env.isp_css_env.print_env.debug_print = vprintk;
	                                                  ^
	../drivers/staging/media/atomisp/pci/atomisp_compat_css20.c: In function ‘atomisp_css_load_firmware’:
	../drivers/staging/media/atomisp/pci/atomisp_compat_css20.c:893:49: error: assignment to ‘int (*)(const char *, char *)’ from incompatible pointer type ‘int (__attribute__((regparm(0))) *)(const char *, char *)’ [-Werror=incompatible-pointer-types]
	  isp->css_env.isp_css_env.print_env.error_print = vprintk;
                                                 ^
	cc1: some warnings being treated as errors

So, we need to partially revert the patch.

Fixes: 72a9ff3bf7 ("media: atomisp: get rid of -Wsuggest-attribute=format warnings")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-23 09:48:20 +02:00
Felix Winkler
8d526001ba 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>
2020-09-22 10:09:27 +02:00
Hans Verkuil
71458ac37b 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>
2020-09-22 10:07:28 +02:00
Xiaoliang Pang
f7e52078ce 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>
2020-09-22 10:07:06 +02:00
Cengiz Can
9ce5fe9584 media: staging: atomisp: Remove unnecessary 'fallthrough'
commit df561f6688 ("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>
2020-09-22 10:04:04 +02:00
Alex Dewar
2394984fee 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>
2020-09-22 10:03:20 +02:00
Alex Dewar
e2858fa617 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>
2020-09-22 10:02:10 +02:00
Mauro Carvalho Chehab
9e76f2cff7 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>
2020-09-17 12:03:36 +02:00
Mauro Carvalho Chehab
ad458524b3 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>
2020-09-17 12:03:18 +02:00
Daniel W. S. Almeida
37b288f54b 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: f90cf6079b ("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>
2020-09-17 12:02:58 +02:00
Mauro Carvalho Chehab
c5d83ba23e 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>
2020-09-17 12:02:01 +02:00
Mauro Carvalho Chehab
c2a9baf96f 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>
2020-09-17 12:01:40 +02:00
Mauro Carvalho Chehab
82d00a1a2a 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>
2020-09-17 12:01:20 +02:00
Mauro Carvalho Chehab
2cf846b1f3 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>
2020-09-17 12:00:58 +02:00
Mauro Carvalho Chehab
9ec6f4bb60 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>
2020-09-17 12:00:40 +02:00
Mauro Carvalho Chehab
d38829a5e1 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>
2020-09-17 12:00:19 +02:00
Mauro Carvalho Chehab
741043b02c 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>
2020-09-14 16:10:08 +02:00
Mauro Carvalho Chehab
d859a712a3 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>
2020-09-14 16:02:55 +02:00
Mauro Carvalho Chehab
9cf8572d6b 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>
2020-09-14 16:02:55 +02:00
Mauro Carvalho Chehab
f58cac01ab 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>
2020-09-14 16:02:54 +02:00
Mauro Carvalho Chehab
3e51a4965b 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>
2020-09-14 16:02:54 +02:00
Mauro Carvalho Chehab
96230dc134 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>
2020-09-14 16:02:54 +02:00
Mauro Carvalho Chehab
a6abe2f392 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>
2020-09-14 15:59:49 +02:00
Mauro Carvalho Chehab
1cb23db97a 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>
2020-09-14 15:49:43 +02:00
Mauro Carvalho Chehab
f3ea9da24b 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>
2020-09-14 15:49:08 +02:00
Mauro Carvalho Chehab
870e350d4e 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>
2020-09-14 15:48:48 +02:00
Mauro Carvalho Chehab
044e27ae78 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>
2020-09-14 15:48:31 +02:00
Mauro Carvalho Chehab
2e2fa2c51c 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>
2020-09-14 15:48:11 +02:00
Mauro Carvalho Chehab
9cfb4d36c2 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>
2020-09-14 15:47:51 +02:00
Mauro Carvalho Chehab
c9f968fac9 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>
2020-09-14 15:47:32 +02:00
Stanimir Varbanov
530ad31760 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>
2020-09-14 15:45:47 +02:00
Stanimir Varbanov
6d885330fa 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>
2020-09-14 15:45:25 +02:00
Stanimir Varbanov
435c53c369 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>
2020-09-14 15:44:09 +02:00
Stanimir Varbanov
5a86626efa 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>
2020-09-14 15:41:27 +02:00
Stanimir Varbanov
3cd136713b 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>
2020-09-14 15:40:59 +02:00
Stanimir Varbanov
2c2dc2fdc1 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>
2020-09-14 15:40:38 +02:00
Stanimir Varbanov
cbaa3117ea 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>
2020-09-14 15:40:04 +02:00
Stanimir Varbanov
5823833c9a 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>
2020-09-14 15:39:42 +02:00
Robin Murphy
0df720e59d media: venus: core: Drop local dma_parms
Since commit 9495b7e92f ("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>
2020-09-14 15:38:57 +02:00
Hans Verkuil
c4176e12a7 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: 24fb190e92 ("media: vidtv: implement a tuner driver")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-12 10:21:01 +02:00
Mauro Carvalho Chehab
63101b7568 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>
2020-09-12 09:43:54 +02:00
Daniel W. S. Almeida
1f9a704601 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>
2020-09-12 09:43:37 +02:00
Daniel W. S. Almeida
f90cf6079b 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>
2020-09-12 09:43:12 +02:00
Daniel W. S. Almeida
f5ffc3b6ed 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>
2020-09-12 09:42:34 +02:00
Daniel W. S. Almeida
24fb190e92 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>
2020-09-12 09:42:16 +02:00
Mauro Carvalho Chehab
5e8db34966 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>
2020-09-12 09:39:37 +02:00
Robert Foss
93c16fabdb 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>
2020-09-10 14:29:35 +02:00