diff options
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000.h | 29 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 31 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc_priv.h | 35 |
3 files changed, 36 insertions, 59 deletions
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h index d2ab7479012..bd0e663cf6f 100644 --- a/drivers/media/dvb/frontends/dib3000.h +++ b/drivers/media/dvb/frontends/dib3000.h @@ -26,10 +26,20 @@ #include <linux/dvb/frontend.h> +struct dib3000p_agc_config { + u16 val[12]; +}; + struct dib3000_config { /* the demodulator's i2c address */ u8 demod_address; + + const struct dib3000p_agc_config *agc; + + /* PLL maintenance and the i2c address of the PLL */ + int (*pll_init)(struct dvb_frontend *fe); + int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params); }; struct dib_fe_xfer_ops @@ -41,28 +51,11 @@ struct dib_fe_xfer_ops int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl); }; -#if defined(CONFIG_DVB_DIB3000MB) || defined(CONFIG_DVB_DIB3000MB_MODULE) extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); -#else -static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, - struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) -{ - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); - return NULL; -} -#endif // CONFIG_DVB_DIB3000MB -#if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE) extern struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); -#else -static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, - struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) -{ - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); - return NULL; -} -#endif // CONFIG_DVB_DIB3000MC +extern int dib3000mc_set_agc_config(struct dvb_frontend *fe, const struct dib3000p_agc_config *agc); #endif // DIB3000_H diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 66b30edad2e..41710f43975 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -558,7 +558,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) { struct dib3000_state *state = fe->demodulator_priv; - int AGCtuner=(int)fe->misc_priv; + const struct dib3000p_agc_config *agc = state->config.agc; deb_info("init start\n"); state->timing_offset = 0; @@ -584,11 +584,24 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) /* mobile mode - portable reception */ wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); -/* TUNER_PANASONIC_ENV57H12D5 or TUNER_MICROTUNE_MT2060. Sets agc_tuner accordingly */ + /* AGC settings for all tuners */ wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth); wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general); - if (AGCtuner<0 || AGCtuner>=DIB3000MC_AGC_TUNER_COUNT) AGCtuner=1; - wr_foreach(dib3000mc_reg_agc,dib3000mc_agc_tuner[AGCtuner]); + + /* AGC setting - specific to the tuners */ + wr(36, agc->val[0]); + wr(37, agc->val[1]); + wr(38, agc->val[2]); + wr(39, agc->val[3]); + + wr(42, agc->val[4]); + wr(43, agc->val[5]); + wr(44, agc->val[6]); + wr(45, agc->val[7]); + wr(46, agc->val[8]); + wr(47, agc->val[9]); + wr(48, agc->val[10]); + wr(49, agc->val[11]); wr(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110); wr(26,0x6680); @@ -824,6 +837,13 @@ static int dib3000mc_demod_init(struct dib3000_state *state) return 0; } +int dib3000mc_set_agc_config(struct dvb_frontend *fe, const struct dib3000p_agc_config *agc) +{ + struct dib3000_state *st = fe->demodulator_priv; + st->config.agc = agc; + return 0; +} +EXPORT_SYMBOL(dib3000mc_set_agc_config); static struct dvb_frontend_ops dib3000mc_ops; @@ -878,6 +898,7 @@ error: kfree(state); return NULL; } +EXPORT_SYMBOL(dib3000mc_attach); static struct dvb_frontend_ops dib3000mc_ops = { @@ -916,5 +937,3 @@ static struct dvb_frontend_ops dib3000mc_ops = { MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(dib3000mc_attach); diff --git a/drivers/media/dvb/frontends/dib3000mc_priv.h b/drivers/media/dvb/frontends/dib3000mc_priv.h index e1d0c98cf91..a0c8f1c911d 100644 --- a/drivers/media/dvb/frontends/dib3000mc_priv.h +++ b/drivers/media/dvb/frontends/dib3000mc_priv.h @@ -155,41 +155,6 @@ static u16 dib3000mc_imp_noise_ctl[][2] = { { 0x1294, 0x1ff8 }, /* mode 4 */ }; -/* AGC registers */ -static u16 dib3000mc_reg_agc[] = { - 36,37,38,39,42,43,44,45,46,47,48,49 -}; -/* AGC settings. Don't change the ordering of the entries */ -#define DIB3000MC_AGC_TUNER_COUNT 5 - -static u16 dib3000mc_agc_tuner[][12] = { -/* 0*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xcf5c, 0x6666, - 0xbae1, 0xa148, 0x3b5e, 0x3c1c, 0x001a, 0x2019 - }, /* TUNER_PANASONIC_ENV77H04D5, */ - -/* 1*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xdc29, 0x570a, - 0xbae1, 0x8ccd, 0x3b6d, 0x551d, 0x000a, 0x951e - }, /* TUNER_PANASONIC_ENV57H13D5, TUNER_PANASONIC_ENV57H12D5 */ - -/* 2*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xffff, 0xffff, - 0xffff, 0x0000, 0xfdfd, 0x4040, 0x00fd, 0x4040 - }, /* TUNER_SAMSUNG_DTOS333IH102, TUNER_RFAGCIN_UNKNOWN */ - -/* 3*/ { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xbd71, 0x5c29, - 0xb5c3, 0x6148, 0x6569, 0x5127, 0x0033, 0x3537 - }, /* TUNER_PROVIDER_X */ - -/* 4*/ { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xffff, 0x5c29, - 0xa8f6, 0x5eb8, 0x65ff, 0x40ff, 0x008a, 0x1114 - }, /* TUNER_MT2060 ( as in DibCom driver )*/ - -/* { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xbd71, 0x5c29, - 0xb5c3, 0x6148, 0x0045, 0x5127, 0x0033, 0x3437 - },*//* TUNER_MT2060 ( as in LITE-ON driver )*/ - - /* TODO TUNER_PANASONIC_ENV57H10D8, TUNER_PANASONIC_ENV57H11D8 */ -}; - /* AGC loop bandwidth */ static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 }; static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 }; |