aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/si2168.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-08-11[media] dvb-frontends: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-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>
2015-06-09[media] dvb: Get rid of typedev usage for enumsMauro Carvalho Chehab1-1/+1
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/*
2015-06-05[media] si2168: Implement own I2C adapter lockingAntti Palosaari1-56/+79
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>
2015-05-12[media] si2168: add I2C error handlingOlli Salonen1-0/+6
Return error from si2168_cmd_execute in case the demodulator returns an error. 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-05-12[media] si2168: add support for gapped clockOlli Salonen1-0/+3
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>
2015-02-03[media] si2168: add support for 1.7MHz bandwidthOlli Salonen1-1/+3
This patch is based on Antti's silabs branch. Add support for 1.7 MHz bandwidth. Supported in all versions of Si2168 according to short data sheets. [mchehab@osg.samsung.com: Fix CodingStyle] Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] si2168: return error if set_frontend is called with invalid parametersOlli Salonen1-1/+4
This patch should is based on Antti's silabs branch. According to dvb-frontend.h set_frontend may be called with bandwidth_hz set to 0 if automatic bandwidth is required. Si2168 does not support automatic bandwidth and does not declare FE_CAN_BANDWIDTH_AUTO in caps. This patch will change the behaviour in a way that EINVAL is returned if bandwidth_hz is 0. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: change firmware variable name and typeAntti Palosaari1-9/+9
Rename firmware variable from fw_file to fw_name and change its type from u8 to const char as request_firmware() input defines. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: print chip versionAntti Palosaari1-8/+4
Print chip version once using log level into when init() is called. Remove cold/warm state printing as those are not very useful. old printing: si2168 6-0064: found a 'Silicon Labs Si2168' in cold state si2168 6-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw' si2168 6-0064: firmware version: 4.0.11 si2168 6-0064: found a 'Silicon Labs Si2168' in warm state new printing: si2168 6-0064: found a 'Silicon Labs Si2168-B40' si2168 6-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw' si2168 6-0064: firmware version: 4.0.11 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: remove unneeded fw variable initializationAntti Palosaari1-2/+1
commit 034e1ec0ce299b9e90056793dcb3187e7add6b62 si2168: One function call less in si2168_init() after error detection That commit added goto label for error path to release firmware, but forgets to remove variable NULL set. Remove those now. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: enhance firmware download routineAntti Palosaari1-19/+15
All known old firmware firmware formats are downloaded using 8 byte chunks. Reject firmware if it could not be divided to 8 byte chunks and because of that we could simplify some calculations. Now both supported firmware download routines are rather similar. 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] si2168: add own goto label for kzalloc failureAntti Palosaari1-1/+2
Use own label for kzalloc failure in which does not call kfree(). kfree() could be called with NULL, but it is still better to have own label which skips unnecessary kfree(). Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: change stream id debug log formatterAntti Palosaari1-4/+4
Change formatter from signed to unsigned as stream_id is 32bit unsigned variable. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: change firmware version print from debug to infoAntti Palosaari1-1/+1
Even firmware version is not needed to know, it is still interesting and useful to know some cases. Due to that increase its printing to info log level. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: rename few thingsAntti Palosaari1-26/+12
Rename some goto labels and more. No functionality changes. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: simplify si2168_cmd_execute() error pathAntti Palosaari1-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>
2015-01-29[media] si2168: get rid of own struct i2c_client pointerAntti Palosaari1-31/+30
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>
2015-01-29[media] si2168: carry pointer to client instead of stateAntti Palosaari1-38/+45
Carry struct i2c_client pointer inside struct dvb_frontend private pointer. 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. This allows further simplification. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29[media] si2168: rename device state variable from 's' to 'dev'Antti Palosaari1-101/+101
'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>
2015-01-29[media] si2168: define symbol rate limitsAntti Palosaari1-0/+2
w_scan complains about missing symbol rate limits: This dvb driver is *buggy*: the symbol rate limits are undefined - please report to linuxtv.org Chip supports 1 to 7.2 MSymbol/s on DVB-C. Cc: stable@vger.kernel.org Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-26[media] Si2168: increase timeout to fix firmware loadingJurgen Kramer1-1/+1
Increase si2168 cmd execute timeout to prevent firmware load failures. Tests shows it takes up to 52ms to load the 'dvb-demod-si2168-a30-01.fw' firmware. Increase timeout to a safe value of 70ms. Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04[media] si2168: add support for firmware files in new formatOlli Salonen1-14/+32
This patch adds support for new type of firmware versions of Si2168 chip. Old type: n x 8 bytes (all data, first byte seems to be 04 or 05) New type: n x 17 bytes (1 byte indicates len and max 16 bytes data) New version of TechnoTrend CT2-4400 drivers (http://www.tt-downloads.de/bda-treiber_4.3.0.0.zip) contains newer firmware for Si2168-B40 that is in the new format. It can be extracted with the following command: dd if=ttTVStick4400_64.sys ibs=1 skip=323872 count=6919 of=dvb-demod-si2168-b40-01.fw Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04[media] si2168: debug printout for firmware versionOlli Salonen1-0/+11
A debug printout for firmware version. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25[media] si2168: One function call less in si2168_init() after error detectionMarkus Elfring1-4/+5
GIT_AUTHOR_DATE=1416472767 The release_firmware() function was called in some cases by the si2168_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-11-25[media] DVB-frontends: Deletion of unnecessary checks before the function call "release_firmware"Markus Elfring1-2/+1
GIT_AUTHOR_DATE=1416472432 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] si2168: TS clock inversion controlCrazyCat1-2/+5
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>
2014-11-04[media] si2168: do not print device is warm every-time when openedAntti Palosaari1-2/+1
It repeated "found a 'Silicon Labs Si2168' in warm state" everytime when device was opened. Message is aimed to point out firmware is downloaded, up and running. So print it only in case firmware download is performed. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26[media] si2168: add FE_CAN_MULTISTREAM into capsOlli Salonen1-1/+2
PLP selection was implemented for Si2168 last month (patchwork 25387). However, FE_CAN_MULTISTREAM was not added to dvb_frontend_ops of si2168. This patch adds FE_CAN_MULTISTREAM, which indicates that multiple PLP are supported. 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] si2168: avoid firmware loading if it has been loaded previouslyOlli Salonen1-3/+28
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>
2014-09-02[media] si2168: DVB-T2 PLP selection implementedCrazyCat1-2/+14
DVB-T2 PLP selection implemented for Si2168 demod. Tested with PCTV 292e. Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net> 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] si2168: add ts_mode setting and move to si2168_initOlli Salonen1-7/+10
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>
2014-09-02[media] si2168: clean loggingOlli Salonen1-37/+33
Same thing for si2168 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. 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-22[media] si2168: Fix a badly solved merge conflictMauro Carvalho Chehab1-14/+0
changeset a733291d6934 didn't merge the fixes well. It ended by restoring some bad logic removed there. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22Merge commit '67dd8f35c2d8ed80f26c9654b474cffc11c6674d' into patchworkMauro Carvalho Chehab1-1/+1
* .: (268 commits) Linux 3.16-rc6 um: segv: Save regs only in case of a kernel mode fault um: Fix hung task in fix_range_common() um: Ensure that a stub page cannot get unmapped Revert "um: Fix wait_stub_done() error handling" btrfs: test for valid bdev before kobj removal in btrfs_rm_device Btrfs: fix abnormal long waiting in fsync random: check for increase of entropy_count because of signed conversion ARM: EXYNOS: Fix core ID used by platsmp and hotplug code ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode) ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi ARM: at91/dt: fix usb0 clocks definition in sam9n12 dtsi ARM: at91: at91sam9x5: correct typo error for ohci clock irqchip: gic: Fix core ID calculation when topology is read from DT GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes GFS2: memcontrol: Spelling s/invlidate/invalidate/ GFS2: Allow caching of glocks for flock GFS2: Allow flocks to use normal glock dq rather than dq_wait GFS2: replace count*size kzalloc by kcalloc GFS2: Use GFP_NOFS when allocating glocks ... Conflicts: drivers/media/dvb-frontends/si2168.c drivers/media/dvb-frontends/si2168_priv.h drivers/media/tuners/si2157.c
2014-07-21[media] si2168: Support Si2168-A20 firmware downloadingLuis Alves1-0/+5
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>
2014-07-21[media] si2168: Remove testing for demod presence on probeLuis Alves1-8/+0
Testing demod presence on probe fails if the demod was sleep mode. 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>
2014-07-21[media] si2168: Fix i2c_add_mux_adapter return valueLuis Alves1-1/+3
In case of failure the return value was always 0. Return proper error code (ENODEV) instead. 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>
2014-07-21[media] si2168: improve scanning performanceOlli Salonen1-0/+7
Improve scanning performance by setting property 0301 with a value from Windows driver. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21[media] si2168: Set symbol rate for DVB-CLuis Alves1-0/+12
This patch adds symbol rate setting to the driver. 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>
2014-07-14[media] si2168: few firmware download changesAntti Palosaari1-14/+27
Rework firmware selection logic a little bit. Print notice asking user update firmware when old Si2168 B40 firmware is used. 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] si2168: advertise Si2168 A30 firmwareAntti Palosaari1-0/+1
Driver uses that new firmware too, so advertise it. 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] si2168: Add support for chip revision Si2168 A30Olli Salonen1-5/+29
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>
2014-07-14[media] si2168: receive 4 bytes reply from cmd 0x14Antti Palosaari1-9/+9
Command 0x14 returns 4 bytes as a reply. It is used for setting key/value pairs to firmware and it returns 4 bytes back including old value. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: do not set values which are already on defaultAntti Palosaari1-98/+0
No need to set explicitly value that are already defaulted same. Setting new value returns old value. Firmware default values can be found just looking returned value. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: remove duplicate commandAntti Palosaari1-8/+1
Same command was executed twice, but different value. Remove redundant command. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: implement CNR statisticAntti Palosaari1-0/+9
Implement CNR statistic. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: set cmd args using memcpyAntti Palosaari1-31/+8
Use memcpy for set cmd buffer in order to keep style in line with rest of file. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: implement sleepAntti Palosaari1-7/+12
Implement sleep for power-management. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19[media] si2168: firmware download fixAntti Palosaari1-14/+0
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>
2014-06-19[media] si2168: add one missing parenthesisAntti Palosaari1-1/+1
Fix following warnings: si2168_cmd_execute() warn: add some parenthesis here? si2168_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>