History log of /linux-master/drivers/media/dvb-frontends/stv0367.c
Revision Date Author Comments
# 7a4cf27d 16-Feb-2024 Arnd Bergmann <arnd@arndb.de>

media: dvb-frontends: avoid stack overflow warnings with clang

A previous patch worked around a KASAN issue in stv0367, now a similar
problem showed up with clang:

drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-larger-than]
1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe)

Rework the stv0367_writereg() function to be simpler and mark both
register access functions as noinline_for_stack so the temporary
i2c_msg structures do not get duplicated on the stack when KASAN_STACK
is enabled.

Fixes: 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASAN")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


# 86495af1 08-Sep-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: dvb: symbol fixup for dvb_attach()

In commit 9011e49d54dc ("modules: only allow symbol_get of
EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted
to GPL-only marked symbols. This interacts oddly with the DVB logic
which only uses dvb_attach() to load the dvb driver which then uses
symbol_get().

Fix this up by properly marking all of the dvb_attach attach symbols as
EXPORT_SYMBOL_GPL().

Fixes: 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules")
Cc: stable <stable@kernel.org>
Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: linux-media@vger.kernel.org
Cc: linux-modules@vger.kernel.org
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://lore.kernel.org/r/20230908092035.3815268-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f97fa3dc 03-Jul-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

lib/math: Move dvb_math.c into lib/math/int_log.c

Some existing and new users may benefit from the intlog2() and
intlog10() APIs, make them wide available.

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20230619172019.21457-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230703135211.87416-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 32f4797d 14-Oct-2021 Colin Ian King <colin.king@intel.com>

media: dvb-frontends/stv0367: remove redundant variable ADCClk_Hz

GIT_AUTHOR_NAME=Colin King
GIT_AUTHOR_EMAIL=colin.king@canonical.com

Variable ADCClk_Hz is being initialised with a variable that is never read
and then re-assigned immediately afterwards. Clean up the code by removing
it and just returning the return value from the call to stv0367cab_get_mclk

Addresses-Coverity: ("Unused value")

Link: https://lore.kernel.org/linux-media/20211014153253.63527-1-colin.king@canonical.com

Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# c942fddf 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157

Based on 3 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1105 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f1b1eabf 05-Jul-2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: dvb: represent min/max/step/tolerance freqs in Hz

Right now, satellite frontend drivers specify frequencies in kHz,
while terrestrial/cable ones specify in Hz. That's confusing
for developers.

However, the main problem is that universal frontends capable
of handling both satellite and non-satelite delivery systems
are appearing. We end by needing to hack the drivers in
order to support such hybrid frontends.

So, convert everything to specify frontend frequencies in Hz.

Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# fada1935 28-Dec-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: move dvb kAPI headers to include/media

Except for DVB, all media kAPI headers are at include/media.

Move the headers to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 3cd890db 30-Nov-2017 Arnd Bergmann <arnd@arndb.de>

media: dvb-frontends: fix i2c access helpers for KASAN

A typical code fragment was copied across many dvb-frontend drivers and
causes large stack frames when built with with CONFIG_KASAN on gcc-5/6/7:

drivers/media/dvb-frontends/cxd2841er.c:3225:1: error: the frame size of 3992 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/cxd2841er.c:3404:1: error: the frame size of 3136 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv0367.c:3143:1: error: the frame size of 4016 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv090x.c:3430:1: error: the frame size of 5312 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv090x.c:4248:1: error: the frame size of 4872 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]

gcc-8 now solves this by consolidating the stack slots for the argument
variables, but on older compilers we can get the same behavior by taking
the pointer of a local variable rather than the inline function argument.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715

Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 82ba8132 21-Nov-2017 Colin Ian King <colin.king@canonical.com>

media: dvb-frontends/stv0367: remove redundant self assignment of temporary

The self assignment of temporary is redundant and can be removed.
Detected using coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# c6721526 14-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_ops

Since the cab_* codepath doesn't recognize QAM_AUTO, don't announce that
it is supported when it really isn't. Fixes ie. w_scan from
unconditionally using QAM_AUTO on DVB-C scans.

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


# d105d083 14-Jul-2017 Daniel Scheller <d.scheller@gmx.net>

media: dvb-frontends/stv0367: improve QAM fe_status

While cab_state->state gives a quite accurate indication of the demod
signal status, it might be incorrect if cab_algo() wasn't able to
determine the exact status, with cab_algo() being the only place where
this status was updated from, and it is only called upon tuning to new
parameters passed to set_frontend(). Thus, the status will be wrong
until the demod is retuned. With the cab_signal_type parsing in
read_status(), this results in unusual fe_states like FE_HAS_SIGNAL |
FE_HAS_CARRIER | FE_HAS_LOCK, which, while userspace applications check
for FE_HAS_LOCK and work fine, leads to missing CNR or UCB stats.

