summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dibusb-common.c
diff options
context:
space:
mode:
authorOlivier DANET <odanet@caramail.com>2006-08-08 15:48:10 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 11:53:45 -0300
commit46f73f936665ab26c8501634e6aa34464fcc1521 (patch)
tree540ad8149d7460f0d0adf90c9294bc3e59716bf0 /drivers/media/dvb/dvb-usb/dibusb-common.c
parent83fa907963662ecaade803cec4c9c3e14b69ad7d (diff)
V4L/DVB: Update for MT2060 to use dvb_tuner_ops
new tuner api minor fixes for tuning Signed-off-by: Olivier DANET <odanet@caramail.com> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dibusb-common.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c87
1 files changed, 5 insertions, 82 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index a32ff63d170..78a604dfadf 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -168,40 +168,6 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
}
EXPORT_SYMBOL(dibusb_read_eeprom_byte);
-static struct mt2060_config stk3000p_mt2060_config = {
- .i2c_address = 0x60,
-};
-
-static int dibusb_tuner_init(struct dvb_frontend *fe)
-{
- struct dvb_usb_device *d = fe->dvb->priv;
- struct dibusb_state *st = d->priv;
-
- if (d->tuner_pass_ctrl && st->mt2060_present) {
- int ret;
- d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
- ret = mt2060_init(&st->mt2060);
- d->tuner_pass_ctrl(d->fe, 0, 0);
- return ret;
- }
- return dvb_usb_pll_init_i2c(fe);
-}
-
-static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
-{
- struct dvb_usb_device *d = fe->dvb->priv;
- struct dibusb_state *st = d->priv;
-
- if (d->tuner_pass_ctrl && st->mt2060_present) {
- int ret;
- d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
- ret = mt2060_set(&st->mt2060,fep);
- d->tuner_pass_ctrl(d->fe,0,0);
- return ret;
- }
- 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 }
@@ -212,64 +178,21 @@ static const struct dib3000p_agc_config dib3000p_agc_microtune_mt2060 = {
0xa8f6, 0x5eb8, 0x65ff, 0x40ff, 0x8a, 0x1114 }
};
+static struct mt2060_config stk3000p_mt2060_config = {
+ .i2c_address = 0x60,
+};
+
int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d)
{
struct dib3000_config demod_cfg;
struct dibusb_state *st = d->priv;
-
- demod_cfg.agc = &dib3000p_agc_panasonic_env57h1xd5;
- demod_cfg.pll_set = dibusb_tuner_set;
- demod_cfg.pll_init = dibusb_tuner_init;
-
- 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) {
- d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
- return 0;
- }
-
return -ENODEV;
}
EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
{
- int ret;
- u8 a,b;
- u16 if1 = 1220;
-
- if (d->tuner_pass_ctrl) {
- struct dibusb_state *st = d->priv;
- d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address);
- // First IF calibration for Liteon Sticks
- if (d->udev->descriptor.idVendor == USB_VID_LITEON &&
- d->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) {
-
- dibusb_read_eeprom_byte(d,0x7E,&a);
- dibusb_read_eeprom_byte(d,0x7F,&b);
-
- if (a == 0xFF && b == 0xFF)
- if1 = 1220;
- else if (a == 0x00)
- if1 = 1220+b;
- else if (a == 0x80)
- if1 = 1220-b;
- else {
- warn("LITE-ON DVB-T Tuner : Strange IF1 calibration :%2X %2X\n",(int)a,(int)b);
- if1 = 1220;
- }
- }
- if ((ret = mt2060_attach(&st->mt2060,&stk3000p_mt2060_config, &d->i2c_adap,if1)) != 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);
- }
- return 0;
+ return -ENODEV;
}
EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);