[linux-dvb] fmd1216 integration

Trent Piepho xyzzy at speakeasy.org
Mon Mar 12 01:42:21 CET 2007


On Mon, 12 Mar 2007, Hartmut Hackmann wrote:
> > On Sunday 11 March 2007 09:40, Trent Piepho wrote:
> >> In dvb-pll, the frequency offset, which is the IF frequency the tuner will
> >> output at, is set to 36.213333 MHz.  It looks like this code was written
> >> about two years ago by Patrick as part of the reverse engineered cxusb
> >> driver.
> >>
> >> In saa7134-dvb, there is some totally different code from programming
> >> fmd1216 tuners, and it uses an IF frequency of 36.13 MHz.
> >>
> >> So, why the difference?

After looking at dvb-pll some more, I'm pretty sure the difference between
the saa7134 and the dvb-pll IF frequency is that the dvb-pll version has
1/2 the step size added in, so the result will be rounded correctly.

I think that should be done is adjust the IF values in in the dvb-pll
config structs to NOT include step-size/2 for rounding.  Just use the IF
frequency.  This is how most of the PLL definitions are already.  The code
which calculates the divisor should be changed to round to the nearest
integer, rather than round down.

> I wrote the code in saa7134-dvb. The FMD1216 has an integrated SAW filter
> for DVB-T, the data sheet says 36.13MHz. This is strange because the
> data sheet also recommends a tuning step size of 167 kHz (4 MHz / 24),
> so it should be 36.167MHz....

Maybe the person who picked the SAW filter and the person who recommended
the step size should have talked to each other...

> When i started writing it, there was no dvb-pll module. And the reason
> why i didn't move to dvb-pll yet is that this module has no means to
> control the RF AGC. Philips recommends different setting for analog and
> DVB-T.

dvb-pll can do this now.  These are the notes I've made about converting
fmd1216 to use dvb-pll wrt the saa7134 driver.

saa7134 driver

tda10046 demod, driver supports IF 36.13 Mhz (used here) or 36.17 MHz
SAA7134_BOARD_MD7134                    Medion 7134
SAA7134_BOARD_ASUS_EUROPA2_HYBRID       Asus Europa2 OEM

tuner_ops.init = philips_fmd1216_tuner_init
tuner_ops.sleep = philips_fmd1216_tuner_sleep
tuner_ops.set_params = philips_fmd1216_tuner_set_params

philips_fmd1216_tuner_init() just sends { 0x0b, 0xdc, 0x9c, 0xa0 } to the
tuner.  It could be replaced with the dvb-pll version, which will have
the same effect.

philips_fmd1216_tuner_set_params() does not use dvb_pll_configure(), but is
totally different code.  I've looked through it, and it will end up sending
almost the same data to the tuner.  The only difference is that dvb-pll
uses a IF frequency of 36.213333 MHz while the code in saa7134 uses 36.13
MHz.  In this case, I think dvb-pll is wrong.  It looks like the 26.213 MHz
value was written by Patrick Boettcher in 2005 when he wrote the cxusb
driver.  Actually, what I think now is that the dvb-pll value is offset by
stepsize/2 for rounding, since dvb-pll rounds down while saa7143 rounds to
nearest.  I should make a patch to fix rounding in dvb-pll.

philips_fmd1216_tuner_sleep() is buggy!  The _first_ time it is called
after _module loading_ it will send {0x0b, 0xdc, 0x9c, 0x60} and then
{0x0b, 0xdc, 0x86, 0x54} to the tuner.  The first sequence sets AGC to
analog mode (IMHO, the v4l tuner driver should do this for tuner init,
but it doesn't).  The second sequence just tunes to some random frequency
for no apparent reason.  Neither actually turns the tuner off!

After the first time it is called, philips_fmd1216_tuner_sleep() will just
send {0x0b, 0xdc, 0x86, 0x54} twice!  The array the sequence is in
shouldn't be static, or there should just be two static arrays for each
sequence.  IMHO, using static locals that are not const is almost always
wrong in the kernel.

I think this could be replaced with the dvb-pll sleep function, if a
sleep sequence was added to dvb_pll_fmd1216me.  We should send {0x9d,
0x60}, which will turn the tuner off and set the AGC back to the analog
recommended value.




More information about the linux-dvb mailing list