diff -Naurp v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c mp-bc1/linux/drivers/media/video/cx88/cx88-dvb.c --- v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c 2006-06-30 19:59:11.000000000 +0400 +++ mp-bc1/linux/drivers/media/video/cx88/cx88-dvb.c 2006-07-23 11:48:40.000000000 +0400 @@ -243,8 +243,8 @@ static int philips_fmd1216_pll_init(stru return 0; } -static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params) +static int dntv_live_dvbt_pro_tuner_set_params_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) { struct cx8802_dev *dev= fe->dvb->priv; u8 buf[4]; @@ -278,6 +278,41 @@ static int dntv_live_dvbt_pro_tuner_set_ return 0; } +static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) +{ + struct cx8802_dev *dev= fe->dvb->priv; + u8 buf[4]; + struct i2c_msg msg = + { .addr = dev->core->pll_addr, .flags = 0, + .buf = buf, .len = 4 }; + int err; + + /* Switch PLL to DVB mode */ + err = philips_fmd1216_pll_init(fe); + if (err) + return err; + + /* Tune PLL */ + dvb_pll_configure(dev->core->pll_desc, buf, + params->frequency, + params->delsys.dvbt.bandwidth); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { + + printk(KERN_WARNING "cx88-dvb: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, dev->core->pll_addr, buf[0], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + return 0; +} + static struct mt352_config dntv_live_dvbt_pro_config = { .demod_address = 0x0f, .no_tuner = 1, @@ -287,8 +322,8 @@ static struct mt352_config dntv_live_dvb #endif #ifdef HAVE_ZL10353 -static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int dvico_hybrid_tuner_set_params_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { u8 pllbuf[4]; struct cx8802_dev *dev= fe->dvb->priv; @@ -316,6 +351,35 @@ static int dvico_hybrid_tuner_set_params return 0; } +static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, + struct dvbfe_params *params) +{ + u8 pllbuf[4]; + struct cx8802_dev *dev= fe->dvb->priv; + struct i2c_msg msg = + { .addr = dev->core->pll_addr, .flags = 0, + .buf = pllbuf, .len = 4 }; + int err; + + dvb_pll_configure(dev->core->pll_desc, pllbuf, + params->frequency, + params->delsys.dvbt.bandwidth); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "cx88-dvb: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, pllbuf[0], pllbuf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + return 0; +} + static struct zl10353_config dvico_fusionhdtv_hybrid = { .demod_address = 0x0F, .no_tuner = 1, @@ -358,8 +422,40 @@ static struct or51132_config pchdtv_hd30 #endif #ifdef HAVE_LGDT330X +static int lgdt3302_tuner_set_params_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + /* FIXME make this routine use the tuner-simple code. + * It could probably be shared with a number of ATSC + * frontends. Many share the same tuner with analog TV. */ + + struct cx8802_dev *dev= fe->dvb->priv; + struct cx88_core *core = dev->core; + u8 buf[4]; + struct i2c_msg msg = + { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 }; + int err; + + dvb_pll_configure(core->pll_desc, buf, params->frequency, 0); + dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", + __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "cx88-dvb: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + return 0; +} + static int lgdt3302_tuner_set_params(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params) + struct dvbfe_params* params) { /* FIXME make this routine use the tuner-simple code. * It could probably be shared with a number of ATSC @@ -390,8 +486,20 @@ static int lgdt3302_tuner_set_params(str return 0; } +static int lgdt3303_tuner_set_params_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct cx8802_dev *dev= fe->dvb->priv; + struct cx88_core *core = dev->core; + + /* Put the analog decoder in standby to keep it quiet */ + cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); + + return lg_h06xf_pll_set_compat(fe, &core->i2c_adap, params); +} + static int lgdt3303_tuner_set_params(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params) + struct dvbfe_params* params) { struct cx8802_dev *dev= fe->dvb->priv; struct cx88_core *core = dev->core; @@ -646,6 +754,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_pro_config, &((struct vp3054_i2c_state *)dev->card_priv)->adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = dntv_live_dvbt_pro_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; } #else @@ -660,6 +769,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = dvico_hybrid_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = dvico_hybrid_tuner_set_params; } break; @@ -694,6 +804,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = lgdt3302_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; } } @@ -713,6 +824,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = lgdt3302_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; } } @@ -730,6 +842,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = lgdt3303_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; } } @@ -747,6 +860,7 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = lgdt330x_attach(&pchdtv_hd5500, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { + dev->dvb.frontend->ops.tuner_ops.set_params_compat = lgdt3303_tuner_set_params_compat; dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; } }
_______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb