aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners/r820t.c
Commit message (Collapse)AuthorAge
* [media] r820t: Remove a warning for an unused valueMauro Carvalho Chehab2013-04-25
| | | | | | | | | | | | | Currently, the driver complains about the pre_detect var: drivers/media/tuners/r820t.c: In function 'r820t_sysfreq_sel': drivers/media/tuners/r820t.c:722:31: warning: variable 'pre_dect' set but not used [-Wunused-but-set-variable] While rtl8232 code comments it, perhaps some other driver may use. So, the better is to keep the code there, allowing to enable it via r820t config data. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] r820t: quiet gcc warning on n_ringFengguang Wu2013-04-25
| | | | | | | | | | drivers/media/tuners/r820t.c: In function 'r820t_imr': drivers/media/tuners/r820t.c:1871:8: warning: 'n_ring' may be used uninitialized in this function [-Wmaybe-uninitialized] Mauro: This is a FALSE POSITIVE: the loop will always return a value for n_ring, as the last test will fill it with 15, if the loop fails. Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] r820t: memory leak in release()Dan Carpenter2013-04-25
| | | | | | | | I've moved the kfree(fe->tuner_priv) one line earlier, otherwise it is a no-op. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] r820t: precendence bug in r820t_xtal_check()Dan Carpenter2013-04-25
| | | | | | | | The test as written is always false. It looks like the intent was to test that the bit was not set. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] r820t: Don't divide the IF by twoMauro Carvalho Chehab2013-04-16
| | | | | | | | The original Win driver doesn't do; rtl-sdr also disabled that piece of the code. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: disable auto gain/VGA settingMauro Carvalho Chehab2013-04-16
| | | | | | | | On field tests, the auto gain routine is not working, nor it is used by the original driver. Let's comment it for now. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: put it into automatic gain modeMauro Carvalho Chehab2013-04-16
| | | | | | | Currently, it is putting it on manual mode. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Fix hp_cor filter maskMauro Carvalho Chehab2013-04-16
| | | | | | | The bit mask was inverted here. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: fix PLL calculusMauro Carvalho Chehab2013-04-16
| | | | | | | | | | There are a few errors at the PLL calculus, causing the device to use wrong values. While here, change the calculus to use 32 bits, as there's no need for 64 bits there. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Don't put it in standby if not initialized yetMauro Carvalho Chehab2013-04-16
| | | | | | | | r820t_standby() can be called before r820t_init(). If that happens, just do nothing. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: avoid rewrite all regs when not neededMauro Carvalho Chehab2013-04-16
| | | | | Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Allow disabling IMR callibrationMauro Carvalho Chehab2013-04-16
| | | | | | | | | | | | | | The rtl-sdr library disabled IMR callibration. While I'm not sure yet why, it could be a good idea to add a modprobe parameter here, to allow to also disable it. There are two rationale behind it: - It helps to compare USB dumps between rtl-sdr and the Kernel module; - If rtl-sdr disabled it, perhaps there's a good reason (e. g. it might not be actually working, or it might be causing some trouble). For both cases, it seems useful to add a modprobe parameter to allow testing the device with both configurations. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: add a commented code for GPIOMauro Carvalho Chehab2013-04-16
| | | | | | | | | | | | | | | Add the code to set the GPIO for this tuner. This code is currently unused, so it is kept there only for completeness. With this patch there are just two things that got left from the original driver: - At standby, there's another mode, not used by rtl2832u. Not sure if it might be needed in the future, but I suspect it is not used at all; - There is a "fast tune" mode. As nor DVB or V4L API supports it, it seems an overkill to implement it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: add IMR calibrate codeMauro Carvalho Chehab2013-04-16
| | | | | | | | | | This code seems to calibrate I/Q phase and gain during the device initialization. This is done only once, and it doesn't seem to be needed to happen after resuming. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: proper initialize the PLL registerMauro Carvalho Chehab2013-04-16
| | | | | | | | | The rtl-sdr library, from where this driver was initially based, doesn't use half PLL clock, but this is used on the Realtek Kernel driver. So, also do the same here. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: use usleep_range()Mauro Carvalho Chehab2013-04-16
| | | | | | | | Instead of using msleep(), use sleep_range(), as it provides a closer sleep time. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: fix prefix of the r820t_read() functionMauro Carvalho Chehab2013-04-16
| | | | | | | | Just cosmetic changes: all other functions are prefixed by r820t. Do the same for r820t_read(). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: split the function that read cached regsMauro Carvalho Chehab2013-04-16
| | | | | | | | As we'll need to retrieve cached registers, make this function explicit. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: better report signal strengthMauro Carvalho Chehab2013-04-16
| | | | | | | If signal is zero, shows it as a zero, not as 0xff. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: add support for diplexerMauro Carvalho Chehab2013-04-16
| | | | | | | | This is part of the original driver, and adding it doesn't hurt, so add it, to better sync the code. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Show the read data in the bit-reversed orderMauro Carvalho Chehab2013-04-16
| | | | | | | | As the driver's logic uses the bit-reversed order for read, use it as well when displaying the debug messages. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: use the second table for 7MHzMauro Carvalho Chehab2013-04-16
| | | | | | | | The Realtek Kernel driver uses the second DVB-T 7MHz table instead of the first one. Use it as well. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Invert bits for read opsMauro Carvalho Chehab2013-04-16
| | | | | | | On read, the bit order is inverted. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: use the right IF for the selected TV standardMauro Carvalho Chehab2013-04-16
| | | | | | | | IF is set at r820t_set_tv_standard(). So, we can't calculate LO frequency before calling it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Fix IF scaleMauro Carvalho Chehab2013-04-16
| | | | | | | Scale used at get_if_freq and LO freq calculus is Hz. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] rtl820t: Add a debug msg when PLL gets lockedMauro Carvalho Chehab2013-04-16
| | | | | | | [ 2255.342797] r820t 3-001a: generic_set_freq: PLL locked on frequency 725476191 Hz, gain=45 Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: proper lock and set the I2C gateMauro Carvalho Chehab2013-04-16
| | | | | | | | | As this tuner can be used by analog and digital parts of the driver, be sure that all ops that access the hardware will be be properly locked. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Set gain mode to autoMauro Carvalho Chehab2013-04-16
| | | | | | | | | | | | This tuner works with 2 modes: automatic gain mode and manual gain mode. Put it into automatic mode, as we currently don't have any API for manual gain adjustment. The logic to allow setting the manual mode is there, as it is just a few extra code. This way, if/when we latter add support for setting the gain mode, the code is already there. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Give a better estimation of the signal strengthMauro Carvalho Chehab2013-04-16
| | | | | | | | Instead of a binary signal strength measure, use the tuner gain to obtain a better estimation of the signal strength. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
* [media] r820t: Add a tuner driver for Rafael Micro R820T silicon tunerMauro Carvalho Chehab2013-04-16
This driver was written from scratch, based on an existing driver that it is part of rtl-sdr git tree, released under GPLv2: https://groups.google.com/forum/#!topic/ultra-cheap-sdr/Y3rBEOFtHug https://github.com/n1gp/gr-baz http://cgit.osmocom.org/rtl-sdr/plain/src/tuner_r820t.c (there are also other variants of it out there) >From what I understood from the threads, the original driver was converted to userspace from a Realtek tree. I couldn't find the original tree. However, the original driver look awkward on my eyes. So, I decided to write a new version from it from the scratch, while trying to reproduce everything found there. TODO: - After locking, the original driver seems to have some routines to improve reception. This was not implemented here yet. - RF Gain set/get is not implemented. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>