Starting with kernel 3.11 (or a little bit earlier), the PCTV 340e DVB-T tuner would no longer tune to any channel. There's been a patch which introduced a frequency offset in dib7000p, based on tuner frequency, here: https://github.com/torvalds/linux/commit/6fe10 99c7aecc54ebf2fcf8e3af2225cd7bfa550 . Yet, there should be no offset with the PCTV 340e's DIB7000P, as the COFDM demodulator is already set at the right frequency, i.e. the one the XC4000 tuner passes its data on.
In order to make the PCTV 340e work again, I have done the following:

In drivers/media/dvb-frontends/dib7000p.c :

static void dib7000p_set_dds(struct dib7000p_state *state, s32 offset_khz)
{
        u32 internal = dib7000p_get_internal_freq(state);
s32 unit_khz_dds_val = 67108864 / (internal); /* 2**26 / Fsampling is the unit 1KHz offset */
        u32 abs_offset_khz = ABS(offset_khz);
        u32 dds = state->cfg.bw->ifreq & 0x1ffffff;
        u8 invert = !!(state->cfg.bw->ifreq & (1 << 25));

dprintk("setting a frequency offset of %dkHz internal freq = %d invert = %d", offset_khz, internal, invert);

        if (offset_khz < 0)
                unit_khz_dds_val *= -1;

        /* IF tuner */
//comment out the lines that involve the offset
//      if (invert)
// dds -= (abs_offset_khz * unit_khz_dds_val); /* /100 because of /100 on the unit_khz_dds_val line calc for better accuracy */
//      else
//              dds += (abs_offset_khz * unit_khz_dds_val);

if (abs_offset_khz <= (internal / 2)) { /* Max dds offset is the half of the demod freq */ dib7000p_write_word(state, 21, (u16) (((dds >> 16) & 0x1ff) | (0 << 10) | (invert << 9)));
                dib7000p_write_word(state, 22, (u16) (dds & 0xffff));
        }
}

Restoring dib7000p_set_dds(state, 0); instead of the if (demod->ops.tuner_ops.get_frequency) {...} didn't do the trick (or I did something wrong with it...)).

This is a basic workaround to get it working, yet there may be units which embed a DIB7000P demodulator, and where this offset is required. Does anybody out there have such an unit, or a justification for this offset setting?

Cheers,
Corentin FERRY
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to