summaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners/si2157.c
Commit message (Collapse)AuthorAgeFilesLines
* media: si2157: ensure wait_status is initializedSean Young2020-04-291-1/+4
| | | | | | | | | | 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>
* media: si2157: add on-demand rf strength funcBrad Love2020-04-211-1/+39
| | | | | | | | | | | 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>
* media: si2157: module debug option to wait on signal lockBrad Love2020-04-211-3/+43
| | | | | | | | | | 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>
* media: si2157: Briefly wait for tuning operation to completeBrad Love2020-04-211-0/+52
| | | | | | | | | | | | 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>
* media: si2157: Add analog tuning related functionsBrad Love2020-04-211-3/+228
| | | | | | | | | | | 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>
* media: si2157: Better check for running tuner in initBrad Love2020-04-211-8/+7
| | | | | | | | | | | 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>
* media: si2157: Check error status bit on cmd executeBrad Love2020-04-211-5/+11
| | | | | | | | | 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>
* media: si2157: Enable tuner status flagsBrad Love2020-04-211-0/+22
| | | | | | | | 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>
* media: si2157: Add option for not downloading firmware.Gon Solo2019-10-101-0/+6
| | | | | | | 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>
* media: si2157: add detection of si2177 tunerBrad Love2019-06-131-0/+6
| | | | | | | | | | 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>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner2019-05-301-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* media: si2157: declare its own padsMauro Carvalho Chehab2018-09-171-8/+9
| | | | | | | | | 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>
* media: v4l2: taint pads with the signal types for consumer devicesMauro Carvalho Chehab2018-09-171-1/+3
| | | | | | | | | | | | | | | | | | | 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>
* media: dvb: convert tuner_info frequencies to HzMauro Carvalho Chehab2018-08-021-3/+3
| | | | | | | | | | | | | | | | | | | 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>
* media: fix usage of whitespaces and on indentationMauro Carvalho Chehab2018-01-041-1/+1
| | | | | | | | | 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>
* [media] si2157: Add support for Si2141-A10Stefan Brüns2017-04-141-2/+21
| | | | | | | | | | | 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>
* [media] si2157: revert si2157: Si2141/2151 tuner supportAntti Palosaari2017-04-141-64/+6
| | | | | | | | | | | | | '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>
* [media] si2157: Si2141/2151 tuner supportEvgeny Plehov2017-03-031-6/+64
| | | | | | | Support for new tuner version. Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] si2157: do not allow driver unbindAntti Palosaari2016-07-081-1/+2
| | | | | | | | 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>
* [media] si2157: detect if firmware is runningAntti Palosaari2016-05-061-6/+13
| | | | | | | | | | 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>
* [media] si2157: register as a tuner entityMauro Carvalho Chehab2016-02-161-1/+31
| | | | | | | 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>
* [media] si2157: cancel_delayed_work_sync before device removal / kfreeErnst Martin Witte2016-02-011-0/+3
| | | | | | | | | 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>
* [media] si2157.c: fix frequency rangeAndrei Koshkosh2016-02-011-2/+2
| | | | | | | | | 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>
* [media] si2157: return -EINVAL if firmware blob is too bigLaura Abbott2015-11-191-0/+1
| | | | | | | | | | | | | | | 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>
* [media] si2157: Bounds check firmwareLaura Abbott2015-10-221-0/+4
| | | | | | | | | | | 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>
* [media] tuners: Drop owner assignment from i2c_driverKrzysztof Kozlowski2015-08-111-1/+0
| | | | | | | | 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>
* [media] si2157: implement signal strength statsAntti Palosaari2015-06-051-1/+39
| | | | | | | | 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>
* [media] si2157: support selection of IF interfaceOlli Salonen2015-05-121-1/+3
| | | | | | | | | | | | | | 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>
* [media] si2157: extend frequency range for ATSCOlli Salonen2015-04-011-1/+1
| | | | | | | | 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>
* [media] si2157: IF frequency for ATSC and QAMOlli Salonen2015-03-031-1/+22
| | | | | | | 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>
* [media] si2157: change firmware variable name and typeAntti Palosaari2015-01-291-8/+8
| | | | | | | | 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>
* [media] si2157: print chip versionAntti Palosaari2015-01-291-4/+7
| | | | | | | | 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>
* [media] si2157: print firmware versionAntti Palosaari2015-01-291-0/+11
| | | | | | | 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>
* [media] si2157: add own goto label for kfree() on probe errorAntti Palosaari2015-01-291-2/+4
| | | | | | | | 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>
* [media] si2157: trivial ID table changesAntti Palosaari2015-01-291-5/+5
| | | | | | | | - 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>
* [media] si2157: change firmware download error handlingAntti Palosaari2015-01-291-5/+4
| | | | | | | | | | 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>
* [media] si2157: carry pointer to client instead of state in tuner_privAntti Palosaari2015-01-291-40/+38
| | | | | | | | | 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>
* [media] si2157: simplify si2157_cmd_execute() error pathAntti Palosaari2015-01-291-6/+2
| | | | | | | | 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>
* [media] si2157: rename device state variable from 's' to 'dev'Antti Palosaari2015-01-291-60/+58
| | | | | | | | | '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>
* [media] si2157: One function call less in si2157_init() after errorMarkus Elfring2014-12-041-4/+4
| | | | | | | | | | 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>
* [media] tuners: remove uneeded checks before release_firmware()Markus Elfring2014-12-041-2/+1
| | | | | | | | | | 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>
* [media] si2157: Si2148 supportCrazyCat2014-11-251-4/+6
| | | | | | | | | | 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>
* [media] si2157: make checkpatch.pl happy (remove break after goto)Olli Salonen2014-11-251-1/+0
| | | | | | | | 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>
* [media] si2157: Add support for Si2146-A10Olli Salonen2014-11-251-7/+22
| | | | | | | | | | | | | | | 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>
* [media] si2157: add support for SYS_DVBC_ANNEX_BOlli Salonen2014-10-301-0/+3
| | | | | | | | | 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>
* [media] si2157: Add support for Si2147-A30 tunerOlli Salonen2014-09-231-2/+11
| | | | | | | | | | | 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>
* [media] si2157: avoid firmware loading if it has been loaded previouslyOlli Salonen2014-09-211-2/+9
| | | | | | | | | 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>
* [media] si2157: change command for sleepOlli Salonen2014-09-211-3/+4
| | | | | | | | | | | | | | | 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>
* [media] si2157: Add support for delivery system SYS_ATSCOlli Salonen2014-09-021-0/+3
| | | | | | | | | | | 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>
* [media] si2157: clean loggingOlli Salonen2014-09-021-27/+25
| | | | | | | | | | | | | | | 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>