[media] rtl2832: Fix IF calculus
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 15 Apr 2013 22:44:39 +0000 (19:44 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 17 Apr 2013 00:39:28 +0000 (21:39 -0300)
Spectrum is inverted. So, we need to invert it when calculating the
value for the IF register

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
drivers/media/dvb-frontends/rtl2832.c

index 2f5a2b504932d583828a5c0b6bffc97e3ee869e6..facb84841518e66cd274308af34009a16a8a7390 100644 (file)
@@ -396,7 +396,11 @@ static int rtl2832_set_if(struct dvb_frontend *fe, u32 if_freq)
        pset_iffreq = if_freq % priv->cfg.xtal;
        pset_iffreq *= 0x400000;
        pset_iffreq = div_u64(pset_iffreq, priv->cfg.xtal);
+       pset_iffreq = -pset_iffreq;
        pset_iffreq = pset_iffreq & 0x3fffff;
+       dev_dbg(&priv->i2c->dev, "%s: if_frequency=%d pset_iffreq=%08x\n",
+                       __func__, if_freq, (unsigned)pset_iffreq);
+
        ret = rtl2832_wr_demod_reg(priv, DVBT_EN_BBIN, en_bbin);
        if (ret)
                return ret;