]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/log
mirror_ubuntu-hirsute-kernel.git
6 years agomedia: ngene: use common DVB I2C client handling helpers
Daniel Scheller [Wed, 7 Mar 2018 20:07:56 +0000 (15:07 -0500)]
media: ngene: use common DVB I2C client handling helpers

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Enables lgdt3306a|si2168 + si2157

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

Nit regarding hard coded value.

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

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

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

Add missing composite and s-video inputs.

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

Utilize the i2c mux adapter returned by the frontend.

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

Coding style fix.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Remove unnecessary semicolon found using semicolon.cocci Coccinelle
script.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This adds a __maybe_unused annotation to shut up the warning.

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

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

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

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

  * Jasmin Jessich <jasmin@anw.at>

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

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

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

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

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

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

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: Unregister async subdevice
Jacopo Mondi [Fri, 2 Mar 2018 14:46:43 +0000 (09:46 -0500)]
media: ov772x: Unregister async subdevice

As the media subdevice is registered with 'v4l2_async_register_subdev()'
unregister it at module removal time with
'v4l2_async_unregister_subdev()'

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: Replace msleep(1) with usleep_range
Jacopo Mondi [Fri, 2 Mar 2018 14:46:42 +0000 (09:46 -0500)]
media: ov772x: Replace msleep(1) with usleep_range

msleep() can sleep up to 20ms.

As suggested by Documentation/timers/timers_howto.txt replace it with
usleep_range() with up to 5ms delay.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: Empty line before end-of-function return
Jacopo Mondi [Fri, 2 Mar 2018 14:46:40 +0000 (09:46 -0500)]
media: ov772x: Empty line before end-of-function return

Add an empty line before return at the end of functions.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: Re-organize in-code comments
Jacopo Mondi [Fri, 2 Mar 2018 14:46:39 +0000 (09:46 -0500)]
media: ov772x: Re-organize in-code comments

A lot of comments that would fit a single line were spread on two or
more lines. Also fix capitalization and punctuation where appropriate.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: Align function parameters
Jacopo Mondi [Fri, 2 Mar 2018 14:46:38 +0000 (09:46 -0500)]
media: ov772x: Align function parameters

Align all function parameters to first open brace when declaring
functions.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Replace msleep(1) with usleep_range
Jacopo Mondi [Fri, 2 Mar 2018 14:46:37 +0000 (09:46 -0500)]
media: tw9910: Replace msleep(1) with usleep_range

msleep() can sleep up to 20ms.

As suggested by Documentation/timers/timers_howto.txt replace it with
usleep_range() with up to 5ms delay.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Sort includes alphabetically
Jacopo Mondi [Fri, 2 Mar 2018 14:46:36 +0000 (09:46 -0500)]
media: tw9910: Sort includes alphabetically

Sort include directives alphabetically to ease maintenance.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Mixed style fixes
Jacopo Mondi [Fri, 2 Mar 2018 14:46:35 +0000 (09:46 -0500)]
media: tw9910: Mixed style fixes

Two minor style fixes, align function parameter and remove un-necessary
spaces.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Miscellaneous neatening
Joe Perches [Thu, 1 Mar 2018 12:01:22 +0000 (07:01 -0500)]
media: tw9910: Miscellaneous neatening

Yet more whitespace and style neatening

o Add blank lines before returns
o Reverse a logic test and return early on error
o Move formats to same line as dev_<level> calls
o Remove an unnecessary period from a logging message

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Whitespace alignment
Joe Perches [Thu, 1 Mar 2018 11:50:22 +0000 (06:50 -0500)]
media: tw9910: Whitespace alignment

Update multiline statements to open parenthesis.
Update a ?: to a single line.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tw9910: Re-organize in-code comments
Jacopo Mondi [Fri, 2 Mar 2018 14:46:34 +0000 (09:46 -0500)]
media: tw9910: Re-organize in-code comments

A lot of comments that would fit a single line were spread on two or
more lines. Also fix capitalization and punctuation where appropriate.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add proper polling to the dvbdev_ci file ops
Daniel Scheller [Sun, 25 Feb 2018 17:06:56 +0000 (12:06 -0500)]
media: ngene: add proper polling to the dvbdev_ci file ops

Implement the poll callback for the dvbdev_ci file ops. The ts_poll()
function queries the DVB ring buffers for available data and space, and
reports this as appropriate. Also, set the dvb_device readers, writers
and users to proper values (one reader, one writer, two users).

This fixes the raw CI TS transport in conjunction with TVheadend's
DDCI functionality.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: don't treat non-existing demods as error
Daniel Scheller [Sun, 25 Feb 2018 12:31:38 +0000 (07:31 -0500)]
media: ngene: don't treat non-existing demods as error

When probing the I2C busses in cineS2_probe(), it's no error when there's
no hardware connected to the probed expansion connector, so print this
informal message with info severity.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: check for CXD2099AR presence before attaching
Daniel Scheller [Sun, 25 Feb 2018 12:31:37 +0000 (07:31 -0500)]
media: ngene: check for CXD2099AR presence before attaching

Currently, if there's no CXD2099AR attached to any expansion connector of
the ngene hardware, it will complain with this on every module load:

    cxd2099 1-0040: No CXD2099AR detected at 0x40
    cxd2099: probe of 1-0040 failed with error -5
    ngene 0000:02:00.0: CXD2099AR attach failed

This happens due to the logic assuming such hardware is always there and
blindly tries to attach the cxd2099 I2C driver. Rather add a probe
function (in ngene-cards.c with a prototype in ngene.h) to check for
the existence of such hardware before probing, and don't try further if
no CXD2099 was found.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: deduplicate I2C adapter evaluation
Daniel Scheller [Sun, 25 Feb 2018 12:31:36 +0000 (07:31 -0500)]
media: ngene: deduplicate I2C adapter evaluation

The I2C adapter evaluation (based on chan->number) is duplicated at
several places (tuner_attach_() functions, demod_attach_stv0900() and
cineS2_probe()). Clean this up by wrapping that construct in a separate
function which all users of that can pass the ngene_channel pointer and
get the correct I2C adapter from.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add support for DuoFlex S2 V4 addon modules
Daniel Scheller [Sun, 25 Feb 2018 12:31:35 +0000 (07:31 -0500)]
media: ngene: add support for DuoFlex S2 V4 addon modules

Add support for the STV0910/STV6111/LNBH25 based DuoFlex S2 V4 DVB-S2
addon modules by recognizing them from their XO2 type value and using
the auxiliary stv0910, stv6111 and lnbh25 driver to form a complete
DVB frontend.

This also adds autoselection (if MEDIA_SUBDRV_AUTOSELECT) of the STV0910,
STV6111 and LNBH25 demod/tuner/LNB-IC drivers to Kconfig.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add support for Sony CXD28xx-based DuoFlex modules
Daniel Scheller [Sun, 25 Feb 2018 12:31:34 +0000 (07:31 -0500)]
media: ngene: add support for Sony CXD28xx-based DuoFlex modules

Recognize (probe) and support (attach) all Sony CXD28xx based DuoFlex
addon modules/cards, namely the DuoFlex CT2 (CXD2837), ISDB-T (CXD2838),
C2T2 (CXD2843) and C2T2I (CXD2854). Since all these modules are equipped
with a MachXO2 interface, that support is required for the hardware to
work. This functionality utilises the auxiliary cxd2841er and tda18212
drivers.

This also adds autoselection (if MEDIA_SUBDRV_AUTOSELECT) of the CXD2841ER
demod driver to Kconfig. The __maybe_unused annotation can now be removed
from the xo2names array.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add XO2 module support
Daniel Scheller [Sun, 25 Feb 2018 12:31:33 +0000 (07:31 -0500)]
media: ngene: add XO2 module support

Detect and initialise modules equipped with XO2 interfaces (Lattice
MachXO2). This requires a few more I2C transfer functions which this adds
as well. Defines for the different possible (available) module types are
added to ngene.h. The support for the actual tuners contained on these
addon modules is kept separate from this commit and is being added with
the next commits.

The xo2names array is temporarily marked __maybe_unused to silence a
corresponding compiler warning at this stage.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: support STV0367 DVB-C/T DuoFlex addons
Daniel Scheller [Sun, 25 Feb 2018 12:31:32 +0000 (07:31 -0500)]
media: ngene: support STV0367 DVB-C/T DuoFlex addons

Add support for STV0367+TDA18212 based DuoFlex CT addon modules. For this,
add a demod probe function and all necessary demod/tuner attach functions
which use existing auxiliary drivers (stv0367 and tda18212) to support
this hardware. As tda18212 is an I2C client driver, proper cleanup code
is added to the deregistration sequence in ngene-core. To not cause use-
after-free situations when there's a CXD2099 I2C client connected, which
is rather freed in ngene-core.c:cxd_detach(), add i2c_client_fe to struct
ngene_channel to keep track if the i2c_client was allocated by a frontend
driver, rather than the CI code paths. Also move the I2C access functions
to the top of the file and add the required read_regs() function for the
tda18212 ping to work.

This adds autoselection (if MEDIA_SUBDRV_AUTOSELECT) of the STV0367 demod
driver and TDA18212 tuner driver to Kconfig aswell.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: use defines to identify the demod_type
Daniel Scheller [Sun, 25 Feb 2018 12:31:31 +0000 (07:31 -0500)]
media: ngene: use defines to identify the demod_type

Make it more clear which demod_type is used for which hardware by having
defines for the possible demod_type values. With that, change the
demod_type evaluation in tuner_attach_probe() to a switch-case instead
of an if() for each possible value.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: convert kernellog printing from printk() to dev_*() macros
Daniel Scheller [Sun, 25 Feb 2018 12:31:30 +0000 (07:31 -0500)]
media: ngene: convert kernellog printing from printk() to dev_*() macros

Convert all printk() and pr_*() kernel log printing to rather use the
dev_*() macros. Not only is it discouraged to use printk() (checkpatch
even complains about that), but also this helps identifying the exact PCI
device for any printed event, and it makes almost all printing shorter
in terms of code style since there's no need to use KERN_* DEVICE_NAME
any more (dev_*() will take care of this).

Since the dprintk macro define isn't used anymore, remove it.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: add two additional PCI IDs
Daniel Scheller [Sun, 25 Feb 2018 12:31:29 +0000 (07:31 -0500)]
media: ngene: add two additional PCI IDs

Add two more device IDs for cards supported by the ngene driver.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb_ca_en50221: fix severity of successful CAM init log message
Daniel Scheller [Sat, 24 Feb 2018 14:55:57 +0000 (09:55 -0500)]
media: dvb_ca_en50221: fix severity of successful CAM init log message

A successful CA module initialisation isn't an error. Change the
log print to info severity accordingly.

Cc: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usb: don't initialize vars if not needed
Markus Elfring [Thu, 22 Feb 2018 20:45:47 +0000 (15:45 -0500)]
media: usb: don't initialize vars if not needed

Some local variables will be set to an appropriate value before usage.
Thus omit explicit initialisations at the beginning of these functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: constify ov772x_frame_intervals
Mauro Carvalho Chehab [Tue, 6 Mar 2018 15:34:44 +0000 (10:34 -0500)]
media: ov772x: constify ov772x_frame_intervals

The values on this array never changes. Make it const.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: si2168: change ts bus control logic
Brad Love [Mon, 12 Feb 2018 20:19:04 +0000 (15:19 -0500)]
media: si2168: change ts bus control logic

Move the ts bus control function moved higher, enabling it
after configuring frontend and removeing ts_bus_ctrl callback.

While here, also add an error checking and re-add a comment
that were removed by commit 445877742ce3 ("media: si2168:
Add ts bus coontrol, turn off bus on sleep").

[mchehab@s-opensource.com: I ended by applying the first version,
 instead of the right one. So, this patch contains the diff and
 the v2 changelog instead]

Fixes: 445877742ce3 ("media: si2168: Add ts bus coontrol, turn off bus on sleep")
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0910: rework and fix DiSEqC send
Daniel Scheller [Fri, 9 Feb 2018 18:22:49 +0000 (13:22 -0500)]
media: dvb-frontends/stv0910: rework and fix DiSEqC send

Rework both DiSEqC send functions (send_master_cmd() and send_burst()) to
utilise the new SET_REG() and SET_FIELD() macros. Esp. due to SET_FIELD(),
this makes sure that not all bits (with unrelated purposes) are always
rewritten, but only those needed for sending DiSEqC commands. In
send_burst(), this makes sure that DISEQC_MODE isn't changed from 3 to 2
inbetween when sending SEC_MINI_A. Also, change both functions to write
DISEQC_MODE first before setting DIS_PRECHARGE. This makes diseqc control
work more reliable for "fullblown" DiSEqC strings in VDR's diseqc.conf in
combination with certain multiswitches.

Fixes: 448461af0e19 ("media: dvb-frontends/stv0910: implement diseqc_send_burst")
Reported-by: Helmut Auer <post@helmutauer.de>
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Helmut Auer <post@helmutauer.de>
Tested-by: Richard Scobie <rascobie@slingshot.co.nz>
Tested-by: Dietmar Spingler <d_spingler@freenet.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxd2099: move driver out of staging into dvb-frontends
Daniel Scheller [Thu, 8 Feb 2018 19:53:17 +0000 (14:53 -0500)]
media: cxd2099: move driver out of staging into dvb-frontends

According to the TODO file, this driver only landed in staging because of
the way device nodes and data transfers are handled. Besides that this way
(use of secX devices) has become sort of standard to date (ie. VDR
supports this literally since ages via the ddci plugin, TVHeadend received
this functionality lately, and minisatip being currently worked on
regarding this), most importantly this I2C client only driver isn't even
responsible for setting up device nodes, not for handling data
transfer and so on, but only serves as interface for the dvb_ca_en50221
subsystem, just like every other DVB card out in the wild, with hard-wired
or such flexible CA interfaces. And, it would even work with cards having
the cxd2099 controller hard-wired.

Also, this driver received quite some love and even is a proper I2C client
driver by now. So, as this driver acts as a EN50221 frontend device, move
it to dvb-frontends. There is no need to keep it buried in staging.

This commit also updates all affected Kconfig and Makefile's, and adds
MEDIA_AUTOSELECT depends to ddbridge and ngene.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ngene: adapt cxd2099 attach to the new i2c_client way
Daniel Scheller [Thu, 8 Feb 2018 19:53:15 +0000 (14:53 -0500)]
media: ngene: adapt cxd2099 attach to the new i2c_client way

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

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging/cxd2099: convert to regmap API
Daniel Scheller [Sat, 17 Feb 2018 15:03:23 +0000 (10:03 -0500)]
media: staging/cxd2099: convert to regmap API

Convert the cxd2099 driver to use regmap for I2C accesses, removing all
own i2c_*() functions. With that, make the driver a proper I2C client
driver. This also adds the benefit of having a proper cleanup function
(cxd2099_remove() in this case) that takes care of resource cleanup
upon I2C client deregistration.

At this point, keep the static inline declared cxd2099_attach()
function so that drivers using the legacy/proprietary style attach way
still compile, albeit lacking the cxd2099 driver functionality. This
is taken care of in the next two patches.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge/ci: further deduplicate code/logic in ddb_ci_attach()
Daniel Scheller [Thu, 8 Feb 2018 19:53:12 +0000 (14:53 -0500)]
media: ddbridge/ci: further deduplicate code/logic in ddb_ci_attach()

Deduplicate the checks for a valid ptr in port->en, and also handle the
default case to also catch eventually yet unsupported CI hardware.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: dvb-frontends: stb0899: fix comparison to bitshift when dealing with...
Wolfram Sang [Mon, 5 Feb 2018 20:10:00 +0000 (15:10 -0500)]
media: v4l: dvb-frontends: stb0899: fix comparison to bitshift when dealing with a mask

Due to a typo, the mask was destroyed by a comparison instead of a bit
shift.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: sec: Remove PLAT_S5P dependency
Ulf Magnusson [Mon, 5 Feb 2018 01:21:29 +0000 (20:21 -0500)]
media: sec: Remove PLAT_S5P dependency

The PLAT_S5P symbol was removed in commit d78c16ccde96 ("ARM: SAMSUNG:
Remove remaining legacy code").

Remove the PLAT_S5P dependency from VIDEO_SAMSUNG_S5P_CEC.

Discovered with the
https://github.com/ulfalizer/Kconfiglib/blob/master/examples/list_undefined.py
script.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mantis: remove mantis_vp3028.c/mantis_vp3028.h
Corentin Labbe [Sun, 28 Jan 2018 20:06:18 +0000 (15:06 -0500)]
media: mantis: remove mantis_vp3028.c/mantis_vp3028.h

Thoses files are unused since commit b3b961448f70 ("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list")
8 year after, we could remove it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: drx-j remove bsp_i2c.h
Corentin Labbe [Fri, 26 Jan 2018 20:14:05 +0000 (15:14 -0500)]
media: drx-j remove bsp_i2c.h

bsp_i2c.h is unused since commit ffe7c4f92183 ("[media] drx-j: Get rid of drx39xyj/bsp_tuner.h")
Remove it from tree.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: sr030pc30: prevent array underflow in try_fmt()
Dan Carpenter [Thu, 25 Jan 2018 14:15:25 +0000 (09:15 -0500)]
media: sr030pc30: prevent array underflow in try_fmt()

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: omap_vout: vrfb: Use the wrapper for prep_interleaved_dma()
Peter Ujfalusi [Fri, 19 Jan 2018 13:34:34 +0000 (08:34 -0500)]
media: v4l: omap_vout: vrfb: Use the wrapper for prep_interleaved_dma()

Instead of directly accessing to dmadev->device_prep_interleaved_dma() use
the dmaengine_prep_interleaved_dma() wrapper instead.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: em28xx: Enable inversion for Solo/Dual HD DVB models
Brad Love [Wed, 17 Jan 2018 21:32:36 +0000 (16:32 -0500)]
media: em28xx: Enable inversion for Solo/Dual HD DVB models

Hauppauge Solo/Dual HD DVB models use a si2157 tuner, which is set to
produce inverted spectrum. This configures the si2168 DVB demod for
inverted spectrum on both affected models.

[mchehab@s-opensource.com: rebased on the top of upstream]
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: si2168: Add spectrum inversion property
Brad Love [Wed, 17 Jan 2018 22:31:58 +0000 (17:31 -0500)]
media: si2168: Add spectrum inversion property

Some tuners produce inverted spectrum, but the si2168 is not
currently set up to accept it. This adds an optional parameter
to set the frontend up to receive inverted spectrum.

Parameter is optional and only boards who enable inversion
will utilize this.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: s3c-camif: fix out-of-bounds array access
Arnd Bergmann [Tue, 16 Jan 2018 21:52:15 +0000 (16:52 -0500)]
media: s3c-camif: fix out-of-bounds array access

While experimenting with older compiler versions, I ran
into a warning that no longer shows up on gcc-4.8 or newer:

drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':
drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds

This is an off-by-one bug, leading to an access before the start of the
array, while newer compilers silently assume this undefined behavior
cannot happen and leave the loop at index 0 if no other entry matches.

As Sylvester explains, we actually need to ensure that the
value is within the range, so this reworks the loop to be
easier to parse correctly, and an additional check to fall
back on the first format value for any unexpected input.

I found an existing gcc bug for it and added a reduced version
of the function there.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249#c3
Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: si2168: Announce frontend creation failure
Brad Love [Fri, 12 Jan 2018 16:19:40 +0000 (11:19 -0500)]
media: si2168: Announce frontend creation failure

The driver outputs on success, but is silent on failure. Give
one message that probe failed.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: lgdt3306a: Announce successful creation
Brad Love [Fri, 12 Jan 2018 16:19:41 +0000 (11:19 -0500)]
media: lgdt3306a: Announce successful creation

The driver is near silent, this adds a simple announcement at the
end of probe after the chip has been detected and upgrades a debug
message to error if probe has failed.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: si2168: Add ts bus coontrol, turn off bus on sleep
Brad Love [Fri, 12 Jan 2018 16:19:39 +0000 (11:19 -0500)]
media: si2168: Add ts bus coontrol, turn off bus on sleep

Includes a function to set TS MODE property os si2168. The function
either disables the TS output bus, or sets mode to config option.

When going to sleep the TS bus is turned off, this makes the driver
compatible with multiple frontend usage.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Add second i2c demod client
Brad Love [Fri, 12 Jan 2018 16:19:37 +0000 (11:19 -0500)]
media: cx231xx: Add second i2c demod client

Include ability to add a i2c device style frontend to cx231xx USB
bridge. All current boards set to use frontend[0]. Changes are
backwards compatible with current behaviour.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: Add second frontend option
Brad Love [Fri, 12 Jan 2018 16:19:36 +0000 (11:19 -0500)]
media: cx231xx: Add second frontend option

Include ability to add a second dvb attach style frontend to cx231xx
USB bridge. All current boards set to use frontend[0]. Changes are
backwards compatible with current behaviour.

[mchehab@s-opensource.com: fix some coding style issues]
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cxusb: restore RC_MAP for MyGica T230
Stefan Brüns [Tue, 9 Jan 2018 23:33:39 +0000 (18:33 -0500)]
media: cxusb: restore RC_MAP for MyGica T230

Commit f8585ce655e9 ("[media] dvb-usb-cxusb: Geniatech T230C support")
sneaked in an unrelated change for the older T230 (not C) model.

As the commit was reverted this change was reverted too,
although likely correct.

Fixes: f8585ce655e9 ("[media] dvb-usb-cxusb: Geniatech T230C support")
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-usb-cxusb: Geniatech T230C support
Evgeny Plehov [Tue, 9 Jan 2018 23:33:38 +0000 (18:33 -0500)]
media: dvb-usb-cxusb: Geniatech T230C support

This reverts commit f8585ce655e9cdeabc38e8e2580b05735110e4a5.

The T230C is handled by the dvb-usb-v2/dvbsky.c driver, which should
be preferred over a dvb-usb (v1) driver.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>