Fix this by re-reading CAB_FSM_STATUS and updating cab_state->state() in
read_status(). While at it, refactor the fsm/qamfeclock and the
fsm->signaltype parsing into separate functions to make things cleaner
and deduplicate code. Also, assume full QAM FEC lock equals full
FE_STATUS.

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


# 3658ea39 08-Jul-2017 Daniel Scheller <d.scheller@gmx.net>

media: dvb-frontends/stv0367: DDB frontend status inquiry fixup

Return 0 instead of -EINVAL in get_frontend if no demod mode is active.
This fixes ie. dvb-fe-tool getting confused and assuming a DVBv3 FE on idle
frontends when the FE has been put to sleep using sleep().

Also, in read_status(), don't immediately return when no demod is active,
so the remaining code has a chance to clear the signal statistics.

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


# 430e29d9 25-Jun-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

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>


# 006fe8ee 25-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# 87b46710 25-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# f5a1ba83 25-Jun-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

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>


# d394ad12 25-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# b138afda 21-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# 4043eb23 21-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# f9c1e254 21-Jun-2017 Daniel Scheller <d.scheller@gmx.net>

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>


# dbbac11e 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[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>


# 8b39f076 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[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>


# cae7a901 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[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>


# b16338e3 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[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>


# 7718dcf0 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[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>


# 8a9c0735 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[media] dvb-frontends/stv0367: make PLLSETUP a function, add 58MHz IC speed

This moves the PLL SETUP code from stv0367ter_init() into a dedicated
function, and also make it possible to configure 58Mhz IC speed at
27MHz Xtal (used on STV0367-based DDB cards/modules in QAM mode).

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


# 8881ceb8 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[media] dvb-frontends/stv0367: move out tables, support multiple tab variants

Move the *ter and *cab st_register tables into a separate header file and
additionally organize them via a multidimensional array, allowing to add
more tables with differing init values, and also prepare for a base init
table which should contain general setup values. Also add a state var to
store the table triplet to be used.

Also fixes three minor style problems reported by checkpatch.

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


# 41727cbb 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[media] dvb-frontends/stv0367: refactor defaults table handling

Change defaults table writing so tables can be of dynamic length without
having to keep track of their lengths by adding and evaluating an end
marker (reg 0x0000), also move table writing to a dedicated function to
remove code duplication. Additionally mark st_register tables const since
they're used read-only.

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


# df5a38e9 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[media] dvb-frontends/stv0367: print CPAMP status only if stv_debug is enabled

The CPAMP log lines generated in stv0367_ter_check_cpamp() are printed
everytime tuning succeeds or fails, quite cluttering the normal kernel log.
Use dprintk() instead of printk(KERN_ERR...) so that if the information is
needed, it'll be printed when the stv_debug modparam is enabled.

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


# f61c2991 29-Mar-2017 Daniel Scheller <d.scheller@gmx.net>

[media] dvb-frontends/stv0367: add flag to make i2c_gatectrl optional

Some hardware and bridges (namely ddbridge) require that tuner access is
limited to one concurrent access and wrap i2c gate control with a
mutex_lock when attaching frontends. According to vendor information, this
is required as concurrent tuner reconfiguration can interfere each other
and at worst cause tuning fails or bad reception quality.

If the demod driver does gate_ctrl before setting up tuner parameters, and
the tuner does another I2C enable, it will deadlock forever when gate_ctrl
is wrapped into the mutex_lock. This adds a flag and a conditional before
triggering gate_ctrl in the demodulator driver.

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


# bcb63314 28-Oct-2016 Sakari Ailus <sakari.ailus@linux.intel.com>

[media] media: Drop FSF's postal address from the source code files

Drop the FSF's postal address from the source code files that typically
contain mostly the license text. Of the 628 removed instances, 578 are
outdated.

The patch has been created with the following command without manual edits:

git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \
drivers/media/ include/media|while read i; do i=$i perl -e '
open(F,"< $ENV{i}");
$a=join("", <F>);
$a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m
&& $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, $2\n$1/m;
close(F);
open(F, "> $ENV{i}");
print F $a;
close(F);'; done

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>


# bd336e63 09-Aug-2016 Max Kellermann <max.kellermann@gmail.com>

[media] dvb: make DVB frontend *_ops instances "const"

These are immutable. Making them "const" allows the compiler to move
them to the "rodata" section.

Note that cxd2841er_t_c_ops cannot be made "const", because
cxd2841er_attach() modifies it. Ouch!

[mchehab@s-opensource.com: fix merge conflicts]
Signed-off-by: Max Kellermann <max.kellermann@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 7e3e68bc 03-Feb-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] dvb_frontend: pass the props cache to get_frontend() as arg

Instead of using the DTV properties cache directly, pass the get
frontend data as an argument. For now, everything should remain
the same, but the next patch will prevent get_frontend to
affect the global cache.

This is needed because several drivers don't care enough to only
change the properties if locked. Due to that, calling
G_PROPERTY before locking on those drivers will make them to
never lock. Ok, those drivers are crap and should never be
merged like that, but the core should not rely that the drivers
would be doing the right thing.

Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 6930f669 30-Jul-2015 Peter Griffin <peter.griffin@linaro.org>

