History log of /linux-master/drivers/media/dvb-frontends/si2168_priv.h
Revision Date Author Comments
# 51c2664a 17-Apr-2021 Lukas Middendorf <kernel@tuxforce.de>

media: media si2168: fully initialize si2168 on resume only when necessary

At connection time (or boot) in si2168_probe(), the firmware is not
loaded to the device and the device is not fully activated. It is
not useful or sensible to do this full initialization on resume in
case it has not been previously initialized and is expected to be
in this initialized state.
Calling si2168_init() and therefore reading the firmware file for
the first time during resume leads to problems and should be avoided.
It is however safe to read the firmware file once it has already been
read outside of a suspend/resume situation.

Add a staus flag 'initialized' to store whether si2168_init() has
successfully been called. If initialization fails (e.g. due to missing
firmware file), the flag is not set.
Register a separate si2168_resume callback which only calls
si2168_init() once the 'initialized' flag has been set and it is safe
to load the firmware at resume.
The first call to si2168_init() will now always happen when the device
is actually used for the first time and never during resume.
This avoids the unsafe firmware file reading and should also speed up
resume by skipping unnecessary device initialization.

Link: https://lore.kernel.org/linux-media/20210418001204.7453-3-kernel@tuxforce.de

[mchehab: fix several Coding Style issues]
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Lukas Middendorf <kernel@tuxforce.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 40ae6eff 18-Apr-2021 Lukas Middendorf <kernel@tuxforce.de>

media: si2168: drop support for old firmware file name for si2168 B40

The si2168 B40 firmware file name has been changed in or before 2014.
During initialization, the new file name is preferred, but the old file
name is used as a fallback when request_firmware with the new file name
fails. Once reading the old file name has been attempted, only this name
will be used on further firmware loading attempts. During resume,
firmware reading with the new file name can (and likely will) fail even
when it actually exists. So this permanent switch to the fallback
firmware name happens even when not desired.

Any system using a recent kernel version can be expected to have the
firmware under the new name. The major distributions are either using
the dvb firmware collection from LibreELEC, which has the new firmware
file name, or do not package the firmware file but have documentation
pointing towards a manual installation of the firmware file under the
new name. If the firmware is available under the old name, it is
severely outdated. If the switch to the old file name is performed,
further firmware loading will either permanently fail (if it is not
available) or an outdated firmware version will be used.

Drop support for the fallback firmware file name and fail directly if
the firmware is not available under its current name. On following
attempts, the firmware read will then be retried with the correct
current name instead of the old name.

As reasoned above, there should be no negative effects of this change,
while simplifying code (the B40 variant will be handled identical
compared to the other variants of the si2168) and at the same time
fixing possible problems if firmware loading fails on resume.

Link: https://lore.kernel.org/linux-media/20210418161544.58858-1-kernel@tuxforce.de

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


# 1c9b943c 04-Oct-2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: si2168: use bits instead of bool for flags

Using bool on struct is not recommended, as it wastes lots of
space. So, instead, let's use bits.

While here, convert the comments to kernel-doc format.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@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>


# d4c779bc 17-Jan-2018 Brad Love <brad@nextdimension.cc>

media: si2168: Add spectrum inversion property

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

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

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


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


# 50d64462 07-Feb-2017 Evgeny Plehov <EvgenyPlehov@ukr.ne>

[media] si2168: Si2168-D60 support

Support for new demod version.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 8393c003 08-Dec-2016 Antti Palosaari <crope@iki.fi>

[media] si2168: implement ber statistics

Implement DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 6ab1e943 29-Jun-2016 Antti Palosaari <crope@iki.fi>

[media] si2168: add support for newer firmwares

Si2168-B40 firmware API has changed somewhere between 4.0-11 and
4.0-19 so that sleep will lose firmware upgrade from the chip. Due
to that firmware re-upload is needed when newer firmwares are used.

Rewrote firmware handling logic partly at the same.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# e6d7ffcd 04-May-2016 Antti Palosaari <crope@iki.fi>

[media] si2168: change the i2c gate to be mux-locked

The root i2c adapter lock is then no longer held by the i2c mux during
accesses behind the i2c gate, and such accesses need to take that lock
just like any other ordinary i2c accesses do.

So, declare the i2c gate mux-locked, and zap the code that makes the
i2c accesses unlocked. But add a mutex so that firmware commands are
still serialized.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 58d7b541 20-Apr-2016 Peter Rosin <peda@axentia.se>

[media] si2168: convert to use an explicit i2c mux core

Allocate an explicit i2c mux core to handle parent and child adapters
etc. Update the select/deselect ops to be in terms of the i2c mux core
instead of the child adapter.

