[linux-dvb] Thoughts about supporting more complex tuners
Manu Abraham
abraham.manu at gmail.com
Fri Apr 14 00:07:50 CEST 2006
Andrew de Quincey wrote:
> Hi, we're starting to see cards which require more complex tuner code
> (especially with the new Silicon Tuners).. so much so that it begins to make
> sense to write these as their own standalone modules. I've been thinking how
> to incorporate these into the frontend structure. Attached is a first
> attempt.
>
> As you can see, I have added some more ops to the frontend_ops structure and a
> tuner_priv field to the dvb_frontend structure. The idea being that when
> creating the frontend (pretend its stv0299 for the moment) for a card, you do
> the following:
>
> dvb_frontend *fe = stv0299_attach();
> acomplextuner_attach(fe);
>
> So the stv0299 initalises the dvb_frontend first and fills out the ops
> function pointers. Then the tuner is attached, and fills out yet more
> function pointers (perhaps even overriding some of the demod ones) depending
> on precisely how the hardware is wired. The card driver can then override
> functions if it wants to (e.g. for DISEQC).
>
> The tuner can control the demodulator's i2c switch (if present) using the
> i2c_gate_ctrl function pointer present in the ops structure (usually filled
> out by the demod attach function).
>
> The frontend loop will be modified as well - instead of just calling
> set_frontend(), it will call tuner_set() beforehand as well.
>
> Finally, if we do this, I would remove all the pll_set()/pll_init() function
> pointers in the demodulator config structures in favour of this method. I
> would however create a wrapper "simpletuner" so that we can continue with
> minimal code for the "simple" PLLs - theres no point in complicating these
> beasts.
>
> Anyway, let me know what you think.. as I said this is a first attempt, so
> anything can be changed.
>
> ------------------------------------------------------------------------
>
> diff -r 2b05b5271ae1 linux/drivers/media/dvb/dvb-core/dvb_frontend.h
> --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Thu Apr 13 12:29:04 2006 -0400
> +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Thu Apr 13 21:57:06 2006 +0100
> @@ -86,6 +86,13 @@ struct dvb_frontend_ops {
> int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
> int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
> int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
> +
> + int (*tuner_release)(struct dvb_frontend *fe);
> + int (*tuner_init)(struct dvb_frontend *fe);
> + int (*tuner_sleep)(struct dvb_frontend *fe);
> + int (*tuner_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params);
> + int (*tuner_get)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params);
> + int (*tuner_poll)(struct dvb_frontend *fe);
> };
>
> #define MAX_EVENT 8
> @@ -102,6 +109,7 @@ struct dvb_frontend {
> struct dvb_frontend {
> struct dvb_frontend_ops* ops;
> struct dvb_adapter *dvb;
> + void* tuner_priv;
>
Looks nice, Already started using that one .. :-)
More information about the linux-dvb
mailing list