summaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners/si2157.c
AgeCommit message (Collapse)Author
2016-05-06[media] si2157: detect if firmware is runningAntti Palosaari
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>
2016-02-16[media] si2157: register as a tuner entityMauro Carvalho Chehab
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>
2016-02-01[media] si2157: cancel_delayed_work_sync before device removal / kfreeErnst Martin Witte
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>
2016-02-01[media] si2157.c: fix frequency rangeAndrei Koshkosh
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>
2015-11-19[media] si2157: return -EINVAL if firmware blob is too bigLaura Abbott
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>
2015-10-22[media] si2157: Bounds check firmwareLaura Abbott
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>
2015-08-11[media] tuners: Drop owner assignment from i2c_driverKrzysztof Kozlowski
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>
2015-06-05[media] si2157: implement signal strength statsAntti Palosaari
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>
2015-05-12[media] si2157: support selection of IF interfaceOlli Salonen
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>
2015-04-01[media] si2157: extend frequency range for ATSCOlli Salonen
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>
2015-03-03[media] si2157: IF frequency for ATSC and QAMOlli Salonen
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>
2015-01-29[media] si2157: change firmware variable name and typeAntti Palosaari
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>
2015-01-29[media] si2157: print chip versionAntti Palosaari
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>
2015-01-29[media] si2157: print firmware versionAntti Palosaari
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>
2015-01-29[media] si2157: add own goto label for kfree() on probe errorAntti Palosaari
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>
2015-01-29[media] si2157: trivial ID table changesAntti Palosaari
- 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>
2015-01-29[media] si2157: change firmware download error handlingAntti Palosaari
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>
2015-01-29[media] si2157: carry pointer to client instead of state in tuner_privAntti Palosaari
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>
2015-01-29[media] si2157: simplify si2157_cmd_execute() error pathAntti Palosaari
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>
2015-01-29[media] si2157: rename device state variable from 's' to 'dev'Antti Palosaari
'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>
2014-12-04[media] si2157: One function call less in si2157_init() after errorMarkus Elfring
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>
2014-12-04[media] tuners: remove uneeded checks before release_firmware()Markus Elfring
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>
2014-11-25[media] si2157: Si2148 supportCrazyCat
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>
2014-11-25[media] si2157: make checkpatch.pl happy (remove break after goto)Olli Salonen
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>
2014-11-25[media] si2157: Add support for Si2146-A10Olli Salonen
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>
2014-10-30[media] si2157: add support for SYS_DVBC_ANNEX_BOlli Salonen
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>
2014-09-23[media] si2157: Add support for Si2147-A30 tunerOlli Salonen
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>
2014-09-21[media] si2157: avoid firmware loading if it has been loaded previouslyOlli Salonen
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>
2014-09-21[media] si2157: change command for sleepOlli Salonen
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>
2014-09-02[media] si2157: Add support for delivery system SYS_ATSCOlli Salonen
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>
2014-09-02[media] si2157: clean loggingOlli Salonen
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>
2014-07-21[media] si2157: Add get_if_frequency callbackMatthias Schwarzott
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>
2014-07-21[media] si2157: Add support for spectral inversionMatthias Schwarzott
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>
2014-07-21[media] si2157: Use name si2157_ops instead of si2157_tuner_opsOlli Salonen
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>
2014-07-14[media] si2157: rework firmware download logic a little bitAntti Palosaari
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>
2014-07-14[media] si2157: advertise Si2158 A20 firmwareAntti Palosaari
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>
2014-07-14[media] si2157: Set delivery system and bandwidth before tuningOlli Salonen
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>
2014-07-14[media] si2157: Add support for Si2158 chipOlli Salonen
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>
2014-07-14[media] si2157: Move chip initialization to si2157_initOlli Salonen
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>
2014-07-14[media] si2157: add read data support for fw cmd funcAntti Palosaari
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>
2014-07-14[media] si2157: implement sleepAntti Palosaari
Implement sleep for power-management. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23[media] si2157: add copyright and licenseAntti Palosaari
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>
2014-04-23[media] si2157: extend frequency range for DVB-CAntti Palosaari
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>
2014-04-23[media] si2157: Silicon Labs Si2157 silicon tuner driverAntti Palosaari
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>