[media] stv0367: Add support for 16Mhz reference clock

The B2100A dvb NIM card from ST has 2x stv0367 demodulators
and 2x TDA18212 silicon tuners, with a 16Mhz crystal. To
get this working properly with the upstream driver we need
to add support for the 16Mhz reference clock.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 86a10283 30-Jul-2015 Peter Griffin <peter.griffin@linaro.org>

[media] stv0367: Refine i2c error trace to include i2c address

When using stv0367 demodulator with STi STB platforms,
we can have easily have four or more stv0367 demods running
in the system at one time.

As typically the b2120 reference design ships with a b2004a daughter
board, which can accept two dvb NIM cards, and each b2100A NIM
has 2x stv0367 demods and 2x NXPs tuner on it.

In such circumstances it is useful to print the i2c address
on error messages to know which one is failing due to I2C issues.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 0df289a2 07-Jun-2015 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] dvb: Get rid of typedev usage for enums

The DVB API was originally defined using typedefs. This is against
Kernel CodingStyle, and there's no good usage here. While we can't
remove its usage on userspace, we can avoid its usage in Kernelspace.

So, let's do it.

This patch was generated by this shell script:

for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done

While here, make CodingStyle fixes on the affected lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*


# 886da6ac 22-Sep-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] stv0367: Remove an unused parameter

cab_state->modulation is initialized with a wrong value:

drivers/media/dvb-frontends/stv0367.c:3000:42: warning: mixing different enum types
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum fe_modulation versus
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum stv0367cab_mod

as it was declared as "enum stv0367cab_mod". While it could be fixed,
there's no value on it, as this is never used.

So, just remove the modulation from cab_state structure.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# eafeda96 15-Aug-2014 Maks Naumov <maksqwe1@ukr.net>

[media] media: stv0367: fix frontend modulation initialization with FE_CAB_MOD_QAM256

It was using the wrong constant for QAM256 on get_frontend.

Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 7c995076 03-Sep-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] stv0367: just return 0 instead of using a var

Instead of allocating a var to store 0 and just return it,
change the code to return 0 directly.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 817d2fd4 20-Aug-2014 Hans Verkuil <hans.verkuil@cisco.com>

[media] stv0367: fix sparse warnings

drivers/media/dvb-frontends/stv0367.c:557:5: warning: symbol 'stv0367cab_RF_LookUp1' was not declared. Should it be static?
drivers/media/dvb-frontends/stv0367.c:569:5: warning: symbol 'stv0367cab_RF_LookUp2' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 20721185 24-Jun-2014 Emil Goode <emilgoode@gmail.com>

[media] Remove checks of struct member addresses

This removes checks of struct member addresses since they likely result
in the condition always being true. Also in the stb6100_get_bandwidth
and tda8261_get_bandwidth functions the pointers frontend_ops and
tuner_ops are assigned the same addresses twice.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 9aca4fb0 02-Nov-2013 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] stv0367: Don't use dynamic static allocation

Dynamic static allocation is evil, as Kernel stack is too low, and
compilation complains about it on some archs:
drivers/media/dvb-frontends/stv0367.c:791:1: warning: 'stv0367_writeregs.constprop.4' uses dynamic stack allocation [enabled by default]
Instead, let's enforce a limit for the buffer. Considering that I2C
transfers are generally limited, and that devices used on USB has a
max data length of 64 bytes for the control URBs.
So, it seem safe to use 64 bytes as the hard limit for all those devices.
On most cases, the limit is a way lower than that, but this limit
is small enough to not affect the Kernel stack, and it is a no brain
limit, as using smaller ones would require to either carefully each
driver or to take a look on each datasheet.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 83a35e36 28-Jun-2013 Geert Uytterhoeven <geert@linux-m68k.org>

treewide: relase -> release

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 8c8ca1c7 27-Oct-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] stv0367: get rid of warning: no previous prototype

drivers/media/dvb-frontends/stv0367.c:1267:25: warning: no previous prototype for 'stv0367ter_lock_algo' [-Wmissing-prototypes]
drivers/media/dvb-frontends/stv0367.c:1531:5: warning: no previous prototype for 'stv0367ter_init' [-Wmissing-prototypes]
drivers/media/dvb-frontends/stv0367.c:2381:21: warning: no previous prototype for 'stv0367cab_SetQamSize' [-Wmissing-prototypes]
drivers/media/dvb-frontends/stv0367.c:2765:5: warning: no previous prototype for 'stv0367cab_init' [-Wmissing-prototypes]
drivers/media/dvb-frontends/stv0367.c:882:4: warning: no previous prototype for 'stv0367_getbits' [-Wmissing-prototypes]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 9a0bf528 13-Aug-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] move the dvb/frontends to drivers/media/dvb-frontends

Raise the DVB frontends one level up, as the intention is to remove
the drivers/media/dvb directory.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>