summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/af9033.c
AgeCommit message (Collapse)Author
2015-08-11[media] dvb-frontends: 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-09[media] dvb: Get rid of typedev usage for enumsMauro Carvalho Chehab
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/*
2014-11-05[media] af0933: Don't go past arraysMauro Carvalho Chehab
X-Patchwork-Delegate: m.chehab@samsung.com Fixes the following sparse warnings: drivers/media/dvb-frontends/af9033.c:295 af9033_init() error: buffer overflow 'clock_adc_lut' 11 <= 11 drivers/media/dvb-frontends/af9033.c:300 af9033_init() error: buffer overflow 'clock_adc_lut' 11 <= 11 drivers/media/dvb-frontends/af9033.c:584 af9033_set_frontend() error: buffer overflow 'coeff_lut' 3 <= 3 drivers/media/dvb-frontends/af9033.c:595 af9033_set_frontend() error: buffer overflow 'clock_adc_lut' 11 <= 11 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: continue polling unless critical IO errorAntti Palosaari
That case is not IO error, so better to jump out now, but still continue polling. Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: return 0.1 dB DVBv3 SNR for AF9030 familyAntti Palosaari
Previous patch changed both AF9030 and IT9130 SNR reporting from dB to relative. Restore AF9030 to old behavior as it has been always returning 0.1 dB value. Leave IT9130 relative as old IT9130 was returning relative values. Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: fix DVBv3 snr value not correct issueBimow Chen
Snr returns value not correct. Fix it. Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: improve read_signal_strength error handling slightlyAntti Palosaari
Check return status after each register access routine and avoid masking return status values. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: fix AF9033 DVBv3 signal strength measurementAntti Palosaari
Previous patch changes used signal strength firmware register from 0x800048 to 0x80004a in case of AF9033/AF9035 chip. In practice reported values were running upside-down, when RR strength increases reported value decreases and vice versa. That is because of 0x80004a returns values that are dBm scale, but negative RF strength dBm returned as positive number. 0x800048 returns 0-100, like percentage 0x80004a returns 0-255 dBm, without a negative sign So restore old measurement now. Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04[media] af9033: fix DVBv3 signal strength value not correct issueBimow Chen
Register 0x800048 is not dB measure but relative scale. Fix it and conform to NorDig specifications. Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: init DVBv5 statisticsAntti Palosaari
We need to init supported stats here in order signal app which stats are supported. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: remove all DVBv3 stat calculation logicAntti Palosaari
Statistics are now calculated for DVBv5 and those DVBv5 values are returned for legacy DVBv3 calls also. So we could remove all old statistics calculation logic. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: wrap DVBv3 BER to DVBv5 BERAntti Palosaari
DVBv5 BER is calculated anyway, so just return it for legacy read_ber() API too. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: wrap DVBv3 UCB to DVBv5 UCB statsAntti Palosaari
Remove 'duplicate' DVBv3 read UCB implementation and return value, calculated already for DVBv5 statistics. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: implement DVBv5 post-Viterbi BERAntti Palosaari
Implement following DTV API commands: DTV_STAT_POST_ERROR_BIT_COUNT DTV_STAT_POST_TOTAL_BIT_COUNT These will provide post-Viterbi bit error rate reporting. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: implement DVBv5 stat block countersAntti Palosaari
Implement following API commands: DTV_STAT_ERROR_BLOCK_COUNT DTV_STAT_TOTAL_BLOCK_COUNT These returns total and uncorrected error packets from outer FEC. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: wrap DVBv3 read SNR to DVBv5 CNRAntti Palosaari
Remove 'duplicate' DVBv3 read SNR implementation and return value, calculated already by DVBv5 CNR, from the cache. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: implement DVBv5 statistics for CNRAntti Palosaari
Return CNR via DVBv5 statistics API. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: implement DVBv5 statistics for signal strengthAntti Palosaari
Let the demod firmware estimate RF signal strength and return it to the app as a dBm. To handle that, use thread which reads signal strengths from firmware in 2 sec intervals when device is active. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: clean up loggingAntti Palosaari
It uses I2C client so logging system prints module name automatically. Function name is also added automatically, if it is requested from dynamic debug by setting proper format. Because of that, we could simplify logging in our driver. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: convert to I2C clientAntti Palosaari
Convert driver to kernel I2C model. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: rename 'state' to 'dev'Antti Palosaari
foo_dev seems to be most correct term for the structure holding data of each device instance. It is most used term in Kernel codebase and also examples from book Linux Device Drivers, Third Edition, uses it. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: fix firmware version loggingAntti Palosaari
AF9030 and IT9130 series has different memory location for firmware version. Choose correct location according to chip type. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: make checkpatch.pl happyAntti Palosaari
Correct issues reported by checkpatch.pl. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] af9033: provide dyn0_clk clock sourceAntti Palosaari
AF903x/IT913x demod provides clock source(s). It seems that this clock source is used for integrated RF tuner of IT913x. It is enabled by default, but firmware disables it automatically when suspend is requested (suspend_flag (0x004c) + trigger_ofsm (0x0000)). Automatic disable behavior seems to be similar for both AF903x and IT913x I tested, though there is no likely any real clock user in a case of AF903x. Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-04[media] af9033: feed clock to RF tunerAntti Palosaari
IT9135 RF tuner clock is coming from demodulator. We need enable it early in demod init, before any tuner I/O. Currently it is enabled by tuner driver itself, but it is too late and performance will be reduced as some registers are not updated correctly. Clock is disabled automatically when demod is put onto sleep. Cc: <stable@vger.kernel.org> # v3.15+ Cc: Bimow Chen <Bimow.Chen@ite.com.tw> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-14[media] af9033: Don't export functions for the hardware filterMauro Carvalho Chehab
Exporting functions for hardware filter is a bad idea, as it breaks compilation if: CONFIG_DVB_USB_AF9035=y CONFIG_DVB_AF9033=m Because the PID filter function calls would be hardcoded at af9035. The same doesn't happen with af9033_attach() because the dvb_attach() doesn't hardcode it. Instead, it dynamically links it at runtime. However, calling dvb_attach() multiple times is problematic, as it increments module kref. So, the better is to pass one parameter for the af9033 module to fill the hardware filters, and then use it inside af9035. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-14[media] af9033: implement PID filterAntti Palosaari
Implement PID filter and export it via symbol. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-04[media] af9033: fix broken I2CAntti Palosaari
Driver did not work anymore since I2C has gone broken due to recent commit: commit 37ebaf6891ee81687bb558e8375c0712d8264ed8 [media] dvb-frontends: Don't use dynamic static allocation Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: stable@vger.kernel.org
2013-11-08[media] dvb-frontends: Don't use dynamic static allocationMauro Carvalho Chehab
Dynamic static allocation is evil, as Kernel stack is too low, and compilation complains about it on some archs: drivers/media/dvb-frontends/af9013.c:77:1: warning: 'af9013_wr_regs_i2c' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/af9033.c:188:1: warning: 'af9033_wr_reg_val_tab' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/af9033.c:68:1: warning: 'af9033_wr_regs' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/bcm3510.c:230:1: warning: 'bcm3510_do_hab_cmd' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/cxd2820r_core.c:84:1: warning: 'cxd2820r_rd_regs_i2c.isra.1' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/rtl2830.c:56:1: warning: 'rtl2830_wr' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/rtl2832.c:187:1: warning: 'rtl2832_wr' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/tda10071.c:52:1: warning: 'tda10071_wr_regs' uses dynamic stack allocation [enabled by default] drivers/media/dvb-frontends/tda10071.c:84:1: warning: 'tda10071_rd_regs' uses dynamic stack allocation [enabled by default] Instead, let's enforce a limit for the buffer. Considering that I2C transfers are generally limited, and that devices used on USB has a max data length of 64 bytes for the control URBs. So, it seem safe to use 64 bytes as the hard limit for all those devices. On most cases, the limit is a way lower than that, but this limit is small enough to not affect the Kernel stack, and it is a no brain limit, as using smaller ones would require to either carefully each driver or to take a look on each datasheet. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-03-21[media] af9033: implement i/o optimized reg table writerAntti Palosaari
Use register address auto increment to reduce I/O when large register / values tables are written. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: sleep on attach()Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: move code from it913x to af9033Antti Palosaari
That register is property of demodulator so move it correct place. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] it913x: remove unused af9033 demod tuner config initsAntti Palosaari
Those are demodulator init tables according to used tuner tuner config. af9033 demod driver does those inits currently and due to that these duplicate inits could be removed. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "62" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "61" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "60" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "52" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "51" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 tuner config "38" init tableAntti Palosaari
Dumped out from the Windows driver version 12.07.06.1 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: add IT9135 demod reg init tablesAntti Palosaari
Dumped out from Windows driver version 12.07.06.1, 07/06/2012. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: IT9135 v2 supported related changesAntti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] af9033: support for it913x tunersAntti Palosaari
Add support for tuners integrated to the IT9135 and IT9137. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06[media] af9035: dual mode related changesAntti Palosaari
Various small changes and fixes releated to dual mode. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06[media] af9035: dual mode supportJose Alberto Reguero
Adds initial support for af9035 dual mode designs. Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net> [crope@iki.fi: fix merge conflict] Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06[media] af9033: add support for Fitipower FC0012 tunerAntti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-05[media] af9033: prevent unintended underflowHans-Frieder Vogt
As spotted by Dan Carpenter <dan.carpenter@oracle.com> (thanks!), we have improperly used an unsigned variable in a calculation that may result in a negative number. This may cause an unintended underflow if the interface frequency of the tuner is > approx. 40MHz. This patch should resolve the issue, following an approach similar to what is used in af9013.c. [crope@iki.fi: add Reported-by] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-27[media] Support for Asus MyCinema U3100Mini PlusOliver Schinagl
This is initial support for the Asus MyCinema U3100Mini Plus. The driver in its current form gets detected and loads properly. Scanning using dvbscan works without problems, Locking onto a channel using tzap also works fine. Only playback using tzap -r + mplayer was tested and was fully functional. It uses the af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is the FCI FC2580. Signed-off-by: Oliver Schinagl <oliver@schinagl.nl> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-27[media] af9033: sleep on attachAntti Palosaari
This reduces power consumption 10mA. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23[media] af9033: use Kernel dev_foo() loggingAntti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13[media] move the dvb/frontends to drivers/media/dvb-frontendsMauro Carvalho Chehab
Raise the DVB frontends one level up, as the intention is to remove the drivers/media/dvb directory. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>