Commit e4d6c1f7 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab

V4L/DVB: Cleanups for mt2060-integration

- some coding style fixes for newly added mt2060
- moved agc-config from fixed values in dib3000mc to configurable ones
- whitespace clean-ups for usb-id-file
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent a16bf5d5
...@@ -168,63 +168,61 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) ...@@ -168,63 +168,61 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
} }
EXPORT_SYMBOL(dibusb_read_eeprom_byte); EXPORT_SYMBOL(dibusb_read_eeprom_byte);
static struct mt2060_config default_mt2060_config = { static struct mt2060_config stk3000p_mt2060_config = {
.i2c_address = 0x60, .i2c_address = 0x60,
}; };
static int dibusb_tuner_init(struct dvb_frontend *fe) static int dibusb_tuner_init(struct dvb_frontend *fe)
{ {
int ret;
struct dvb_usb_device *d = fe->dvb->priv; struct dvb_usb_device *d = fe->dvb->priv;
struct dibusb_state *st = d->priv; struct dibusb_state *st = d->priv;
if (d->tuner_pass_ctrl) { if (d->tuner_pass_ctrl && st->mt2060_present) {
if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) { // Microtune MT2060 int ret;
d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
ret=mt2060_init(&st->mt2060); ret = mt2060_init(&st->mt2060);
} d->tuner_pass_ctrl(d->fe, 0, 0);
else { // Panasonic whatever
d->tuner_pass_ctrl(d->fe,1,d->pll_addr);
ret=dvb_usb_pll_init_i2c(fe);
}
d->tuner_pass_ctrl(d->fe,0,0);
return ret; return ret;
} }
return -ENODEV; return dvb_usb_pll_init_i2c(fe);
} }
static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
{ {
int ret;
struct dvb_usb_device *d = fe->dvb->priv; struct dvb_usb_device *d = fe->dvb->priv;
struct dibusb_state *st = d->priv; struct dibusb_state *st = d->priv;
if (d->tuner_pass_ctrl) { if (d->tuner_pass_ctrl && st->mt2060_present) {
if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) { int ret;
d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
ret=mt2060_set(&st->mt2060,fep); ret = mt2060_set(&st->mt2060,fep);
}
else {
d->tuner_pass_ctrl(d->fe,1,d->pll_addr);
ret=dvb_usb_pll_set_i2c(fe,fep);
}
d->tuner_pass_ctrl(d->fe,0,0); d->tuner_pass_ctrl(d->fe,0,0);
return ret; return ret;
} }
return -ENODEV; return dvb_usb_pll_set_i2c(fe,fep);
} }
static const struct dib3000p_agc_config dib3000p_agc_panasonic_env57h1xd5 = {
{ 0x51, 0x301d, 0x0, 0x1cc7, 0xdc29, 0x570a,
0xbae1, 0x8ccd, 0x3b6d, 0x551d, 0xa, 0x951e }
};
static const struct dib3000p_agc_config dib3000p_agc_microtune_mt2060 = {
{ 0x196, 0x301d, 0x0, 0x1cc7, 0xffff, 0x5c29,
0xa8f6, 0x5eb8, 0x65ff, 0x40ff, 0x8a, 0x1114 }
};
int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d)
{ {
struct dib3000_config demod_cfg; struct dib3000_config demod_cfg;
struct dibusb_state *st = d->priv; struct dibusb_state *st = d->priv;
demod_cfg.pll_set = dibusb_tuner_set; demod_cfg.agc = &dib3000p_agc_panasonic_env57h1xd5;
demod_cfg.pll_set = dibusb_tuner_set;
demod_cfg.pll_init = dibusb_tuner_init; demod_cfg.pll_init = dibusb_tuner_init;
for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++)
if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) {
d->fe->misc_priv=(void *)DIBUSB_TUNER_DEFAULT;
d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
return 0; return 0;
} }
...@@ -236,18 +234,23 @@ EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); ...@@ -236,18 +234,23 @@ EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
{ {
int ret; int ret;
d->pll_addr = 0x60;
d->pll_desc = &dvb_pll_env57h1xd5;
if (d->tuner_pass_ctrl) { if (d->tuner_pass_ctrl) {
struct dibusb_state *st = d->priv; struct dibusb_state *st = d->priv;
d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
if ((ret = mt2060_attach(&st->mt2060,&default_mt2060_config, &d->i2c_adap)) == 0) { /* check for mt2060 */
d->fe->misc_priv=(void *)DIBUSB_TUNER_MT2060; if ((ret = mt2060_attach(&st->mt2060,&stk3000p_mt2060_config, &d->i2c_adap)) != 0) {
/* not found - use panasonic pll parameters */
d->pll_addr = 0x60;
d->pll_desc = &dvb_pll_env57h1xd5;
} else {
st->mt2060_present = 1;
/* set the correct agc parameters for the dib3000p */
dib3000mc_set_agc_config(d->fe, &dib3000p_agc_microtune_mt2060);
} }
d->tuner_pass_ctrl(d->fe,0,0); d->tuner_pass_ctrl(d->fe,0,0);
return 0;
} }
return -ENODEV; return 0;
} }
EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
......
...@@ -33,8 +33,8 @@ static struct usb_device_id dibusb_dib3000mc_table [] = { ...@@ -33,8 +33,8 @@ static struct usb_device_id dibusb_dib3000mc_table [] = {
/* 05 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_WARM) }, /* 05 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_WARM) },
/* 06 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_COLD) }, /* 06 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_COLD) },
/* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_WARM) }, /* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_WARM) },
/* 08 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_COLD) }, /* 08 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_COLD) },
/* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_WARM) }, /* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_WARM) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table); MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table);
......
...@@ -95,16 +95,10 @@ ...@@ -95,16 +95,10 @@
#define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
#define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
/* Tuner types.
These constants shall correspond to the proper AGC values in the array
dib3000mc_agc_tuner[][12] in dib3000mc_priv.h */
#define DIBUSB_TUNER_DEFAULT 1 // a.k.a Panasonic
#define DIBUSB_TUNER_MT2060 4
struct dibusb_state { struct dibusb_state {
struct dib_fe_xfer_ops ops; struct dib_fe_xfer_ops ops;
struct mt2060_state mt2060; struct mt2060_state mt2060;
int mt2060_present;
/* for RC5 remote control */ /* for RC5 remote control */
int old_toggle; int old_toggle;
......
...@@ -10,51 +10,51 @@ ...@@ -10,51 +10,51 @@
#define _DVB_USB_IDS_H_ #define _DVB_USB_IDS_H_
/* Vendor IDs */ /* Vendor IDs */
#define USB_VID_ADSTECH 0x06e1 #define USB_VID_ADSTECH 0x06e1
#define USB_VID_ANCHOR 0x0547 #define USB_VID_ANCHOR 0x0547
#define USB_VID_WIDEVIEW 0x14aa #define USB_VID_WIDEVIEW 0x14aa
#define USB_VID_AVERMEDIA 0x07ca #define USB_VID_AVERMEDIA 0x07ca
#define USB_VID_COMPRO 0x185b #define USB_VID_COMPRO 0x185b
#define USB_VID_COMPRO_UNK 0x145f #define USB_VID_COMPRO_UNK 0x145f
#define USB_VID_CYPRESS 0x04b4 #define USB_VID_CYPRESS 0x04b4
#define USB_VID_DIBCOM 0x10b8 #define USB_VID_DIBCOM 0x10b8
#define USB_VID_DVICO 0x0fe9 #define USB_VID_DVICO 0x0fe9
#define USB_VID_EMPIA 0xeb1a #define USB_VID_EMPIA 0xeb1a
#define USB_VID_GRANDTEC 0x5032 #define USB_VID_GRANDTEC 0x5032
#define USB_VID_HANFTEK 0x15f4 #define USB_VID_HANFTEK 0x15f4
#define USB_VID_HAUPPAUGE 0x2040 #define USB_VID_HAUPPAUGE 0x2040
#define USB_VID_HYPER_PALTEK 0x1025 #define USB_VID_HYPER_PALTEK 0x1025
#define USB_VID_KWORLD 0xeb2a #define USB_VID_KWORLD 0xeb2a
#define USB_VID_KYE 0x0458 #define USB_VID_KYE 0x0458
#define USB_VID_MEDION 0x1660 #define USB_VID_MEDION 0x1660
#define USB_VID_PINNACLE 0x2304 #define USB_VID_PINNACLE 0x2304
#define USB_VID_VISIONPLUS 0x13d3 #define USB_VID_VISIONPLUS 0x13d3
#define USB_VID_TWINHAN 0x1822 #define USB_VID_TWINHAN 0x1822
#define USB_VID_ULTIMA_ELECTRONIC 0x05d8 #define USB_VID_ULTIMA_ELECTRONIC 0x05d8
#define USB_VID_LITEON 0x04ca #define USB_VID_LITEON 0x04ca
/* Product IDs */ /* Product IDs */
#define USB_PID_ADSTECH_USB2_COLD 0xa333 #define USB_PID_ADSTECH_USB2_COLD 0xa333
#define USB_PID_ADSTECH_USB2_WARM 0xa334 #define USB_PID_ADSTECH_USB2_WARM 0xa334
#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 #define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800
#define USB_PID_AVERMEDIA_DVBT_USB2_WARM 0xa801 #define USB_PID_AVERMEDIA_DVBT_USB2_WARM 0xa801
#define USB_PID_COMPRO_DVBU2000_COLD 0xd000 #define USB_PID_COMPRO_DVBU2000_COLD 0xd000
#define USB_PID_COMPRO_DVBU2000_WARM 0xd001 #define USB_PID_COMPRO_DVBU2000_WARM 0xd001
#define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c
#define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d
#define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064 #define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064
#define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065 #define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065
#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8
#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9
#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6
#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
#define USB_PID_DIBCOM_STK7700 0x1e14 #define USB_PID_DIBCOM_STK7700 0x1e14
#define USB_PID_DIBCOM_STK7700_REENUM 0x1e15 #define USB_PID_DIBCOM_STK7700_REENUM 0x1e15
#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131
#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
#define USB_PID_KWORLD_VSTREAM_COLD 0x17de #define USB_PID_KWORLD_VSTREAM_COLD 0x17de
#define USB_PID_KWORLD_VSTREAM_WARM 0x17df #define USB_PID_KWORLD_VSTREAM_WARM 0x17df
#define USB_PID_TWINHAN_VP7041_COLD 0x3201 #define USB_PID_TWINHAN_VP7041_COLD 0x3201
...@@ -69,23 +69,23 @@ ...@@ -69,23 +69,23 @@
#define USB_PID_DNTV_TINYUSB2_WARM 0x3224 #define USB_PID_DNTV_TINYUSB2_WARM 0x3224
#define USB_PID_ULTIMA_TVBOX_COLD 0x8105 #define USB_PID_ULTIMA_TVBOX_COLD 0x8105
#define USB_PID_ULTIMA_TVBOX_WARM 0x8106 #define USB_PID_ULTIMA_TVBOX_WARM 0x8106
#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107
#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108
#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235
#define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109
#define USB_PID_ULTIMA_TVBOX_USB2_WARM 0x810a #define USB_PID_ULTIMA_TVBOX_USB2_WARM 0x810a
#define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613
#define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002
#define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e
#define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f
#define USB_PID_HANFTEK_UMT_010_COLD 0x0001 #define USB_PID_HANFTEK_UMT_010_COLD 0x0001
#define USB_PID_HANFTEK_UMT_010_WARM 0x0015 #define USB_PID_HANFTEK_UMT_010_WARM 0x0015
#define USB_PID_DTT200U_COLD 0x0201 #define USB_PID_DTT200U_COLD 0x0201
#define USB_PID_DTT200U_WARM 0x0301 #define USB_PID_DTT200U_WARM 0x0301
#define USB_PID_WT220U_COLD 0x0222 #define USB_PID_WT220U_COLD 0x0222
#define USB_PID_WT220U_WARM 0x0221 #define USB_PID_WT220U_WARM 0x0221
#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
#define USB_PID_NEBULA_DIGITV 0x0201 #define USB_PID_NEBULA_DIGITV 0x0201
#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820
#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
#define USB_PID_MEDION_MD95700 0x0932 #define USB_PID_MEDION_MD95700 0x0932
#define USB_PID_KYE_DVB_T_COLD 0x701e #define USB_PID_KYE_DVB_T_COLD 0x701e
#define USB_PID_KYE_DVB_T_WARM 0x701f #define USB_PID_KYE_DVB_T_WARM 0x701f
#define USB_PID_PCTV_200E 0x020e #define USB_PID_PCTV_200E 0x020e
#define USB_PID_PCTV_400E 0x020f #define USB_PID_PCTV_400E 0x020f
#define USB_PID_LITEON_DVB_T_COLD 0xf000 #define USB_PID_LITEON_DVB_T_COLD 0xf000
#define USB_PID_LITEON_DVB_T_WARM 0xf001 #define USB_PID_LITEON_DVB_T_WARM 0xf001
#define USB_PID_DIGIVOX_MINI_SL_COLD 0xe360 #define USB_PID_DIGIVOX_MINI_SL_COLD 0xe360
......
...@@ -26,10 +26,20 @@ ...@@ -26,10 +26,20 @@
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
struct dib3000p_agc_config {
u16 val[12];
};
struct dib3000_config struct dib3000_config
{ {
/* the demodulator's i2c address */ /* the demodulator's i2c address */
u8 demod_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 struct dib_fe_xfer_ops
...@@ -41,28 +51,11 @@ 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); 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, extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); 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, extern struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); 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 #endif // DIB3000_H
...@@ -558,7 +558,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, ...@@ -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) static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
{ {
struct dib3000_state *state = fe->demodulator_priv; 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"); deb_info("init start\n");
state->timing_offset = 0; state->timing_offset = 0;
...@@ -584,11 +584,24 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) ...@@ -584,11 +584,24 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
/* mobile mode - portable reception */ /* mobile mode - portable reception */
wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); 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,dib3000mc_agc_bandwidth);
wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general); 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(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110);
wr(26,0x6680); wr(26,0x6680);
...@@ -824,6 +837,13 @@ static int dib3000mc_demod_init(struct dib3000_state *state) ...@@ -824,6 +837,13 @@ static int dib3000mc_demod_init(struct dib3000_state *state)
return 0; 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; static struct dvb_frontend_ops dib3000mc_ops;
...@@ -878,6 +898,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, ...@@ -878,6 +898,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
kfree(state); kfree(state);
return NULL; return NULL;
} }
EXPORT_SYMBOL(dib3000mc_attach);
static struct dvb_frontend_ops dib3000mc_ops = { static struct dvb_frontend_ops dib3000mc_ops = {
...@@ -916,5 +937,3 @@ static struct dvb_frontend_ops dib3000mc_ops = { ...@@ -916,5 +937,3 @@ static struct dvb_frontend_ops dib3000mc_ops = {
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(dib3000mc_attach);
...@@ -155,41 +155,6 @@ static u16 dib3000mc_imp_noise_ctl[][2] = { ...@@ -155,41 +155,6 @@ static u16 dib3000mc_imp_noise_ctl[][2] = {
{ 0x1294, 0x1ff8 }, /* mode 4 */ { 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 */ /* AGC loop bandwidth */
static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 }; static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 };
static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 }; static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment