]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
7 years agomedia: dvb-frontends/stv0367: Improve DVB-C/T frontend status
Mauro Carvalho Chehab [Sun, 25 Jun 2017 11:26:43 +0000 (08:26 -0300)]
media: dvb-frontends/stv0367: Improve DVB-C/T frontend status

The stv0367 driver provide a lot of status on its state machine.
Change the logic to provide more information about frontend locking
status. Also, while any detailed status isn't available, provide a more
complete FE_STATUS for DVB-T.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
7 years agomedia: dvb-frontends/stv0367: DVB-C signal strength statistics
Daniel Scheller [Sun, 25 Jun 2017 11:26:45 +0000 (08:26 -0300)]
media: dvb-frontends/stv0367: DVB-C signal strength statistics

Provide QAM/DVB-C signal strength in decibel scale. Values returned from
stv0367cab_get_rf_lvl() are good but need to be multiplied as they're in
1dBm precision.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: update UCB readout condition logic
Daniel Scheller [Sun, 25 Jun 2017 11:26:46 +0000 (08:26 -0300)]
media: dvb-frontends/stv0367: update UCB readout condition logic

Since the other statistics are read when fe_status conditions are TRUE,
change the ucblocks readout logic to match this aswell.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: stv0367: prevent division by zero
Mauro Carvalho Chehab [Sun, 25 Jun 2017 12:07:45 +0000 (09:07 -0300)]
media: stv0367: prevent division by zero

While there's a test at the SNR calculus to avoid division by
zero, it will still follow the path that would do the division.
So, add a missing break there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: SNR DVBv5 statistics for DVB-C and T
Daniel Scheller [Sun, 25 Jun 2017 11:26:44 +0000 (08:26 -0300)]
media: dvb-frontends/stv0367: SNR DVBv5 statistics for DVB-C and T

Add signal-to-noise-ratio as provided by the demodulator in decibel scale.
QAM/DVB-C needs some intlog calculation to have usable dB values, OFDM/
DVB-T values from the demod look alright already and are provided as-is.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/cxd2841er: require STATE_ACTIVE_* for agc readout
Daniel Scheller [Sun, 25 Jun 2017 10:02:22 +0000 (07:02 -0300)]
media: dvb-frontends/cxd2841er: require STATE_ACTIVE_* for agc readout

When the demod driver puts the demod into sleep or shutdown state and it's
status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed
to the kernel log. If the last delsys was DVB-T/T2:

  cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
  cxd2841er: i2c rd failed=-5 addr=6c reg=26

and if it was DVB-C:

  cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
  cxd2841er: i2c rd failed=-5 addr=6c reg=49

This happens when read_status unconditionally calls into the
read_signal_strength() function which triggers the read_agc_gain_*()
functions, where these registered are polled.

This isn't a critical thing since when the demod is active again, no more
such errors are logged, however this might make users suspecting defects.

Fix this by requiring STATE_ACTIVE_* in priv->state. If it isn't in any
active state, additionally set the strength scale to NOT_AVAILABLE.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: dev_* logging fixup
Daniel Scheller [Sun, 25 Jun 2017 09:59:46 +0000 (06:59 -0300)]
media: ddbridge: dev_* logging fixup

Fixup

  commit d52786ddd2d5 ("media: ddbridge: make (ddb)readl in while-loops fail-safe")

after/wrt

  commit 11e358bf37e8 ("media: ddbridge: use dev_* macros in favor of printk")

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: i2c: tvp5150: remove useless variable assignment in tvp5150_set_vbi()
Gustavo A. R. Silva [Fri, 23 Jun 2017 22:37:00 +0000 (19:37 -0300)]
media: i2c: tvp5150: remove useless variable assignment in tvp5150_set_vbi()

Value assigned to variable _type_ at line 678 is overwritten at line 688
before it can be used. This makes such variable assignment useless.

Remove this variable assignment and fix some coding style issues.

Addresses-Coverity-ID: 1226968

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-usb-v2: lmedm04: remove unnecessary variable in lme2510_stream_restart()
Gustavo A. R. Silva [Thu, 22 Jun 2017 04:22:47 +0000 (01:22 -0300)]
media: dvb-usb-v2: lmedm04: remove unnecessary variable in lme2510_stream_restart()

Remove unnecessary variable _ret_ and refactor the code.

Addresses-Coverity-ID: 1226934

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: split SNR determination into functions
Daniel Scheller [Wed, 21 Jun 2017 19:45:42 +0000 (16:45 -0300)]
media: dvb-frontends/stv0367: split SNR determination into functions

The read_snr() functions currently do some magic to return relative scale
values when called. Split out register readouts into separate functions
so the functionality can be reused in some other way.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: initial DDB DVBv5 stats, implement ucblocks
Daniel Scheller [Wed, 21 Jun 2017 19:45:41 +0000 (16:45 -0300)]
media: dvb-frontends/stv0367: initial DDB DVBv5 stats, implement ucblocks

This adds the basics to stv0367ddb_read_status() to be able to properly
provide signal statistics in DVBv5 format. Also adds UCB readout and
provides those values. Also, don't return -EINVAL in ddb_read_status()
if active_demod_state indicates no delivery system.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/lnbh25: improve kernellog output
Daniel Scheller [Tue, 20 Jun 2017 19:57:24 +0000 (16:57 -0300)]
media: dvb-frontends/lnbh25: improve kernellog output

Use dev_dbg() in conjunction with the %*ph format macro to print the vmon
status debug, thus hiding continuous hexdumping from default log levels.
Also, change the attach success log line from error to info severity.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ngene: Replace semaphore i2c_switch_mutex with mutex
Binoy Jayan [Tue, 13 Jun 2017 08:58:50 +0000 (05:58 -0300)]
media: ngene: Replace semaphore i2c_switch_mutex with mutex

The semaphore 'i2c_switch_mutex' is used as a simple mutex, so
it should be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ngene: Replace semaphore stream_mutex with mutex
Binoy Jayan [Tue, 13 Jun 2017 08:58:49 +0000 (05:58 -0300)]
media: ngene: Replace semaphore stream_mutex with mutex

The semaphore 'stream_mutex' is used as a simple mutex, so
it should be written as one. Also moving the mutex_[lock/unlock]
to the caller as it is anyway locked at the beginning of the
callee thus avoiding repetition.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ngene: Replace semaphore cmd_mutex with mutex
Binoy Jayan [Tue, 13 Jun 2017 08:58:48 +0000 (05:58 -0300)]
media: ngene: Replace semaphore cmd_mutex with mutex

The semaphore 'cmd_mutex' is used as a simple mutex, so
it should be written as one. Also, replace down with
mutex_destroy to ensure sane state when ngene_stop is
called.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: tw5864, fc0011: better handle WARN_ON()
Mauro Carvalho Chehab [Thu, 18 May 2017 14:06:43 +0000 (11:06 -0300)]
media: tw5864, fc0011: better handle WARN_ON()

As such macro will check if the expression is true, it may fall through, as
warned:

In file included from ./include/uapi/linux/stddef.h:1:0,
                 from ./include/linux/stddef.h:4,
                 from ./include/uapi/linux/posix_types.h:4,
                 from ./include/uapi/linux/types.h:13,
                 from ./include/linux/types.h:5,
                 from ./drivers/media/dvb-core/dvb_frontend.h:35,
                 from drivers/media/tuners/fc0011.h:4,
                 from drivers/media/tuners/fc0011.c:20:
drivers/media/tuners/fc0011.c: In function 'fc0011_set_params':
./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 # define unlikely(x) __builtin_expect(!!(x), 0)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:109:2: note: in expansion of macro 'unlikely'
  unlikely(__ret_warn_on);     \
  ^~~~~~~~
drivers/media/tuners/fc0011.c:344:3: note: in expansion of macro 'WARN_ON'
   WARN_ON(1);
   ^~~~~~~
drivers/media/tuners/fc0011.c:345:2: note: here
  case 0:
  ^~~~
In file included from ./include/uapi/linux/stddef.h:1:0,
                 from ./include/linux/stddef.h:4,
                 from ./include/uapi/linux/posix_types.h:4,
                 from ./include/uapi/linux/types.h:13,
                 from ./include/linux/types.h:5,
                 from ./include/linux/list.h:4,
                 from ./include/linux/module.h:9,
                 from drivers/media/pci/tw5864/tw5864-video.c:17:
drivers/media/pci/tw5864/tw5864-video.c: In function 'tw5864_fmt_vid_cap':
./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 # define unlikely(x) __builtin_expect(!!(x), 0)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:68:2: note: in expansion of macro 'unlikely'
  unlikely(__ret_warn_on);    \
  ^~~~~~~~
drivers/media/pci/tw5864/tw5864-video.c:547:3: note: in expansion of macro 'WARN_ON_ONCE'
   WARN_ON_ONCE(1);
   ^~~~~~~~~~~~
drivers/media/pci/tw5864/tw5864-video.c:548:2: note: here
  case STD_NTSC:
  ^~~~

On both cases, it means an error, so, let's return an error
code, to make gcc happy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Michael Büsch <m@bues.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: drx39xyj: remove obsolete sign extend macros
Martin Kepplinger [Wed, 3 May 2017 13:43:09 +0000 (10:43 -0300)]
media: dvb-frontends: drx39xyj: remove obsolete sign extend macros

DRX_S9TOS16 and DRX_S24TODRXFREQ are simply not used. Furthermore,
sign_extend32() should be used for sign extension. (Also, the comment
describing DRX_S24TODRXFREQ was wrong). So remove these macros.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l: omap_vout: vrfb: Convert to dmaengine
Peter Ujfalusi [Wed, 3 May 2017 11:08:51 +0000 (08:08 -0300)]
media: v4l: omap_vout: vrfb: Convert to dmaengine

The dmaengine driver for sDMA now have support for interleaved transfer.
This trasnfer type was open coded with the legacy omap-dma API, but now
we can move it to dmaengine.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Replace initalized ->initialized
Mauro Carvalho Chehab [Sat, 24 Jun 2017 18:46:24 +0000 (15:46 -0300)]
media: Replace initalized ->initialized

While committing a change on em28xx, I got a warning of a
typo there. So, fix it on em28xx and on two other media drivers
with the same typo.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: em28xx: add support for new of Terratec H6
Mauro Carvalho Chehab [Wed, 3 May 2017 02:12:23 +0000 (23:12 -0300)]
media: em28xx: add support for new of Terratec H6

There's a new version of Terratec H6 with uses USB ID
0ccd:10b2. This version is similar to the old one (with is
supported via the HTC entry), except that this one has the
eeprom on the second bus.

On this board, one side of this board is labeled with:
dvbc v2.0
The other side with:
94V-0, MO2, RK-4221 with huge digits: 1107

With those patches, the board is properly detected:

    em28xx 1-1.5:1.0: New device TERRATEC TERRATCE H5 MKII @ 480 Mbps (0ccd:10b2, interface 0, class 0)
    em28xx 1-1.5:1.0: Audio interface 0 found (Vendor Class)
    em28xx 1-1.5:1.0: Video interface 0 found: isoc
    em28xx 1-1.5:1.0: DVB interface 0 found: isoc
    em28xx 1-1.5:1.0: chip ID is em2884
    em28xx eeprom 00000000: 26 00 00 00 02 0b 0f e5 f5 64 01 60 09 e5 f5 64  &........d.`...d
    em28xx eeprom 00000010: 09 60 03 c2 c6 22 e5 f7 b4 03 13 e5 f6 b4 87 03  .`..."..........
    em28xx eeprom 00000020: 02 0a b9 e5 f6 b4 93 03 02 09 46 c2 c6 22 c2 c6  ..........F.."..
    em28xx eeprom 00000030: 22 00 60 00 ef 70 08 85 3d 82 85 3c 83 93 ff ef  ".`..p..=..<....
    em28xx eeprom 00000040: 60 19 85 3d 82 85 3c 83 e4 93 12 07 a3 12 0a fe  `..=..<.........
    em28xx eeprom 00000050: 05 3d e5 3d 70 02 05 3c 1f 80 e4 22 12 0b 06 02  .=.=p..<..."....
    em28xx eeprom 00000060: 07 e2 01 00 1a eb 67 95 cd 0c b2 10 f0 13 6b 03  ......g.......k.
    em28xx eeprom 00000070: 98 22 6a 1c 86 12 27 57 4e 16 29 00 60 00 00 00  ."j...'WN.).`...
    em28xx eeprom 00000080: 02 00 00 00 5e 00 13 00 f0 10 44 82 82 00 00 00  ....^.....D.....
    em28xx eeprom 00000090: 5b 81 c0 00 00 00 20 40 20 80 02 20 10 01 00 00  [..... @ .. ....
    em28xx eeprom 000000a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    em28xx eeprom 000000b0: c6 40 00 00 81 00 00 00 00 00 00 00 00 c4 00 00  .@..............
    em28xx eeprom 000000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1c 03  ................
    em28xx eeprom 000000d0: 31 00 32 00 33 00 34 00 35 00 36 00 37 00 38 00  1.2.3.4.5.6.7.8.
    em28xx eeprom 000000e0: 39 00 41 00 42 00 43 00 44 00 12 03 54 00 45 00  9.A.B.C.D...T.E.
    em28xx eeprom 000000f0: 52 00 52 00 41 00 54 00 45 00 43 00 22 03 54 00  R.R.A.T.E.C.".T.
    em28xx 1-1.5:1.0: eeprom 000100: ... (skipped)
    em28xx 1-1.5:1.0: EEPROM ID = 26 00 00 00, EEPROM hash = 0xbcd5a8cf
    em28xx 1-1.5:1.0: EEPROM info:
    em28xx 1-1.5:1.0: microcode start address = 0x0004, boot configuration = 0x00
    em28xx 1-1.5:1.0: I2S audio, 5 sample rates
    em28xx 1-1.5:1.0: 500mA max power
    em28xx 1-1.5:1.0: Table at offset 0x27, strings=0x2298, 0x1c6a, 0x1286
    em28xx 1-1.5:1.0: Identified as Terratec Cinergy H6 rev. 2 (card=101)
    em28xx 1-1.5:1.0: Currently, V4L2 is not supported on this model
    em28xx 1-1.5:1.0: dvb set to isoc mode.
    usbcore: registered new interface driver em28xx
    em28xx 1-1.5:1.0: Binding audio extension
    em28xx 1-1.5:1.0: em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
    em28xx 1-1.5:1.0: em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab
    em28xx 1-1.5:1.0: Endpoint 0x83 high-speed on intf 0 alt 7 interval = 8, size 196
    em28xx 1-1.5:1.0: Number of URBs: 1, with 64 packets and 192 size
    em28xx 1-1.5:1.0: Audio extension successfully initialized
    em28xx: Registered (Em28xx Audio Extension) extension
    em28xx 1-1.5:1.0: Binding DVB extension
    drxk: status = 0x639260d9
    drxk: detected a drx-3926k, spin A3, xtal 20.250 MHz
    drxk: DRXK driver version 0.9.4300
    drxk: frontend initialized.
    tda18271 4-0060: creating new instance
    tda18271: TDA18271HD/C2 detected @ 4-0060
    dvbdev: DVB: registering new adapter (1-1.5:1.0)
    em28xx 1-1.5:1.0: DVB: registering adapter 0 frontend 0 (DRXK DVB-C DVB-T)...
    dvbdev: dvb_create_media_entity: media entity 'DRXK DVB-C DVB-T' registered.
    dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
    em28xx 1-1.5:1.0: DVB extension successfully initialized
    em28xx: Registered (Em28xx dvb Extension) extension
    em28xx 1-1.5:1.0: Registering input extension
    rc rc0: 1-1.5:1.0 IR as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/rc/rc0
    Registered IR keymap rc-nec-terratec-cinergy-xs
    input: 1-1.5:1.0 IR as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/rc/rc0/input0
    em28xx 1-1.5:1.0: Input extension successfully initalized
    em28xx: Registered (Em28xx Input Extension) extension
    tda18271: performing RF tracking filter calibration
    tda18271: RF tracking filter calibration complete

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: em28xx: Ignore errors while reading from eeprom
Mauro Carvalho Chehab [Wed, 3 May 2017 02:12:22 +0000 (23:12 -0300)]
media: em28xx: Ignore errors while reading from eeprom

While testing support for Terratec H6 rev. 2, it was noticed
that reading from eeprom there causes a timeout error.

Apparently, this is due to the need of properly setting GPIOs.

In any case, the driver doesn't really require eeprom reading
to succeed, as this is currently used only for debug.

So, Ignore such errors.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib0700: fix error handling in dib0700_i2c_xfer_legacy()
Dan Carpenter [Fri, 28 Apr 2017 12:53:31 +0000 (09:53 -0300)]
media: dib0700: fix error handling in dib0700_i2c_xfer_legacy()

Mostly this adds some unlocks to error paths.  But, if you see where
there were "break;" statements before, I changed those paths to return
error codes instead of returning success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib0700: fix locking in dib0700_i2c_xfer_new()
Dan Carpenter [Fri, 28 Apr 2017 12:52:07 +0000 (09:52 -0300)]
media: dib0700: fix locking in dib0700_i2c_xfer_new()

This patch mostly adds unlocks to error paths.  But one additional small
change is that I made the first "break;" a "goto unlock;" which means
that now we return failure instead of success on that path.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: tuners: mxl5005s: remove useless variable assignments
Gustavo A. R. Silva [Thu, 22 Jun 2017 03:20:59 +0000 (00:20 -0300)]
media: tuners: mxl5005s: remove useless variable assignments

Values assigned to variables Fmax and Fmin at lines 2740 and 2741 are
overwritten at lines 2754 and 2755 before they can be used. This makes
such variable assignments useless.

Addresses-Coverity-ID: 1226952
Addresses-Coverity-ID: 1226953

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: imx.rst: add it to v4l-drivers book
Mauro Carvalho Chehab [Sat, 24 Jun 2017 16:15:49 +0000 (13:15 -0300)]
media: imx.rst: add it to v4l-drivers book

Avoid the following warning when building documentation:
checking consistency... /devel/v4l/patchwork/Documentation/media/v4l-drivers/imx.rst:: WARNING: document isn't included in any toctree

While here, avoid placing all driver authors at just one line at
the html/pdf output.

Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dtv-core.rst: explain how to get DVBv5 statistics
Mauro Carvalho Chehab [Sat, 24 Jun 2017 16:02:01 +0000 (13:02 -0300)]
media: dtv-core.rst: explain how to get DVBv5 statistics

It is not trivial to implement the logic that collects DVBv5
statistics. As we're seein lately too many implementations
that are not quite right when reviewing patchsets, add a
detailed explanation, adding a few examples about the right
thing to be done.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: deduplicate DDB dvb_frontend_ops caps
Daniel Scheller [Wed, 21 Jun 2017 20:10:54 +0000 (17:10 -0300)]
media: dvb-frontends/stv0367: deduplicate DDB dvb_frontend_ops caps

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: use dev_* macros in favor of printk
Daniel Scheller [Wed, 21 Jun 2017 16:53:47 +0000 (13:53 -0300)]
media: ddbridge: use dev_* macros in favor of printk

Side effect: KERN_DEBUG messages aren't written to the kernel log anymore.
This also improves the tda18212_ping reporting a bit so users know that if
pinging wasn't successful, bad things will happen.

Since in module_init_ddbridge() there's no dev yet, pr_info is used
instead.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: make (ddb)readl in while-loops fail-safe
Daniel Scheller [Fri, 23 Jun 2017 16:37:40 +0000 (13:37 -0300)]
media: ddbridge: make (ddb)readl in while-loops fail-safe

Reported by smatch:

  drivers/media/pci/ddbridge/ddbridge-core.c:1246 input_tasklet() warn: this loop depends on readl() succeeding
  drivers/media/pci/ddbridge/ddbridge-core.c:1768 flashio() warn: this loop depends on readl() succeeding
  drivers/media/pci/ddbridge/ddbridge-core.c:1788 flashio() warn: this loop depends on readl() succeeding

Fix this by introducing safe_ddbreadl() which will wrap ddbreadl and checks
for all bits set in the return which indicates failure, and return 0 in
that case. Usable as drop-in-replacement in all affected while loops w/o
having to change the logic.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: coda: rename the picture run timeout error handler
Philipp Zabel [Fri, 23 Jun 2017 09:54:09 +0000 (06:54 -0300)]
media: coda: rename the picture run timeout error handler

I would have liked the the picture run timeout error handler to be renamed to
something a bit more descriptive in the original commit fb2be08f8cb3 ("[media]
coda: first step at error recovery").
Somehow v1 [1] was merged instead of v2 [2].

[1] https://patchwork.kernel.org/patch/9663965/
[2] https://patchwork.kernel.org/patch/9774239/

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: venus: fix loop wrap in cleanup of clks
Colin Ian King [Thu, 22 Jun 2017 17:27:21 +0000 (14:27 -0300)]
media: venus: fix loop wrap in cleanup of clks

The current pre-decrement is incorrect and should be replaced
with a post-decrement. Consider the case where the very first
clk_prepare_enable fails when i is 0; in this case the error
clean up will decrement the unsigned int which wraps to the
largest unsigned int value causing an array out of bounds read
on core->clks[i].

Detected by CoverityScan, CID#1446590 ("Out-of-bounds read")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: radio: wl1273: add check on core->write() return value
Gustavo A. R. Silva [Thu, 22 Jun 2017 04:01:22 +0000 (01:01 -0300)]
media: radio: wl1273: add check on core->write() return value

Check return value from call to core->write(), so in case of
error print error message, jump to goto label fail and eventually
return.

Addresses-Coverity-ID: 1226943

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: rainshadow-cec: avoid -Wmaybe-uninitialized warning again
Arnd Bergmann [Wed, 21 Jun 2017 22:10:32 +0000 (19:10 -0300)]
media: rainshadow-cec: avoid -Wmaybe-uninitialized warning again

Back in April I created a patch to address a false-positive warning:

drivers/media/usb/rainshadow-cec/rainshadow-cec.c: In function 'rain_irq_work_handler':
drivers/media/usb/rainshadow-cec/rainshadow-cec.c:171:31: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]

My patch was totally wrong and introduced a real bug, and Colin Ian King thankfully
noticed it now and fixed my mistake. Unfortunately, fixing the actual uninitialized
data in this case brought back the original bogus warning.

This is a new version of the patch, which simplifies the code to the point where
gcc notices the behavior is correct.

Fixes: ca33784ba494 ("[media] rainshadow-cec: ensure exit_loop is intialized")
Fixes: ea6a69defd3311 ("[media] rainshadow-cec: avoid -Wmaybe-uninitialized warning")
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: tuner-core: Remove unused #define PREFIX
Joe Perches [Fri, 9 Jun 2017 19:09:08 +0000 (16:09 -0300)]
media: tuner-core: Remove unused #define PREFIX

Commit 680d87c0a9e3 ("[media] tuner-core: use pr_foo, instead of
internal printk macros") removed the use of PREFIX, remove the #define

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: stkwebcam: Use more common logging styles
Joe Perches [Fri, 9 Jun 2017 17:54:57 +0000 (14:54 -0300)]
media: stkwebcam: Use more common logging styles

Convert STK_<LEVEL> to pr_<level> to use the typical kernel logging.
Add a define for pr_fmt.  No change in logging output.

Miscellanea:

o Remove now unused PREFIX and STK_<LEVEL> macros
o Realign arguments
o Use pr_<level>_ratelimited
o Add a few missing newlines to formats

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: coda: ctx->codec is not NULL in coda_alloc_framebuffers
Philipp Zabel [Thu, 8 Jun 2017 09:21:13 +0000 (06:21 -0300)]
media: coda: ctx->codec is not NULL in coda_alloc_framebuffers

This fixes a smatch warning:

    drivers/media/platform/coda/coda-bit.c:415 coda_alloc_framebuffers()
    error: we previously assumed 'ctx->codec' could be null (see line 396)

coda_alloc_framebuffers() is called from coda_start_encoding() and
__coda_start_decoding(). Both dereference ctx->codec before calling
coda_alloc_framebuffers() in lines 935 and 1649, so ctx->codec can not
be NULL.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Revert "[media] et8ek8: Export OF device ID as module aliases"
Arnd Bergmann [Thu, 8 Jun 2017 09:01:37 +0000 (06:01 -0300)]
media: Revert "[media] et8ek8: Export OF device ID as module aliases"

This one got applied twice, causing a build error with clang:

drivers/media/i2c/et8ek8/et8ek8_driver.c:1499:1: error: redefinition of '__mod_of__et8ek8_of_table_device_table'

Fixes: 9ae05fd1e791 ("[media] et8ek8: Export OF device ID as module aliases")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: bdisp-debug: Replace a seq_puts() call by seq_putc() in seven functions
Markus Elfring [Thu, 4 May 2017 17:14:15 +0000 (14:14 -0300)]
media: bdisp-debug: Replace a seq_puts() call by seq_putc() in seven functions

Seven single characters (line breaks) should be put into a sequence.
Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: entity: Catch unbalanced media_pipeline_stop calls
Kieran Bingham [Tue, 3 Jan 2017 13:12:11 +0000 (11:12 -0200)]
[media] media: entity: Catch unbalanced media_pipeline_stop calls

Drivers must not perform unbalanced calls to stop the entity pipeline,
however if they do they will fault in the core media code, as the
entity->pipe will be set as NULL. We handle this gracefully in the core
with a WARN for the developer.

Replace the erroneous check on zero streaming counts, with a check on
NULL pipe elements instead, as this is the symptom of unbalanced
media_pipeline_stop calls.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pincharts@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media/uapi/v4l: clarify cropcap/crop/selection behavior
Hans Verkuil [Mon, 8 May 2017 14:35:06 +0000 (11:35 -0300)]
[media] media/uapi/v4l: clarify cropcap/crop/selection behavior

Unfortunately the use of 'type' was inconsistent for multiplanar
buffer types. Starting with 4.13 both the normal and _MPLANE variants
are allowed, thus making it possible to write sensible code.

Yes, we messed up :-(

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[hans.verkuil@cisco.com: 4.14 -> 4.13 since this would go in for 4.13 after all]

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handling
Hans Verkuil [Mon, 8 May 2017 14:35:05 +0000 (11:35 -0300)]
[media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handling

The type field in struct v4l2_selection is supposed to never use the
_MPLANE variants. E.g. if the driver supports V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
then userspace should still pass V4L2_BUF_TYPE_VIDEO_CAPTURE.

The reasons for this are lost in the mists of time, but it is really
annoying. In addition, the exynos drivers didn't follow this rule and
instead expected the _MPLANE type.

To fix that code is added to the v4l2 core that maps the _MPLANE buffer
types to their regular equivalents before calling the driver.

Effectively this allows for userspace to use either _MPLANE or the regular
buffer type. This keeps backwards compatibility while making things easier
for userspace.

Since drivers now never see the _MPLANE buffer types the exynos drivers
had to be adapted as well.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: sen: Declare vimc_sen_video_ops as static
Helen Fornazier [Mon, 19 Jun 2017 17:00:21 +0000 (14:00 -0300)]
[media] vimc: sen: Declare vimc_sen_video_ops as static

Declare vimc_sen_video_ops as static, remove warning from sparse tool

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: sca: Add scaler
Helen Fornazier [Mon, 19 Jun 2017 17:00:20 +0000 (14:00 -0300)]
[media] vimc: sca: Add scaler

Implement scaler and integrated with the core

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: deb: Add debayer filter
Helen Fornazier [Mon, 19 Jun 2017 17:00:19 +0000 (14:00 -0300)]
[media] vimc: deb: Add debayer filter

Implement the debayer filter and integrate it with the core

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: Subdevices as modules
Helen Fornazier [Mon, 19 Jun 2017 17:00:18 +0000 (14:00 -0300)]
[media] vimc: Subdevices as modules

Change the core structure for adding subdevices in the topology.
Instead of calling the specific create function for each subdevice,
inject a child platform_device with the driver's name.
Each type of node in the topology (sensor, capture, debayer, scaler)
will register a platform_driver with the corresponding name through the
component subsystem.
Implementing a new subdevice type doesn't require vimc-core to be altered.

This facilitates future implementation of dynamic entities, where
hotpluging an entity in the topology is just a matter of
registering/unregistering a platform_device in the system.
It also facilitates other implementations of different nodes without
touching the core code and remove the need of a header file for each
type of node.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: cap: Support several image formats
Helen Fornazier [Mon, 19 Jun 2017 17:00:17 +0000 (14:00 -0300)]
[media] vimc: cap: Support several image formats

Allow user space to change the image format as the frame size, the
pixel format, colorspace, quantization, field YCbCr encoding
and the transfer function

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: sen: Support several image formats
Helen Fornazier [Mon, 19 Jun 2017 17:00:16 +0000 (14:00 -0300)]
[media] vimc: sen: Support several image formats

Allow user space to change the image format as the frame size, the
media bus pixel format, colorspace, quantization, field YCbCr encoding
and the transfer function

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: common: Add vimc_colorimetry_clamp
Helen Fornazier [Mon, 19 Jun 2017 17:00:15 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_colorimetry_clamp

Colorimetry value will always be checked in the same way. Adding a
helper macro for that

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: common: Add vimc_link_validate
Helen Fornazier [Mon, 19 Jun 2017 17:00:14 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_link_validate

All links will be checked in the same way. Adding a helper function for
that

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: common: Add vimc_pipeline_s_stream helper
Helen Fornazier [Mon, 19 Jun 2017 17:00:13 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_pipeline_s_stream helper

Move the vimc_cap_pipeline_s_stream from the vimc-cap.c to vimc-common.c
as this core will be reused by other subdevices to activate the stream
in their directly connected nodes

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: common: Add vimc_ent_sd_* helper
Helen Fornazier [Mon, 19 Jun 2017 17:00:12 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_ent_sd_* helper

As all the subdevices in the topology will be initialized in the same
way, to avoid code repetition the vimc_ent_sd_{register, unregister}
helper functions were created

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: Move common code from the core
Helen Fornazier [Mon, 19 Jun 2017 17:00:11 +0000 (14:00 -0300)]
[media] vimc: Move common code from the core

Remove helper functions from vimc-core and add it in vimc-common to
clean up the core.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vimc: sen: Integrate the tpg on the sensor
Helen Fornazier [Mon, 19 Jun 2017 17:00:10 +0000 (14:00 -0300)]
[media] vimc: sen: Integrate the tpg on the sensor

Initialize the test pattern generator on the sensor
Generate a colored bar image instead of a grey one

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: i2c: ov772x: Force use of SCCB protocol
Jacopo Mondi [Fri, 12 May 2017 12:36:59 +0000 (09:36 -0300)]
[media] media: i2c: ov772x: Force use of SCCB protocol

Commit e78902976150 ("i2c: sh_mobile: don't send a stop condition by
default inside transfers") makes the i2c_sh_mobile I2C-adapter emit a
stop/start sequence between messages in a single transfer only when
explicitly requested with I2C_M_STOP.

This breaks the ov772x driver in the SH4 Migo-R board as the Omnivision
sensor uses the I2C-like SCCB protocol that doesn't support repeated
starts:

i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out
ov772x 0-0021: Product ID error 92:92

Fix it by marking the client as SCCB, forcing the emission of a
stop/start sequence between all messages.
As I2C_M_STOP requires the I2C adapter to support protocol mangling,
ensure that the I2C_FUNC_PROTOCOL_MANGLING functionality is available.

Tested on SH4 Migo-R board, with OV772x now successfully probing

soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
ov772x 0-0021: ov7725 Product ID 77:21 Manufacturer ID 7f:a2

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb uapi docs: enums are passed by value, not reference
Mauro Carvalho Chehab [Wed, 21 Jun 2017 09:51:51 +0000 (06:51 -0300)]
[media] dvb uapi docs: enums are passed by value, not reference

Since 2015, the documentation for FE_DISEQC_SEND_BURST, FE_SET_TONE
and FE_SET_VOLTAGE are incorrectly saying that the enums are passed
by reference. They aren't: they're passed by value.

Fix the documentation to reflect reality.

Fixes: 81959d996a3b ("[media] DocBook: better document FE_DISEQC_SEND_BURST ioctl")
Fixes: d6b6d346e560 ("[media] DocBook: better document FE_SET_VOLTAGE ioctl")
Fixes: 6dc59e7a195f ("[media] DocBook: better document FE_SET_TONE ioctl")
Reported-by: Thierry Lelegard <thierry.lelegard@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb: don't use 'time_t' in event ioctl
Arnd Bergmann [Thu, 17 Sep 2015 21:19:34 +0000 (18:19 -0300)]
[media] dvb: don't use 'time_t' in event ioctl

'struct video_event' is used for the VIDEO_GET_EVENT ioctl, implemented
by drivers/media/pci/ivtv/ivtv-ioctl.c and
drivers/media/pci/ttpci/av7110_av.c. The structure contains a 'time_t',
which will be redefined in the future to be 64-bit wide, causing an
incompatible ABI change for this ioctl.

As it turns out, neither of the drivers currently sets the timestamp
field, and it is presumably useless anyway because of the limited
resolutions (no sub-second times). This means we can simply change
the structure definition to use a 'long' instead of 'time_t' and
remain compatible with all existing user space binaries when time_t
gets changed.

If anybody ever starts using this field, they have to make sure not
to use 1970 based seconds in there, as those overflow in 2038.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: venus: enable building with COMPILE_TEST
Stanimir Varbanov [Tue, 20 Jun 2017 13:13:50 +0000 (10:13 -0300)]
[media] media: venus: enable building with COMPILE_TEST

We want all media drivers to build with COMPILE_TEST, as the
Coverity instance we use on Kernel works only for x86. Also,
our test workflow relies on it, in order to identify git
bisect breakages.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
7 years ago[media] af9013: refactor power control
Antti Palosaari [Wed, 14 Jun 2017 01:58:06 +0000 (22:58 -0300)]
[media] af9013: refactor power control

Move power-up and power-down functionality to init/sleep ops and
get rid of old function.

Fixes and simplifies power-up functionality slightly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: refactor firmware download routine
Antti Palosaari [Wed, 14 Jun 2017 00:49:33 +0000 (21:49 -0300)]
[media] af9013: refactor firmware download routine

Refactor firmware download routine.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9015: move 2nd demod power-up wait different location
Antti Palosaari [Wed, 14 Jun 2017 00:32:08 +0000 (21:32 -0300)]
[media] af9015: move 2nd demod power-up wait different location

We need to wait 2nd demod power-up before download firmware. Move
that wait to more correct location.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: remove unneeded register writes
Antti Palosaari [Tue, 13 Jun 2017 23:42:52 +0000 (20:42 -0300)]
[media] af9013: remove unneeded register writes

Removed register writes are already chip defaults, are not required,
are set later or belong to AF9015 USB interface.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: add configurable TS output pin
Antti Palosaari [Tue, 13 Jun 2017 23:32:15 +0000 (20:32 -0300)]
[media] af9013: add configurable TS output pin

On serial TS mode output pin could be selected from D0 or D7.
Add configuration option to for it.

Rename TS mode config option prefix from AF9013_TS_ to AF9013_TS_MODE_.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9015: enable 2nd TS flow control when dual mode
Antti Palosaari [Tue, 13 Jun 2017 08:29:50 +0000 (05:29 -0300)]
[media] af9015: enable 2nd TS flow control when dual mode

It needs to be enabled in order to get stream from slave af9013 demod.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9015: fix and refactor i2c adapter algo logic
Antti Palosaari [Mon, 12 Jun 2017 20:06:19 +0000 (17:06 -0300)]
[media] af9015: fix and refactor i2c adapter algo logic

* fix write+read when write has more than one byte
* remove lock, not needed on that case
* remove useless i2c msg send loop, as we support only write, read and
write+read as one go and nothing more

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: add dvbv5 cnr
Antti Palosaari [Mon, 12 Jun 2017 18:10:08 +0000 (15:10 -0300)]
[media] af9013: add dvbv5 cnr

Add support for DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: fix error handling
Antti Palosaari [Mon, 12 Jun 2017 17:32:36 +0000 (14:32 -0300)]
[media] af9013: fix error handling

Use typical (return 0/goto err/return err) error handling everywhere.
Add missing error handling where missing.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: convert to regmap api
Antti Palosaari [Mon, 12 Jun 2017 05:49:33 +0000 (02:49 -0300)]
[media] af9013: convert to regmap api

Use regmap for register access. Own low level i2c read and write
routines for regmap is still needed because chip uses single command
byte in addition to typical i2c register access.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: fix logging
Antti Palosaari [Sun, 11 Jun 2017 01:04:30 +0000 (22:04 -0300)]
[media] af9013: fix logging

We can simplify logging as we now have a proper i2c client
to pass for kernel dev_* logging functions.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: use kernel 64-bit division
Antti Palosaari [Sun, 11 Jun 2017 00:12:14 +0000 (21:12 -0300)]
[media] af9013: use kernel 64-bit division

Replace own binary division with 64-bit multiply and division.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: add i2c client bindings
Antti Palosaari [Sat, 10 Jun 2017 23:53:42 +0000 (20:53 -0300)]
[media] af9013: add i2c client bindings

Add kernel i2c driver bindings.
That allows dev_* logging, regmap and more.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: move config values directly under driver state
Antti Palosaari [Sat, 10 Jun 2017 22:24:34 +0000 (19:24 -0300)]
[media] af9013: move config values directly under driver state

It shorten, as typed chars, access to config values as there is one
pointer less. Also, when config/platform data is passed to driver there
could be some values that are not relevant to store state as such or
not needed to store at all.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9015: use correct 7-bit i2c addresses
Antti Palosaari [Sun, 5 Feb 2017 20:09:38 +0000 (18:09 -0200)]
[media] af9015: use correct 7-bit i2c addresses

Driver was using wrong "8-bit" i2c addresses for demods and tuners.
Internal demod i2c address was not set at all. These are needed
to be fixed before proper i2c client binding is used.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9013: add check on af9013_wr_regs() return value
Gustavo A. R. Silva [Thu, 15 Jun 2017 20:42:44 +0000 (17:42 -0300)]
[media] af9013: add check on af9013_wr_regs() return value

Check return value from call to af9013_wr_regs(), so in case of
error print debug message and return.

Addresses-Coverity-ID: 1227035

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: hardware IDs for new C2T2 cards and other devices
Daniel Scheller [Sun, 9 Apr 2017 19:38:28 +0000 (16:38 -0300)]
[media] ddbridge: hardware IDs for new C2T2 cards and other devices

Adds hardware IDs for all Sony CXD-based Cine-cards and MaxA8 devices, also
adds some other yet missing IDs like the Octopus V3, Octopus OEM and
Octopus Mini, as well as cards with unknown/deleted sub-ids.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: support for Sony CXD28xx C/C2/T/T2 tuner modules
Daniel Scheller [Sun, 9 Apr 2017 19:38:27 +0000 (16:38 -0300)]
[media] ddbridge: support for Sony CXD28xx C/C2/T/T2 tuner modules

Properly detect and attach Ports and Flex modules with the Sony CXD28xxER
series demods. This makes newer Cine cards and most DuoFlex C/C2/T/T2 (or
any combination of these systems) work, PCI IDs need to be added though.

Note: This utilises the CXD2841ER demod driver, which requires the changes
from this patch series to properly work. Without those changes, it won't
function properly (if at all).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: add I2C functions, add XO2 module support
Daniel Scheller [Sun, 9 Apr 2017 19:38:26 +0000 (16:38 -0300)]
[media] ddbridge: add I2C functions, add XO2 module support

Some Flex modules (mostly with anyof C/C2/T/T2 demods based on the Sony
CXD28xxER series) are equipped with an interface named XO2 (which
appears to be the Lattice MachXO2). Add functionality to detect such
links and initialise them, so any tuner module with such an interface can
be used.

This also adds dummy detection for any possible connected module, telling
the user it isn't supported at this very moment.

Also adds i2c_io(), i2c_write() and i2c_write_reg(), all required for the
XO2 handling functionality.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: board control setup, ts quirk flags
Daniel Scheller [Sun, 9 Apr 2017 19:38:25 +0000 (16:38 -0300)]
[media] ddbridge: board control setup, ts quirk flags

This is a backport of the board control setup from the vendor provided
dddvb driver package, which does additional device initialisation based
on the board_control device info values. Also backports the TS quirk
flags which is used to control setup and usage of the tuner modules
soldered on the bridge cards (e.g. CineCTv7, CineS2 V7, MaxA8 and the
likes).

Functionality originates from ddbridge vendor driver. Permission for
reuse and kernel inclusion was formally granted by Ralph Metzler
<rjkm@metzlerbros.de>.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: improved snr reporting
Daniel Scheller [Sun, 9 Apr 2017 19:38:24 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: improved snr reporting

On DVB-T/T2 at least, SNR might be reported as >2500dB, which not only is
just wrong but also ridiculous, so fix this by improving the conversion
of the register value.

The INTLOG10X100 function/macro and the way the values are converted were
both taken from DD's cxd2843 driver.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: more configurable TSBITS
Daniel Scheller [Sun, 9 Apr 2017 19:38:23 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: more configurable TSBITS

Bits 3 and 4 of the TSCONFIG register are important for certain hardware
constellations, in that they need to be zeroed. Add a configuration flag
to toggle this.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: configurable IFAGCNEG
Daniel Scheller [Sun, 9 Apr 2017 19:38:22 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: configurable IFAGCNEG

Adds a flag to enable or disable the IFAGCNEG bit in cxd2841er_init_tc().

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: make lock wait in set_fe_tc() optional
Daniel Scheller [Sun, 9 Apr 2017 19:38:21 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make lock wait in set_fe_tc() optional

Don't wait for FE_HAS_LOCK in set_frontend_tc() and thus don't hammer the
lock status register with inquiries when CXD2841ER_NO_WAIT_LOCK is set
in the configuration, which also unneccessarily blocks applications until
a TS LOCK has been acquired. Rather, API and applications will check for
a TS LOCK by utilising the tune fe_op, read_status and get_frontend ops,
which is sufficient.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: optionally tune earlier in set_frontend()
Daniel Scheller [Sun, 9 Apr 2017 19:38:20 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: optionally tune earlier in set_frontend()

When AUTO_IFHZ is set and the tuner is supposed to provide proper IF speed
values, it should be possible to have the tuner setup take place before
the demod is configured, else the demod might be configured with either
wrong (old), or even no values at all, which obviously will cause issues.
To set this behaviour in the most flexible way, this is done with a
separate flag instead of making this depend on AUTO_IFHZ.

It should be evaluated if tuning shouldn't take place earlier in all cases
and hardware constellations.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: make ASCOT use optional
Daniel Scheller [Sun, 9 Apr 2017 19:38:19 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make ASCOT use optional

The Sony CXD28xx demods may have other tuner types attached to them (e.g.
NXP TDA18212), so don't mandatorily configure and enable the ASCOT
functionality, but make this conditional by a config flag.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: TS_SERIAL config flag
Daniel Scheller [Sun, 9 Apr 2017 19:38:18 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: TS_SERIAL config flag

Some constellations work/need a serial TS transport mode. This adds a flag
that will toggle set up of such mode.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: support IF speed calc from tuner values
Daniel Scheller [Sun, 9 Apr 2017 19:38:17 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: support IF speed calc from tuner values

Add a AUTO_IFHZ flag and a function that will read IF speed values from any
attached tuner if the tuner supports this and if AUTO_IFHZ is enabled, and
else the passed default value (which probably matches Sony ASCOT tuners)
will be passed back. The returned value is then used to calculate the iffeq
which the demod will be programmed with.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: make call to i2c_gate_ctrl optional
Daniel Scheller [Sun, 9 Apr 2017 19:38:16 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make call to i2c_gate_ctrl optional

Some cards/bridges wrap i2c_gate_ctrl handling with a mutex_lock(). This is
e.g. done in ddbridge to protect against concurrent tuner access with
regards to the dual tuner HW, where concurrent tuner reconfiguration can
result in tuning fails or bad reception quality. When the tuner driver
additionally tries to open the I2C gate (which e.g. the tda18212 driver
does) when the demod already did this, this will lead to a deadlock. This
makes the calls to i2c_gatectrl from the demod driver optional when the
flag is set, leaving this to the tuner driver. For readability reasons and
to not have the check duplicated multiple times, the setup is factored
into cxd2841er_tuner_set().

This commit also updates the netup card driver (which seems to be the only
consumer of the cxd2841er as of now).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: add variable for configuration flags
Daniel Scheller [Sun, 9 Apr 2017 19:38:15 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: add variable for configuration flags

Throughout the patch series some configuration flags will be added to the
demod driver. This patch prepares this by adding the flags var to
struct cxd2841er_config, which will serve as a bitmask to toggle various
options and behaviour in the driver.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: replace IFFREQ calc macros into functions
Daniel Scheller [Sun, 9 Apr 2017 19:38:14 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: replace IFFREQ calc macros into functions

The way the MAKE_IFFREQ_CONFIG macros are written make it impossible to
pass regular integers for iffreq calculation, since this will cause "SSE
register return with SSE disabled" compile errors. This changes the
calculation into C functions which also might help when debugging. Also,
expand all passed frequencies from MHz to Hz scale.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: support CXD2837/38/43ER demods/Chip IDs
Daniel Scheller [Sun, 9 Apr 2017 19:38:13 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: support CXD2837/38/43ER demods/Chip IDs

Those demods are programmed in the same way as the CXD2841ER/54ER and can
be handled by this driver. Support added in a way matching the existing
code, supported delivery systems are set according to what each demod
supports.

Updates the type string setting used for printing the "attaching..." log
line aswell.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: immediately unfreeze regs when done
Daniel Scheller [Sun, 9 Apr 2017 19:38:12 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: immediately unfreeze regs when done

Do unfreeze_regs() directly when accessing the demod registers is done,
and don't have multiple unfreeze's on different conditions, which even
can get prone to errors.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: do I2C reads in one go
Daniel Scheller [Sun, 9 Apr 2017 19:38:11 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: do I2C reads in one go

Doing the I2C read operation with two calls to i2c_transfer() causes the
exclusive I2C bus lock of the underlying adapter to be released. While this
isn't an issue if only one demodulator is attached to the bus, having two
or even more causes troubles in that concurrent accesses to the different
demods will cause all kinds of issues due to wrong data being returned on
read operations (for example, the TS config register will be set wrong).
This changes the read_regs() function to do the operation in one go (by
calling i2c_transfer with the whole msg list instead of one by one) to not
loose the I2C bus lock, fixing all sorts of random runtime failures.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/cxd2841er: remove kernel log spam in non-debug levels
Daniel Scheller [Sun, 9 Apr 2017 19:38:10 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: remove kernel log spam in non-debug levels

This moves the I2C debug dump into the preceding dev_dbg() call by
utilising the %*ph format macro and removes the call to
print_hex_debug_bytes().

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: support STV0367-based cards and modules
Daniel Scheller [Wed, 29 Mar 2017 16:43:13 +0000 (13:43 -0300)]
[media] ddbridge: support STV0367-based cards and modules

This adds detection and activation for STV0367-based tuner hardware (namely
CineCTv6 bridge cards and older DuoFlex CT addon modules). Utilises the
extended stv0367 demod driver.

TDA18212 i2c_client/regmap-api code was originally implemented by
Antti Palosaari <crope@iki.fi> in a variant to update the ddbridge code
from the vendor dddvb package (formal ack for these parts received).
Original patch at [1].

When boards with STV0367 are cold-started, there might be issues with the
I2C gate, causing the TDA18212 detection/probe to fail. For these demods,
a workaround (tuner_tda18212_ping) is implemented which probes the tuner
twice on this hardware constellation which will resolve the problem and
put all components into a working state. Other demod/port types won't be
retried.

[1] https://patchwork.linuxtv.org/patch/25146/

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ddbridge: add i2c_read_regs()
Daniel Scheller [Wed, 29 Mar 2017 16:43:12 +0000 (13:43 -0300)]
[media] ddbridge: add i2c_read_regs()

Adds new i2c_read_regs() function and make i2c_read_reg() wrap into this
with len=1. Required for the tuner_tda18212_ping() and XO2 handling
functions (part of the Sony CXD28xx support patch series).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: add Digital Devices compatibility
Daniel Scheller [Wed, 29 Mar 2017 16:43:11 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: add Digital Devices compatibility

This - in conjunction with the previous changes - makes it possible to use
the STV0367 DVB-C/T demodulator driver with Digital Devices hardware having
this demodulator soldered on them (namely CineCTv6 bridges and some earlier
DuoFlex CT addon modules).

The changes do the following:

- add a third *_attach function which will make use of a third frontend_ops
  struct which announces both -C and -T support (the same as with DD's own
  driver stv0367dd). This is necessary to support both delivery systems
  on one FE without having to do large conversions to VB2 or the need to
  select either -C or -T mode via modparams and the like. Additionally,
  the frontend_ops point to new "glue" functions which will then call into
  the existing functionality depending on the active delivery system/demod
  state (all used functionality works almost OOTB).
- Demod initialisation has been ported from stv0367dd. DD's driver always
  does a full init of both OFDM and QAM cores, with some additional things.
  The active delivery system is remembered and upon switch, the Demod will
  be reconfigured to work in OFDM or QAM mode (that's what the ddb_setup_XX
  functions are used for). Note that in QAM mode, the DD demods work with
  an IC speed of 58Mhz. It's not very good to perform full reinits upon
  Demod mode changes since in very rare occasions this can lead to the I2C
  interface or the whole Demod to crash, requiring a powercycle, thus the
  flag to perform full reinit is set to disabled.
- A little enum is added for named identifiers of the current Demod state.

Initialisation code/register writes originate from stv0367dd. Permission
to reuse was formally granted by Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: add defaults for use w/DD-branded devices
Daniel Scheller [Wed, 29 Mar 2017 16:43:10 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: add defaults for use w/DD-branded devices

Digital Devices uses defaults tables in their stv0367dd demod driver
variant which differ in a few registers, at least enough that no stable
operation can be provided with the tables already present in the driver
(init succeeds and DVB reception works but at least when the driver is
reloaded using rmmod/modprobe, the demod goes into a crashed state in a
way it doesn't react on any I2C command anymore, while even more
side-effects may occur), so there's a good reason to better have another
set of defaults.

Defaults originating from the stv0367dd driver. Permission to reuse them
was formally granted by Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: fix symbol rate conditions in cab_SetQamSize()
Daniel Scheller [Wed, 29 Mar 2017 16:43:09 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: fix symbol rate conditions in cab_SetQamSize()

The values used for comparing symbol rates and the resulting conditional
reg writes seem wrong (rates multiplied by ten), so fix those values.
While this doesn't seem to influence operation, it should be fixed anyway.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: selectable QAM FEC Lock status register
Daniel Scheller [Wed, 29 Mar 2017 16:43:08 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: selectable QAM FEC Lock status register

In some configurations (due to different PIN config, wiring or so), the
QAM FECLock might be signalled using a different register than
F367CAB_QAMFEC_LOCK (e.g. F367CAB_DESCR_SYNCSTATE on Digital Devices hw),
so make that register selectable.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: support reading if_khz from tuner config
Daniel Scheller [Wed, 29 Mar 2017 16:43:07 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: support reading if_khz from tuner config

Currently, if_khz is set and provided using the configuration var in
struct stv0367_config. However, in some constellations, the value might be
different for differing channel bandwidths or even -T and -C operation.
When e.g. used in conjunction with TDA18212 tuners, the tuner frontend
might be aware of the different freqs. This factors if_khz retrieval in a
function, which checks a new flag if an automatic retrieval attempt should
be made, and if the tuner provides it, use it whenever needed.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends/stv0367: make full reinit on set_frontend() optional
Daniel Scheller [Wed, 29 Mar 2017 16:43:06 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: make full reinit on set_frontend() optional

Every time dvb_frontend_ops.set_frontend() is called, an almost full reinit
of the demodulator will be performed. While this might cause a slight delay
when switching channels due to all involved tables being rewritten, it can
even be dangerous in certain causes in that the demod may lock up and
requires to be powercycled (this can happen on Digital Devices hardware).
So this adds a flag if it should be done, and to not change behaviour with
existing card support, it'll be enabled in all cases.

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