History log of /linux-master/drivers/media/tuners/si2157.c
Revision Date Author Comments
# aaeb31c0 14-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

media: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


# 80b08e48 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

media: tuners/si2157: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 3ae87d2f 31-Mar-2022 Piotr Chmura <chmooreck@gmail.com>

media: si2157: unknown chip version Si2147-A30 ROM 0x50

Fix firmware file names assignment in si2157 tuner, allow for running
devices without firmware files needed.

modprobe gives error: unknown chip version Si2147-A30 ROM 0x50
Device initialization is interrupted.

Caused by:
1. table si2157_tuners has swapped fields rom_id and required vs struct
si2157_tuner_info.
2. both firmware file names can be null for devices with
required == false - device uses build-in firmware in this case

Tested on this device:
m07ca:1871 AVerMedia Technologies, Inc. TD310 DVB-T/T2/C dongle

[mchehab: fix mangled patch]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215726
Link: https://lore.kernel.org/lkml/5f660108-8812-383c-83e4-29ee0558d623@leemhuis.info/
Link: https://lore.kernel.org/linux-media/c4bcaff8-fbad-969e-ad47-e2c487ac02a1@gmail.com
Fixes: 1c35ba3bf972 ("media: si2157: use a different namespace for firmware")
Cc: stable@vger.kernel.org # 5.17.x
Signed-off-by: Piotr Chmura <chmooreck@gmail.com>
Tested-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 8d4ff818 06-Jan-2022 Robert Schlabbach <robert_s@gmx.net>

media: si2157: add support for DVB-C Annex C

DVB-C Annex C is mostly DVB-C Annex A with only minor differences, so
simply add it to the DVB-C Annex A switch case, so that tuning attempts
no longer result in -EINVAL.

Link: https://lore.kernel.org/linux-media/trinity-fd7dd9e4-c319-4761-89b6-555fa7b23776-1641509569422@3c-app-gmx-bap68
Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 9658105d 06-Jan-2022 Robert Schlabbach <robert_s@gmx.net>

media: si2157: fix bandwidth stored in dev

Make digital tuning store the bandwidth in Hz in the private dev struct,
rather than the hardware-specific bandwidth property code, so that the
get_bandwidth() function returns the bandwidth in Hz, just as it already
does when using analog tuning.

Link: https://lore.kernel.org/linux-media/trinity-931c0e68-88af-46cc-91a1-986754798a4f-1641509499366@3c-app-gmx-bap68
Reported-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 95c4cd1d 06-Jan-2022 Robert Schlabbach <robert_s@gmx.net>

media: si2157: fix 6MHz & 6.1MHz bandwidth setting

