aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
AgeCommit message (Collapse)Author
2016-08-04drivers/media/dvb-frontends/cxd2841er.c: avoid misleading gcc warningArnd Bergmann
The addition of jump label support in dynamic_debug caused an unexpected warning in exactly one file in the kernel: drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_tune_tc': include/linux/dynamic_debug.h:134:3: error: 'carrier_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cxd2841er.c:3177:11: note: 'carrier_offset' was declared here int ret, carrier_offset; ^~~~~~~~~~~~~~ The problem seems to be that the compiler gets confused by the extra conditionals in static_branch_unlikely, to the point where it can no longer keep track of which branches have already been taken, and it doesn't realize that this variable is now always initialized when it gets used. I have done lots of randconfig kernel builds and could not find any other file with this behavior, so I assume it's a rare enough glitch that we don't need to change the jump label support but instead just work around the warning in the driver. To achieve that, I'm moving the check for the return value into the switch() statement, which is an obvious transformation, but is enough to un-confuse the compiler here. The resulting code is not as nice to read, but at least we retain the behavior of warning if it gets changed to actually access an uninitialized carrier offset value in the future. Link: http://lkml.kernel.org/r/20160713204342.1221511-1-arnd@arndb.de Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Abylay Ospan <aospan@netup.ru> Cc: Sergey Kozlov <serjk@netup.ru> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Jason Baron <jbaron@akamai.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-07-16[media] cxd2841er: Reading SNR for DVB-C addedAbylay Ospan
Now driver returns correct values for DVB-C: SNR (in dB) [mchehab@s-opensource.com: fix a new function to be static] Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: Reading BER and UCB for DVB-C addedAbylay Ospan
now driver returns correct values for DVB-C: BER (post_bit_count and post_bit_error values) UCB (count of uncorrected errors) also, some code cleanup was done - checkpatch.pl now is happy Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: fix switch-case for DVB-CAbylay Ospan
DVB-C should use cxd2841er_read_agc_gain_c() to get the gain. The same function is used for all DVB-C annex delivery systems. Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: fix signal strength scale for ISDB-TMauro Carvalho Chehab
The scale for ISDB-T was wrong too: it was inverted, and on a relative scale. Use a linear interpolation to make it look better. The formula was empirically determined, using 3 frequencies (175 MHz, 410 MHz and 800 MHz), measuring from -50dBm to -12dBm in steps of 0.5dB. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: adjust the dB scale for DVB-CMauro Carvalho Chehab
Instead of using a relative frequency range, calibrate it to show the results in dB. The callibration was done getting samples with a signal generated from -50dBm to -12dBm, incremented in steps of 0.5 dB, using 3 frequencies: 175 MHz, 410 MHz and 800 MHz. The modulated signal was using QAM64, and it was used a linear interpolation of all the results. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: provide signal strength for DVB-CMauro Carvalho Chehab
Currently, there's no stats for DVB-C. Let's at least return signal strength. The scale is different than on DVB-T, so let's use a relative scale, for now. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-16[media] cxd2841er: fix BER report via DVBv5 stats APIMauro Carvalho Chehab
What userspace expects is to receive both bit_error and bit_count counters. So, instead of doing the division at the Kernel, return the counters for userspace to handle it the way it wants. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-15[media] mb86a20s: apply mask to val after checking for read failureColin Ian King
Appling the mask 0x0f to the immediate return of the call to mb86a20s_readreg will always result in a positive value, meaning that the check of ret < 0 will never work. Instead, check for a -ve return value first, and then mask val with 0x0f. Kudos to Mauro Carvalho Chehab for spotting the mistake in my original fix. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-13[media] ascot2e: Fix I2C message size checkSaso Slavicic
Tuning a card with Sony ASCOT2E produces the following error: kernel: i2c i2c-9: wr reg=0006: len=11 is too big! MAX_WRITE_REGSIZE is defined as 10, buf[MAX_WRITE_REGSIZE + 1] buffer is used in ascot2e_write_regs(). The problem is that exactly 10 bytes are written in ascot2e_set_params(): /* Set BW_OFFSET (0x0F) value from parameter table */ data[9] = ascot2e_sett[tv_system].bw_offset; ascot2e_write_regs(priv, 0x06, data, 10); The test in write_regs is as follows: if (len + 1 >= sizeof(buf)) 10 + 1 = 11 and that would be exactly the size of buf. Since 10 bytes + buf[0] = reg would seem to fit into buf[], this shouldn't be an error. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-12[media] af9033: fix compiler warningsHans Verkuil
Fix two warnings: af9033.c: In function 'af9033_read_status': af9033.c:883:25: warning: 'snr_lut' may be used uninitialized in this function [-Wmaybe-uninitialized] const struct val_snr *snr_lut; ^ af9033.c:952:25: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized] c->cnr.stat[0].svalue = tmp; ^ Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] cxd2841er: don't expose a dvbv5 stats to userspace if not availableMauro Carvalho Chehab
The current code will expose a zero value if one of the stats is not available, but this is not what userspace expects. Instead, if something goes wrong on providing some stats, it should be changing the scale to FE_SCALE_NOT_AVAILABLE. So, change the logic to do the right thing. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] DVB-C read signal strength added for Sony demodAbylay Ospan
cxd2841er_read_agc_gain_c added to obtain signal strength. signal strength now relay on AGC value. Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] cxd2841er: Fix signal strengh for DVB-T/T2 and show it in dBmMauro Carvalho Chehab
The signal strength value is reversed: the bigger the number, the weaker is the signal. Fix the logic and present it in dBm. Please notice that the dBm measure is actually an estimation, as the ratio is not fully linear. It also varies with the frequency. Yet, the estimation should be good enough for programs like Kaffeine to indicate when the signal is good or bad. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] cxd2841er: Do some changes at the dvbv5 stats logicMauro Carvalho Chehab
It is a good idea to measure the signal strength while tuning, as this helps to identify if the antenna is ok. Also, such measure helps to identify the quality of the signal. Do some changes to enable it before signal lock. While here, optimize the code to only initialize the stats length once, and make sure that, just after set_frontend, any reading for the stats that depends on lock to return FE_SCALE_NOT_AVAILABLE. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] rtl2832: do not allow driver unbindAntti Palosaari
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>
2016-07-08[media] rtl2830: move statistics to read_status()Antti Palosaari
Move statistics polling to read_status() in order to avoid use of kernel work. Also replace home made sign extension used for statistics with kernel sign_extend32(). 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>
2016-07-08[media] rtl2830: do not allow driver unbindAntti Palosaari
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>
2016-07-08[media] af9033: do not allow driver unbindAntti Palosaari
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>
2016-07-08[media] af9033: move statistics to read_status()Antti Palosaari
Move statistics polling to read_status() in order to avoid use of kernel work. 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>
2016-07-08[media] m88ds3103: refactor firmware downloadAntti Palosaari
* remove some unneeded variable initialization * rename variables * use min() macro to calc max i2c xfer len * change bad firmware error code from EFAULT to EINVAL 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>
2016-07-08[media] m88ds3103: use Hz instead of kHz on calculationsAntti Palosaari
There was some calculations where was kHz used in order to keep calculation withing 32-bit. Convert all to Hz and use 64-bit division helpers where needed. 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>
2016-07-08[media] m88ds3103: improve ts clock settingAntti Palosaari
Simplify TS clock divider calculation and programming slightly. 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>
2016-07-08[media] m88ds3103: calculate DiSEqC message sending timeAntti Palosaari
DiSEqC message sending takes 13.5 ms per byte, which is 54 ms total when typical 4 byte message is sent. Don't hard-code time limit to 54 ms, but calculate it. Time limit is only used to determine when to start poll "DiSEqC Tx ready" status from the chip. 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>
2016-07-08[media] m88ds3103: remove useless most significant bit clearAntti Palosaari
No need to clear negative msb bits as those were dropped in any case when data is written to register. 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>
2016-07-08[media] si2168: do not allow driver unbindAntti Palosaari
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>
2016-07-08[media] si2168: add support for newer firmwaresAntti Palosaari
Si2168-B40 firmware API has changed somewhere between 4.0-11 and 4.0-19 so that sleep will lose firmware upgrade from the chip. Due to that firmware re-upload is needed when newer firmwares are used. Rewrote firmware handling logic partly at the same. Signed-off-by: Antti Palosaari <crope@iki.fi> Cc: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil
Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-24dib0090: comment out the unused tablesMauro Carvalho Chehab
Those tables are currently unused, so comment them out: drivers/media/dvb-frontends/dib0090.c:852:18: warning: 'rf_ramp_pwm_sband' defined but not used [-Wunused-const-variable=] static const u16 rf_ramp_pwm_sband[] = { ^~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/dib0090.c:800:18: warning: 'bb_ramp_pwm_boost' defined but not used [-Wunused-const-variable=] static const u16 bb_ramp_pwm_boost[] = { ^~~~~~~~~~~~~~~~~ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-24drxj: comment out the unused nicam_presc_table_val tableMauro Carvalho Chehab
Avoid this warning: drivers/media/dvb-frontends/drx39xyj/drxj.c:1243:18: warning: 'nicam_presc_table_val' defined but not used [-Wunused-const-variable=] static const u16 nicam_presc_table_val[43] = { ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-10[media] m88rs2000: initialize status to zeroColin Ian King
status is not initialized so it can contain garbage. The check for status containing the FE_HAS_LOCK bit may randomly pass or fail if the read of register 0x8c fails to set status after 25 read attempts. Fix this by initializing status to 0. Issue found with CoverityScan, CID#986738 Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-09[media] rtl2832: add support for slave ts pid filterMartin Blumenstingl
The rtl2832 demod has 2 sets of PID filters. This patch enables the filter support when using a slave demod. Signed-off-by: Benjamin Larsson <benjamin@southpole.se> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] ds3000: return error if invalid symbol rate is setOlli Salonen
Return -EINVAL if ds3000_set_frontend is called with invalid parameters. v1 of the patch series got incorrect subject lines. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] fix semicolon.cocci warningsFengguang Wu
drivers/media/dvb-frontends/helene.c:750:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci CC: Abylay Ospan <aospan@netup.ru> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] mn88472: move out of staging to mediaAntti Palosaari
Move mn88472 DVB-T/T2/C demod driver out of staging to media. v2: Fix build error reported by kbuild test robot: drivers/staging/media/mn88472/Makefile: No such file or directory Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] mn88472: finalize driverAntti Palosaari
Finalize driver in order to move out of staging. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] mn88473: fix typoJulia Lawall
firmare -> firmware Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] mn88473: fix error path on probe()Antti Palosaari
Latest, 3rd, regmap instance should be freed on error case. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] helene: fix a warning when printing sizeof()Mauro Carvalho Chehab
drivers/media/dvb-frontends/helene.c: In function 'helene_write_regs': drivers/media/dvb-frontends/helene.c:312:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=] "wr reg=%04x: len=%d vs %lu is too big!\n", ^ Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] fix typo in SONY demodulator descriptionAbylay Ospan
correct is CXD2841ER and CXD2854ER incorrect was CXD2441ER and CXD2454ER Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Change frontend allocation strategy for NetUP Universal DVB cardsAbylay Ospan
Old behaviour: frontend0 - DVB-S/S2 frontend1 - DVB-T/T2 frontend2 - DVB-C frontend3 - ISDB-T New behaviour (DVBv5 API compliant): frontend0 - DVB-S/S2 frontend1 - DVB-T/T2/C/ISDB-T DTV standard should be selected by DTV_DELIVERY_SYSTEM call. And DVB-C default bandwidth now 8MHz Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] support DVB-T2 for SONY CXD2841/54Abylay Ospan
bandwidth 1.7,5,6,7,8Mhz support for DVB-T2 Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] fix DVB-S/S2 tuningAbylay Ospan
Fixed HELENE tuner frequency calculation Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] ISDB-T retune and offset fix and DVB-C bw fixMauro Carvalho Chehab
now when new tuning parameters specified demod should retune. Also ISDB-T frequency offset calculation added (cxd2841er_get_carrier_offset_i). While here, fix re-tune for DVB-C Annex A, using the desired bandwidth, instead of using 8MHz. Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Fix DVB-T frequency offset calculationAbylay Ospan
Fix offset calculation inside cxd2841er_get_carrier_offset_t Now DVB-T should be tuned correctly Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Sanity check when initializing DVB-S/S2 demodulatorAbylay Ospan
Avoid error message: cxd2841er_read_status_s(): invalid state 1 Always force demod to shutdown state before initializing Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Add carrier offset calculation for DVB-TAbylay Ospan
Adding cxd2841er_get_carrier_offset_t to calculate DVB-T offset for Sony demodulators CXD2841ER and CXD2854ER Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Fix DVB-S/S2 tune for sony ascot3a tunerAbylay Ospan
* fix buffer length check * do not rely on ROLLOFF Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Add support Sony CXD2854ER demodulatorAbylay Ospan
CXD2854ER is identical to CXD2841ER except ISDB-T/S added. New method 'cxd2841er_attach_i' is added xtal frequency now configurable. Available options: 20.5MHz, 24MHz, 41MHz Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-06-07[media] Add support Sony HELENE Sat/Ter TunerAbylay Ospan
This is Sony HELENE DVB-S/S2 DVB-T/T2 DVB-C/C2 ISDB-T/S tuner driver (CXD2858ER). Tuner is used on NetUP Dual Universal DVB CI card (hardware revision 1.4). Use 'helene_attach_s' to attach tuner in 'satellite mode'. Use 'helene_attach' for 'terrestrial mode'. Satellite delivery systems supported: DVB-S/S2, ISDB-S Terrestrial delivery systems supported: DVB-T/T2, ISDB-T Cable delivery systems supported: DVB-C/C2 Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>