Tested-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 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/*


# d2b72f64 29-May-2015 Antti Palosaari <crope@iki.fi>

[media] si2168: Implement own I2C adapter locking

We need own I2C locking because of tuner I2C adapter/repeater.
Firmware command is executed using I2C send + reply message. Default
I2C adapter locking protects only single I2C operation, not whole
send + reply sequence as needed. Due to that, it was possible tuner
I2C message interrupts firmware command sequence.

Reported-by: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 8117a312 05-May-2015 Olli Salonen <olli.salonen@iki.fi>

[media] si2168: add support for gapped clock

Add a parameter in si2168_config to support gapped clock. This might be
necessary on some devices with higher bitrates.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# a87a4d34 26-Feb-2015 Yannick Guerrini <yguerrini@tomshardware.fr>

[media] si2168: tda10071: m88ds3103: Fix trivial typos

Change 'firmare' to 'firmware'

Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 2701e84f 26-Feb-2015 Yannick Guerrini <yguerrini@tomshardware.fr>

si2168, tda10071, m88ds3103: Fix firmware wording

Change 'firmare' to 'firmware'

Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 3de35835 25-Nov-2014 Antti Palosaari <crope@iki.fi>

[media] si2168: get rid of own struct i2c_client pointer

We don't need that anymore as same pointer is passed to each
routine via struct dvb_frontend private field.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# bd01c766 25-Nov-2014 Antti Palosaari <crope@iki.fi>

[media] si2168: rename device state variable from 's' to 'dev'

'dev' is most common name in kernel for structure containing device
state instance, so rename it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 52791979 14-Nov-2014 CrazyCat <crazycat69@narod.ru>

[media] si2168: TS clock inversion control

TS clock polarity control implemented.

[Antti: Resolved simple conflict]

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 8e417224 25-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2168: avoid firmware loading if it has been loaded previously

Add a variable to keep track if firmware is loaded or not and skip parts of the
initialization if fw is already loaded. Resume from sleep with a different
command compared to initial power up and run command 85 after resume command.
This behaviour is observed when using manufacturer provided binary-only si2168
driver for TechnoTrend CT2-4400.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 389ce398 11-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2168: add ts_mode setting and move to si2168_init

Luis Alves submitted a TS mode patch to si2168 earlier, but the
patch was rejected due to a small issue. Here is a working version.
Also, setting of TS mode is moved from si2168_set_frontend to
si2168_init.

This patch adds the TS mode as a config option for the si2168 demod:
- ts_mode added to config struct.
- Possible (interesting) values are
* Parallel mode = 0x06
* Serial mode = 0x03

Currently the modules using this demod only use parallel mode.
Patches for these modules later in this patch series.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 635a90cf 17-Jul-2014 Luis Alves <ljalvs@gmail.com>

[media] si2168: Support Si2168-A20 firmware downloading

This adds support for the Si2168-A20 firmware download.

Extracting the firmware:

wget http://www.tbsdtv.com/download/document/tbs6281/tbs6281-t2-t-driver_v1.0.0.6.zip
unzip tbs6281-t2-t-driver_v1.0.0.6.zip
dd if=tbs-6281_x64/tbs6281_64.sys of=dvb-demod-si2168-a20-01.fw count=28656 bs=1 skip=1625088

md5sum:
32e06713b33915f674bfb2c209beaea5 /lib/firmware/dvb-demod-si2168-a20-01.fw

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c9cb0820 13-Jul-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2168: Add support for chip revision Si2168 A30

Add handling for different chip revisions and firmwares.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b02db9e1 13-Jul-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2168: Small typo fix (SI2157 -> SI2168)

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 0c76e68d 13-Jun-2014 Antti Palosaari <crope@iki.fi>

[media] si2168: firmware download fix

First 8 bytes belonging to firmware image were hard-coded and uploaded
by the driver mistakenly. Introduce new corrected firmware file and
remove those 8 bytes from the driver.

New firmware image could be extracted from the PCTV 292e driver CD
using following command:

$ dd if=/TVC 6.4.8/Driver/PCTV Empia/emOEM.sys ibs=1 skip=1089408 count=2728 of=dvb-demod-si2168-02.fw
$ md5sum dvb-demod-si2168-02.fw
d8da7ff67cd56cd8aa4e101aea45e052 dvb-demod-si2168-02.fw
$ sudo cp dvb-demod-si2168-02.fw /lib/firmware/

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 711615df 14-Apr-2014 Antti Palosaari <crope@iki.fi>

[media] si2168: add copyright and license

Add copyright and license for each file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 845f3505 10-Apr-2014 Antti Palosaari <crope@iki.fi>

[media] si2168: Silicon Labs Si2168 DVB-T/T2/C demod driver

Silicon Labs Si2168 DVB-T/T2/C demod driver.
That driver version supports only DVB-T.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>