Commit 98c65a3dac95 ("media: si2157: add support for 1.7MHz and 6.1
MHz") introduced two bugs: The 6.1MHz setting was always used for any
bandwidth less than 7MHz due to missing "else" keywords, and then the
setting was not specified as decimal 10, but as hexadecimal 0x10, which
makes the tuner refuse the tune command. In sum, it is not possible to
tune to any channels of less than 7MHz bandwidth anymore.

Add the missing "else" keywords and convert all bandwidth settings to
decimal to avoid any future decimal vs. hexadecimal confusion.

Remove the use of the undefined bandwidth setting 0x0f for bandwidths
greater than 8MHz, which is also refused by the tune command, in favour
of using the default bandwidth setting 8 for any bandwidths greater than
7MHz.

Link: https://lore.kernel.org/linux-media/trinity-d0015ea1-1da5-4c7d-a75b-781fb26dc339-1641509387112@3c-app-gmx-bap68
Fixes: 98c65a3dac95 ("media: si2157: add support for 1.7MHz and 6.1 MHz")
Reported-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# b9aafbd4 10-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: add ATV support for si2158

This device also supports ATV, as it has the same API for
setting analog TV tuning parameters.

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


# 98c65a3d 10-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: add support for 1.7MHz and 6.1 MHz

Some tuners allow setting the bandwidth filter to 1.7MHz and
6.1 MHz. Add support for it upstream, as the narrower is the
bandwidth filter, the better.

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


# 6446a22a 10-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: add support for ISDB-T and DTMB

Those two delivery systems are supported by some of the si2146
tuners, but the current code is missing the setup for those.

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


# 805d5a08 10-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: get rid of chiptype data

The driver should be capable of autodetecting its type, so no
need to pass it via device driver's data.

While here, improve documentation of some of the part_id
specific code.

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


# 1c35ba3b 09-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: use a different namespace for firmware

Each chip at the si21xx TER family seems to have a different firmware,
with seems to actually be a patch against the ROM code.

Rework the code in order to use different firmware files depending
on the chip ID and rom ID.

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


# 7c2d8ee4 08-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: rework the firmware load logic

Loading a firmware file should not be mandatory, as devices
could work with an eeprom firmware, if available.

Yet, using the eeprom firmware could lead into unpredictable
results, so the best is to warn about that.

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


# 48dde945 01-Dec-2021 Robert Schlabbach <robert_s@gmx.net>

media: si2157: Add optional firmware download

The Si2157 (A30) is functional with the ROM firmware 3.0.5, but can also
be patched at runtime, e.g. to firmware 3.1.3. However, although a
firmware filename for its firmware patch exists, that has only been used
for the Si2177 (A30) so far (which indeed takes the binary identical
firmware patch).

Add support for downloading firmware patches into the Si2157 (A30), but
make it optional, so that initialization can succeed with and without a
firmware patch being available. Keep the use of request_firmware() for
this purpose rather than firmware_request_nowarn(), so that the warning
in the log makes users aware that it is possible to provide a firmware
for this tuner.

The firmware patch is probably also optional for other (if not all)
tuners supported by the driver, but since I do not have the others
available to test, they are kept mandatory for now to avoid regressions.

Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 2ae5d7e5 08-Dec-2021 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: si2157: move firmware load to a separate function

Split the firmware load code from si2157_init, in order to
help to add further changes at the way firmware is handled on
this device.

No functional changes.

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


# a6441ea2 01-Dec-2021 Robert Schlabbach <robert_s@gmx.net>

media: si2157: Fix "warm" tuner state detection

Commit e955f959ac52 ("media: si2157: Better check for running tuner in
init") completely broke the "warm" tuner detection of the si2157 driver
due to a simple endian error: The Si2157 CRYSTAL_TRIM property code is
0x0402 and needs to be transmitted LSB first. However, it was inserted
MSB first, causing the warm detection to always fail and spam the kernel
log with tuner initialization messages each time the DVB frontend
device was closed and reopened:

[ 312.215682] si2157 16-0060: found a 'Silicon Labs Si2157-A30'
[ 312.264334] si2157 16-0060: firmware version: 3.0.5
[ 342.248593] si2157 16-0060: found a 'Silicon Labs Si2157-A30'
[ 342.295743] si2157 16-0060: firmware version: 3.0.5
[ 372.328574] si2157 16-0060: found a 'Silicon Labs Si2157-A30'
[ 372.385035] si2157 16-0060: firmware version: 3.0.5

Also, the reinitializations were observed disturb _other_ tuners on
multi-tuner cards such as the Hauppauge WinTV-QuadHD, leading to missed
or errored packets when one of the other DVB frontend devices on that
card was opened.

Fix the order of the property code bytes to make the warm detection work
again, also reducing the tuner initialization message in the kernel log
to once per power-on, as well as fixing the interference with other
tuners.

Link: https://lore.kernel.org/linux-media/trinity-2a86eb9d-6264-4387-95e1-ba7b79a4050f-1638392923493@3c-app-gmx-bap03

Fixes: e955f959ac52 ("media: si2157: Better check for running tuner in init")
Reported-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# b7ba9f34 22-Apr-2020 Sean Young <sean@mess.org>

media: si2157: ensure wait_status is initialized

smatch reports wait_status is uninitialized, because smatch cannot assume
the loop body is ever executed.

Clarify the code so that wait_status is retrieved at least once.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# d99846cb 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: add on-demand rf strength func

Add get_rf_strength callback to get RSSI from the tuner. DVBv5
stat cache is updated. get_rf_strength is called by tuner_core
for analog tuners and is also used by some bridge drivers to
obtain RSSI directly from the tuner.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# e4361015 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: module debug option to wait on signal lock

In some debugging cases it is useful to know how long it took
signal lock to happen after tuning. This can help diagnose
line issues.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 578147e9 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: Briefly wait for tuning operation to complete

To detect errors in the tuning operation, this waits up 40ms for operation
completion status. This allows for error detection and prevents issuing
additional commands to the tuner before it is finished.

Tuning typically completes in 20-30ms.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 7e80a8d1 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: Add analog tuning related functions

Include set_analog_params, get_frequency, and get_bandwidth.

Tested with NTSC and PAL standards via ch3/4 generator. Other standards
are included, but are untested due to lack of generator.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# e955f959 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: Better check for running tuner in init

Getting the Xtal trim property to check if running is less error prone.
Reset if_frequency if state is unknown.

Replaces the previous "garbage check".

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 5741f4af 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: Check error status bit on cmd execute

Check error status bit on command execute, if error bit is
set return -EAGAIN. Ignore -EAGAIN in probe during device check.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 5714e84f 14-Nov-2019 Brad Love <brad@nextdimension.cc>

media: si2157: Enable tuner status flags

Enable flags to get status of commands sent to the tuner.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 57df5373 10-Oct-2019 Gon Solo <gonsolo@gmail.com>

media: si2157: Add option for not downloading firmware.

While at it, convert to kernel-doc format and use bits instead of bools.

Signed-off-by: Gon Solo <gonsolo@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# d5cb82b0 19-Dec-2018 Brad Love <brad@nextdimension.cc>

media: si2157: add detection of si2177 tuner

Works in ATSC and QAM as is, DVB is completely untested.

Firmware required.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Reviewed-by: Sean Young <sean@mess.org>
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>


# 552b926f 01-Aug-2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: si2157: declare its own pads

As we don't need anymore to share pad numbers with similar
drivers, use its own pad definition instead of a global
model.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


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

media: v4l2: taint pads with the signal types for consumer devices

Consumer devices are provided with a wide different range of types
supported by the same driver, allowing different configutations.

In order to make easier to setup media controller links, "taint"
pads with the signal type it carries.

While here, get rid of DEMOD_PAD_VBI_OUT, as the signal it carries
is actually the same as the normal video output.

The difference happens at the video/VBI interface:
- for VBI, only the hidden lines are streamed;
- for video, the stream is usually cropped to hide the
vbi lines.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


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

media: dvb: convert tuner_info frequencies to Hz

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

However, the main problem is that universal tuners 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 tuners.

So, convert everything to specify tuner frequencies in Hz.

Plese notice that a similar patch is also needed for frontends.

Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Michael Büsch <m@bues.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 4a3fad70 04-Jan-2018 Mauro Carvalho Chehab <mchehab@kernel.org>

media: fix usage of whitespaces and on indentation

On several places, whitespaces are being used for indentation,
or even at the end of the line.

Fix them.

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


# 3a2824c7 16-Feb-2017 Stefan Brüns <stefan.bruens@rwth-aachen.de>

[media] si2157: Add support for Si2141-A10

The Si2141 needs two distinct commands for powerup/reset, otherwise it
will not respond to chip revision requests. It also needs a firmware
to run properly.

Cc: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 297e14d5 06-Apr-2017 Antti Palosaari <crope@iki.fi>

[media] si2157: revert si2157: Si2141/2151 tuner support

'Reset' loop does not look correct. I tested it very many times and
it never repeated those commands. If problem, it tries to solve,
really occurs on some situations better solution should be find out.

There is another patch which does not have such hackish looking loop.
Lets change to it.

Cc: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 690d55de 07-Feb-2017 Evgeny Plehov <EvgenyPlehov@ukr.net>

[media] si2157: Si2141/2151 tuner support

Support for new tuner version.

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


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

[media] si2157: do not allow driver unbind

Disable runtime unbind as driver does not support it.

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


# 78bab930 08-Feb-2016 Antti Palosaari <crope@iki.fi>

[media] si2157: detect if firmware is running

Detect if firmware is running run-time and download / start it only
when needed. Detection is done by reading IF frequency value.
Garbage value is returned by firmware when it is not running,
otherwise correct value is returned.

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


# 8b0a81c7 11-Feb-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] si2157: register as a tuner entity

As this tuner doesn't use the usual subdev interface, we need
to register it manually.

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


# 01d1d714 09-Jan-2016 Ernst Martin Witte <emw-linux-kernel@nocabal.de>

[media] si2157: cancel_delayed_work_sync before device removal / kfree

si2157_remove was calling kfree(dev) with possibly still active
schedule_delayed_work(dev->stat_work). This caused kernel panics in
call_timer_fn e.g. after rmmod cx23885.

Signed-off-by: Ernst Martin Witte <emw-linux-kernel@nocabal.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 9398ddfe 03-Jan-2016 Andrei Koshkosh <andreykoshkosh@gmail.com>

[media] si2157.c: fix frequency range

According with:
https://www.silabs.com/Support%20Documents/TechnicalDocs/Si2157-short.pdf

The RF input frequency range of this demod is from 42MHz to 870 MHz.

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


# d2cc2f0b 05-Oct-2015 Laura Abbott <labbott@fedoraproject.org>

[media] si2157: return -EINVAL if firmware blob is too big

A previous patch added a check if the firmware is too big, but it didn't
set the return error code with the right value.

[mchehab@osg.samsung.com: I ended by applying a v1 of Laura's patch, without
the proper return code. This patch contains the difference between v2 and v1 of
the Laura's "si2157: Bounds check firmware" patch]
Cc: stable@kernel.org
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>

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


# a828d72d 29-Sep-2015 Laura Abbott <labbott@fedoraproject.org>

[media] si2157: Bounds check firmware

When reading the firmware and sending commands, the length
must be bounds checked to avoid overrunning the size of the command
buffer and smashing the stack if the firmware is not in the
expected format. Add the proper check.

Cc: stable@kernel.org
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 8972943c 10-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

[media] tuners: Drop owner assignment from i2c_driver

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

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


# 2f1ea29f 07-Sep-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: implement signal strength stats

Implement DVBv5 signal strength stats. Returns dBm.

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


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

[media] si2157: support selection of IF interface

The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

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>


# 18acc6ac 03-Mar-2015 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: extend frequency range for ATSC

The Si2157 tuner supports ATSC in addition to DVB-T and DVB-C. Extend
minimum frequency range to cover the complete ATSC/QAM-B range.

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


# c28aebe1 27-Feb-2015 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: IF frequency for ATSC and QAM

For supporting ATSC and QAM modes the driver should use a smaller IF frequency than 5 MHz.

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


# 08272db6 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: change firmware variable name and type

Rename firmware variable from fw_file to fw_name and change its
type from u8 to const char as request_firmware() input is.

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


# 6c372533 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: print chip version

Print chip version once using log level into when init() is called.
Remove cold/warm state printing as those are not very useful.

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


# c7011845 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: print firmware version

Firmware version could be printed similarly than si2168 driver does.

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


# e7f3f9f3 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: add own goto label for kfree() on probe error

Use own goto label for error case mem free is needed, even kfree could
be called with NULL. I think it is better to have it, even not required.

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


# c1292233 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: trivial ID table changes

- Rename ID table.
- Remove magic numbers from ID table driver data field.

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


# 78dab40a 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: change firmware download error handling

Rename firmare download error path goto label. Remove firmware NULL
set as NULL value is not needed anymore, due to recent change which
started using goto labels for firmware error handling.

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


# 8fe51725 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: carry pointer to client instead of state in tuner_priv

Carry struct i2c_client pointer in tuner_priv. This driver is I2C driver,
which is represented as a struct i2c_client, so better to carry this top
level structure for each routine in order to unify things.

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


# 7cbf5d76 06-Dec-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: simplify si2157_cmd_execute() error path

Remove if () from firmware command error path as there should not be
any error prone conditional logic there. Use goto labels instead.

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


# 70f13ff0 05-Dec-2014 Antti Palosaari <crope@iki.fi>

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

'dev' is likely most common name in kernel for structure containing
device state instance, so rename it in order to keep things
consistent.

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


# e358c8a6 30-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

[media] si2157: One function call less in si2157_init() after error

The release_firmware() function was called in some cases by the si2157_init()
function during error handling even if the passed variable contained still
a null pointer. This implementation detail could be improved
by the introduction of another jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# dc89cfcf 30-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

[media] tuners: remove uneeded checks before release_firmware()

The release_firmware() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


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

[media] si2157: Si2148 support

Si2148-A20 silicon tuner support.

[Antti: Resolved conflict]

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


# b7fca5b0 23-Nov-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: make checkpatch.pl happy (remove break after goto)

Break after goto is unnecessary.

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>


# 073f3849 23-Nov-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: Add support for Si2146-A10

The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157,
but there a few exceptions. The powerup command seems to be quite a bit
different. In addition there's a property 0207 that requires a different value.
Thus another entry is created in the si2157_id table to support also si2146 in
this driver.

The datasheet is available on manufacturer's website:
http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf

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>


# 0d1165fc 30-Oct-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: add support for SYS_DVBC_ANNEX_B

Set the property for delivery system also in case of SYS_DVBC_ANNEX_B.
This behaviour is observed in the sniffs taken with Hauppauge HVR-955Q
Windows driver.

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


# d87a5058 11-Sep-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: Add support for Si2147-A30 tuner

This patch adds support for Si2147-A30 tuner. Fairly trivial, no firmware needed for this tuner. However, command 14 00 02 07 01 00 seems to be mandatory. On Si2157 and Si2158 the value 0x0100 is the default value, so this patch does not impact the existing tuners/devices. On Si2147 the default is 0x0000 and I can't get a lock with that value.

While here, fix the return length of the previous set command to 4 bytes.

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


# 4cbf6ed9 25-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

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

Add a variable into state to keep track if firmware has been loaded or not.
Skip firmware loading in case it is already loaded (resume from sleep).

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>


# 0e38233d 25-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: change command for sleep

Instead of sending command 13 to the tuner, send command 16 when sleeping. This
behaviour is observed when using manufacturer provided binary-only Linux driver
for TechnoTrend CT2-4400 (Windows driver does not do power management).

The issue with command 13 is that firmware loading is necessary after that.
This is not an issue with tuners that do not require firmware, but starting
streaming after sleep on an Si2158 takes noticeable time as firmware is
loaded on resume.

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>


# 5cd62db7 16-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: Add support for delivery system SYS_ATSC

Set the property for delivery system also in case of SYS_ATSC. This
behaviour is observed in the sniffs taken with Hauppauge HVR-955Q
Windows driver.

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>


# 67d0113a 05-Aug-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: clean logging

Same thing for si2157 as Antti did earlier for tda18212:

There is no need to print module name nor function name as those
are done by kernel logging system when dev_xxx logging is used and
driver is proper I2C driver.

While here, fix a typo ("unknown") in si2157_init.

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>


# 1140540d 15-Jul-2014 Matthias Schwarzott <zzam@gentoo.org>

[media] si2157: Add get_if_frequency callback

This is needed for PCTV 522e support.

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


# 05024efe 15-Jul-2014 Matthias Schwarzott <zzam@gentoo.org>

[media] si2157: Add support for spectral inversion

This is needed for PCTV 522e support.

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


# 6cc8a35d 17-Jul-2014 Olli Salonen <olli.salonen@iki.fi>

[media] si2157: Use name si2157_ops instead of si2157_tuner_ops

The struct prototype is defined at the beginning of the code as
"si2157_ops" but the real struct is called "si2157_tuner_ops".

This is causing the name to be empty on this info msg: si2157 16-0060:
si2157: found a '' in cold state

[crope@iki.fi: commit msg from Luis email reply]
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Cc: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>

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


# 7d6bc608 13-Jul-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: rework firmware download logic a little bit

Rework firmware selection / chip detection logic a little bit.
Add missing release_firmware() to error path.

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


# bac53a2c 13-Jul-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: advertise Si2158 A20 firmware

Driver uses that firmware. Add it module firmware list.

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


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

[media] si2157: Set delivery system and bandwidth before tuning

Tell used TV standard and bandwidth for tuner firmware.

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>


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

[media] si2157: Add support for Si2158 chip

Add support for Si2158 A20 chip.

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>


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

[media] si2157: Move chip initialization to si2157_init

Move chip initialization related code from si2157_set_params to
si2157_init.

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>


# e6b4380f 10-Jul-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: add read data support for fw cmd func

We want also read data from firmware. Add support for it. Copied from
si2168 driver.

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


# a83d7d17 09-Jul-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: implement sleep

Implement sleep for power-management.

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


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

[media] si2157: add one missing parenthesis

Fix following warnings:
si2157_cmd_execute() warn: add some parenthesis here?
si2157_cmd_execute() warn: maybe use && instead of &

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


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

[media] si2157: 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>


# ae4c8919 11-Apr-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: extend frequency range for DVB-C

DVB-C uses lower frequencies than DVB-T. Extend frequency range down to
110 MHz in order to support DVB-C. 110 - 862 MHz range is defined by
NorDig Unified 2.2 specification.

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


# 930a8730 10-Apr-2014 Antti Palosaari <crope@iki.fi>

[media] si2157: Silicon Labs Si2157 silicon tuner driver

Silicon Labs Si2157 silicon tuner driver.
Currently it supports only DVB-T.

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