]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] r820t: fix imr calibration
authorGianluca Gennari <gennarone@gmail.com>
Mon, 17 Jun 2013 23:32:45 +0000 (20:32 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 Jun 2013 14:07:53 +0000 (11:07 -0300)
The r820t_imr() calibration function of the Rafael Micro R820T tuner
generates this error at every tune attempt:
r820t 0-001a: No valid PLL values for 2252021 kHz!
The function was inspired by the original Realtek driver for rtl2832 devices
with the r820t tuner; anyway, in the original code the XTAL frequency of
the tuner was expressed in KHz, while in the kernel driver it is expressed
in Hz; so the calibration failed because of an out-of-range initial value.
The final result of the computation is then passed to the r820t_set_mux()
and r820t_set_pll() functions, but the conversion from KHz to Hz is already
correctly implemented.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/tuners/r820t.c

index 0a5f96be08f1d6b1df1996f758826509f1897215..1c23666468cf69223542b5f89f024a1201c4733d 100644 (file)
@@ -1857,9 +1857,9 @@ static int r820t_imr(struct r820t_priv *priv, unsigned imr_mem, bool im_flag)
        int reg18, reg19, reg1f;
 
        if (priv->cfg->xtal > 24000000)
-               ring_ref = priv->cfg->xtal / 2;
+               ring_ref = priv->cfg->xtal / 2000;
        else
-               ring_ref = priv->cfg->xtal;
+               ring_ref = priv->cfg->xtal / 1000;
 
        n_ring = 15;
        for (n = 0; n < 16; n++) {