diff -r 76b92a337aec linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c --- a/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c Mon Jun 18 14:27:55 2007 +0200 @@ -170,11 +170,12 @@ static int samsung_tbmu24112_set_symbol_ return 0; } -static int samsung_tbmu24112_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) +static int samsung_tbmu24112_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) { u8 buf[4]; u32 div; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + struct dvb_frontend *fe = ops->fe; struct flexcop_device *fc = fe->dvb->priv; div = params->frequency / 125; @@ -271,7 +272,7 @@ static int samsung_tdtc9251dh0_demod_ini return 0; } -static int samsung_tdtc9251dh0_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len) +static int samsung_tdtc9251dh0_calc_regs(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params, u8* pllbuf, int buf_len) { u32 div; unsigned char bs = 0; @@ -322,11 +323,12 @@ static struct bcm3510_config air2pc_atsc .request_firmware = flexcop_fe_request_firmware, }; -static int skystar23_samsung_tbdu18132_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) +static int skystar23_samsung_tbdu18132_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) { u8 buf[4]; u32 div; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + struct dvb_frontend *fe = ops->fe; struct flexcop_device *fc = fe->dvb->priv; div = (params->frequency + (125/2)) / 125; @@ -351,9 +353,10 @@ static struct mt312_config skystar23_sam .demod_address = 0x0e, }; -static int alps_tdee4_stv0297_tuner_set_params(struct dvb_frontend* fe, - struct dvb_frontend_parameters *fep) -{ +static int alps_tdee4_stv0297_tuner_set_params(struct v4l_dvb_tuner_ops* ops, + struct dvb_int_frontend_parameters *fep) +{ + struct dvb_frontend *fe = ops->fe; struct flexcop_device *fc = fe->dvb->priv; u8 buf[4]; u16 div; @@ -492,6 +495,7 @@ int flexcop_frontend_init(struct flexcop if ((fc->fe = dvb_attach(stv0299_attach, &samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) { ops = &fc->fe->ops; + ops->tuner_ops.fe = fc->fe; ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params; ops->set_voltage = flexcop_set_voltage; @@ -505,19 +509,22 @@ int flexcop_frontend_init(struct flexcop /* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */ if ((fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) { fc->dev_type = FC_AIR_DVB; + fc->fe->ops.tuner_ops.fe = fc->fe; fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); } else /* try the air atsc 2nd generation (nxt2002) */ if ((fc->fe = dvb_attach(nxt200x_attach, &samsung_tbmv_config, &fc->i2c_adap)) != NULL) { fc->dev_type = FC_AIR_ATSC2; - dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL, &dvb_pll_samsung_tbmv); + fc->fe->ops.tuner_ops.fe = fc->fe; + dvb_attach(dvb_pll_attach, &fc->fe->ops.tuner_ops, 0x61, NULL, &dvb_pll_samsung_tbmv); info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); } else /* try the air atsc 3nd generation (lgdt3303) */ if ((fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) { fc->dev_type = FC_AIR_ATSC3; - dvb_attach(dvb_pll_attach, fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_lg_tdvs_h06xf); + fc->fe->ops.tuner_ops.fe = fc->fe; + dvb_attach(dvb_pll_attach, &fc->fe->ops.tuner_ops, 0x61, &fc->i2c_adap, &dvb_pll_lg_tdvs_h06xf); info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address); } else /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ @@ -532,6 +539,7 @@ int flexcop_frontend_init(struct flexcop if ((fc->fe = dvb_attach(stv0297_attach, &alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) { #endif fc->dev_type = FC_CABLE; + fc->fe->ops.tuner_ops.fe = fc->fe; fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); } else @@ -539,6 +547,7 @@ int flexcop_frontend_init(struct flexcop if ((fc->fe = dvb_attach(vp310_mt312_attach, &skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) { ops = &fc->fe->ops; + ops->tuner_ops.fe = fc->fe; ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params; ops->diseqc_send_master_cmd = flexcop_diseqc_send_master_cmd; diff -r 76b92a337aec linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c --- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c Mon Jun 18 14:27:55 2007 +0200 @@ -148,7 +148,7 @@ static int thomson_dtt7579_demod_init(st return 0; } -static int thomson_dtt7579_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len) +static int thomson_dtt7579_tuner_calc_regs(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params, u8* pllbuf, int buf_len) { u32 div; unsigned char bs = 0; @@ -191,8 +191,9 @@ static struct zl10353_config thomson_dtt .demod_address = 0x0f, }; -static int cx24108_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int cx24108_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; u32 freq = params->frequency; int i, a, n, pump; @@ -244,8 +245,9 @@ static int cx24108_tuner_set_params(stru return 0; } -static int pinnsat_tuner_init(struct dvb_frontend* fe) -{ +static int pinnsat_tuner_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_bt8xx_card *card = fe->dvb->priv; bttv_gpio_enable(card->bttv_nr, 1, 1); /* output */ @@ -254,8 +256,9 @@ static int pinnsat_tuner_init(struct dvb return 0; } -static int pinnsat_tuner_sleep(struct dvb_frontend* fe) -{ +static int pinnsat_tuner_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_bt8xx_card *card = fe->dvb->priv; bttv_write_gpio(card->bttv_nr, 1, 0); /* relay off */ @@ -267,8 +270,9 @@ static struct cx24110_config pctvsat_con .demod_address = 0x55, }; -static int microtune_mt7202dtf_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int microtune_mt7202dtf_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; u8 cfg, cpump, band_select; u8 data[4]; @@ -342,7 +346,7 @@ static int advbt771_samsung_tdtc9251dh0_ return 0; } -static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len) +static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params, u8* pllbuf, int buf_len) { u32 div; unsigned char bs = 0; @@ -461,8 +465,9 @@ static struct or51211_config or51211_con .sleep = or51211_sleep, }; -static int vp3021_alps_tded4_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int vp3021_alps_tded4_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; u8 buf[4]; u32 div; @@ -513,7 +518,7 @@ static int digitv_alps_tded4_demod_init( return 0; } -static int digitv_alps_tded4_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len) +static int digitv_alps_tded4_tuner_calc_regs(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params, u8* pllbuf, int buf_len) { u32 div; struct dvb_ofdm_parameters *op = ¶ms->u.ofdm; @@ -601,6 +606,7 @@ static void frontend_init(struct dvb_bt8 card->i2c_adapter); if (card->fe != NULL) { + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.calc_regs = thomson_dtt7579_tuner_calc_regs; card->fe->ops.info.frequency_min = 174000000; card->fe->ops.info.frequency_max = 862000000; @@ -611,7 +617,8 @@ static void frontend_init(struct dvb_bt8 lgdt330x_reset(card); card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter); if (card->fe != NULL) { - dvb_attach(dvb_pll_attach, card->fe, 0x61, + card->fe->ops.tuner_ops.fe = card->fe; + dvb_attach(dvb_pll_attach, &card->fe->ops.tuner_ops, 0x61, card->i2c_adapter, &dvb_pll_lg_tdvs_h06xf); dprintk ("dvb_bt8xx: lgdt330x detected\n"); } @@ -627,6 +634,7 @@ static void frontend_init(struct dvb_bt8 digitv_alps_tded4_reset(card); card->fe = dvb_attach(nxt6000_attach, &vp3021_alps_tded4_config, card->i2c_adapter); if (card->fe != NULL) { + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params; dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); break; @@ -637,6 +645,7 @@ static void frontend_init(struct dvb_bt8 card->fe = dvb_attach(mt352_attach, &digitv_alps_tded4_config, card->i2c_adapter); if (card->fe != NULL) { + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.calc_regs = digitv_alps_tded4_tuner_calc_regs; dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n"); } @@ -645,6 +654,7 @@ static void frontend_init(struct dvb_bt8 case BTTV_BOARD_AVDVBT_761: card->fe = dvb_attach(sp887x_attach, µtune_mt7202dtf_config, card->i2c_adapter); if (card->fe) { + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params; } break; @@ -652,6 +662,7 @@ static void frontend_init(struct dvb_bt8 case BTTV_BOARD_AVDVBT_771: card->fe = dvb_attach(mt352_attach, &advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); if (card->fe != NULL) { + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs; card->fe->ops.info.frequency_min = 174000000; card->fe->ops.info.frequency_max = 862000000; @@ -687,6 +698,7 @@ static void frontend_init(struct dvb_bt8 if (card->fe) { card->fe->ops.tuner_ops.init = pinnsat_tuner_init; card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep; + card->fe->ops.tuner_ops.fe = card->fe; card->fe->ops.tuner_ops.set_params = cx24108_tuner_set_params; } break; diff -r 76b92a337aec linux/drivers/media/dvb/dvb-core/dvb_frontend.c --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c Mon Jun 18 14:27:55 2007 +0200 @@ -224,7 +224,8 @@ static void dvb_frontend_init(struct dvb if (fe->ops.init) fe->ops.init(fe); if (fe->ops.tuner_ops.init) { - fe->ops.tuner_ops.init(fe); + fe->ops.tuner_ops.fe = fe; + fe->ops.tuner_ops.init(&fe->ops.tuner_ops); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } @@ -583,7 +584,7 @@ restart: if (fe->ops.set_voltage) fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); if (fe->ops.tuner_ops.sleep) { - fe->ops.tuner_ops.sleep(fe); + fe->ops.tuner_ops.sleep(&fe->ops.tuner_ops); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } @@ -1133,7 +1134,7 @@ void dvb_frontend_detach(struct dvb_fron symbol_put_addr(fe->ops.release_sec); } if (fe->ops.tuner_ops.release) { - fe->ops.tuner_ops.release(fe); + fe->ops.tuner_ops.release(&fe->ops.tuner_ops); symbol_put_addr(fe->ops.tuner_ops.release); } ptr = (void*)fe->ops.release; diff -r 76b92a337aec linux/drivers/media/dvb/dvb-core/dvb_frontend.h --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Mon Jun 18 14:27:55 2007 +0200 @@ -39,6 +39,7 @@ #include #include "dvbdev.h" +#include struct dvb_frontend_tune_settings { int min_delay_ms; @@ -48,44 +49,6 @@ struct dvb_frontend_tune_settings { }; struct dvb_frontend; - -struct dvb_tuner_info { - char name[128]; - - u32 frequency_min; - u32 frequency_max; - u32 frequency_step; - - u32 bandwidth_min; - u32 bandwidth_max; - u32 bandwidth_step; -}; - -struct dvb_tuner_ops { - - struct dvb_tuner_info info; - - int (*release)(struct dvb_frontend *fe); - int (*init)(struct dvb_frontend *fe); - int (*sleep)(struct dvb_frontend *fe); - - /** This is for simple PLLs - set all parameters in one go. */ - int (*set_params)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); - - /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */ - int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len); - - int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency); - int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); - -#define TUNER_STATUS_LOCKED 1 - int (*get_status)(struct dvb_frontend *fe, u32 *status); - - /** These are provided seperately from set_params in order to facilitate silicon - * tuners which require sophisticated tuning loops, controlling each parameter seperately. */ - int (*set_frequency)(struct dvb_frontend *fe, u32 frequency); - int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); -}; struct dvb_frontend_ops { @@ -131,7 +94,7 @@ struct dvb_frontend_ops { int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire); - struct dvb_tuner_ops tuner_ops; + struct v4l_dvb_tuner_ops tuner_ops; }; #define MAX_EVENT 8 @@ -164,6 +127,7 @@ extern void dvb_frontend_reinitialise(st extern void dvb_frontend_reinitialise(struct dvb_frontend *fe); extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); +extern int dvb_frontend_eventstatus(struct dvb_frontend *fe); extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); #endif diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/af9005-fe.c --- a/linux/drivers/media/dvb/dvb-usb/af9005-fe.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/af9005-fe.c Mon Jun 18 14:27:55 2007 +0200 @@ -1152,8 +1152,9 @@ static int af9005_fe_init(struct dvb_fro return ret; } if1 = (u16) (buf[0] << 8) + buf[1]; + fe->ops.tuner_ops.fe = fe; state->tuner = - dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap, + dvb_attach(mt2060_attach, &fe->ops.tuner_ops, &adap->dev->i2c_adap, &af9005_mt2060_config, if1); if (state->tuner == NULL) { deb_info("MT2060 attach failed\n"); @@ -1162,8 +1163,9 @@ static int af9005_fe_init(struct dvb_fro break; case 3: /* QT1010 */ case 9: /* QT1010B */ + fe->ops.tuner_ops.fe = fe; state->tuner = - dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap, + dvb_attach(qt1010_attach, &fe->ops.tuner_ops, &adap->dev->i2c_adap, &af9005_qt1010_config); if (state->tuner == NULL) { deb_info("QT1010 attach failed\n"); @@ -1174,7 +1176,7 @@ static int af9005_fe_init(struct dvb_fro err("Unsupported tuner type %d", buf[0]); return -ENODEV; } - ret = state->tuner->ops.tuner_ops.init(state->tuner); + ret = state->tuner->ops.tuner_ops.init(&state->tuner->ops.tuner_ops); if (ret) return ret; } @@ -1300,7 +1302,7 @@ static int af9005_fe_set_frontend(struct #endif /* set tuner */ deb_info("set tuner\n"); - ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep); + ret = state->tuner->ops.tuner_ops.set_params(&state->tuner->ops.tuner_ops, V4L_OPS(fep)); if (ret) return ret; @@ -1577,7 +1579,7 @@ static void af9005_fe_release(struct dvb struct af9005_fe_state *state = (struct af9005_fe_state *)fe->demodulator_priv; if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) { - state->tuner->ops.tuner_ops.release(state->tuner); + state->tuner->ops.tuner_ops.release(&state->tuner->ops.tuner_ops); #ifdef CONFIG_DVB_CORE_ATTACH symbol_put_addr(state->tuner->ops.tuner_ops.release); #endif diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/au6610.c --- a/linux/drivers/media/dvb/dvb-usb/au6610.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/au6610.c Mon Jun 18 14:27:55 2007 +0200 @@ -145,8 +145,9 @@ static struct qt1010_config au6610_qt101 static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; return dvb_attach(qt1010_attach, - adap->fe, &adap->dev->i2c_adap, + &adap->fe->ops.tuner_ops, &adap->dev->i2c_adap, &au6610_qt1010_config) == NULL ? -ENODEV : 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/cxusb.c --- a/linux/drivers/media/dvb/dvb-usb/cxusb.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c Mon Jun 18 14:27:55 2007 +0200 @@ -354,34 +354,40 @@ static struct mt352_config cxusb_mt352_c /* Callbacks for DVB USB */ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, - &dvb_pll_fmd1216me); + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, &adap->dev->i2c_adap, + &dvb_pll_fmd1216me); + return 0; } static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, NULL, &dvb_pll_thomson_dtt7579); return 0; } static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, &dvb_pll_lg_z201); + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, NULL, &dvb_pll_lg_z201); return 0; } static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x60, + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x60, NULL, &dvb_pll_thomson_dtt7579); return 0; } static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, &adap->dev->i2c_adap, &dvb_pll_lg_tdvs_h06xf); return 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dib0700_devices.c --- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c Mon Jun 18 14:32:34 2007 +0200 @@ -92,7 +92,8 @@ static int bristol_tuner_attach(struct d { struct dib0700_state *st = adap->dev->priv; struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); - return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id], + adap->fe->ops.tuner_ops.fe = adap->fe; + return dvb_attach(mt2060_attach,&adap->fe->ops.tuner_ops, tun_i2c, &bristol_mt2060_config[adap->id], st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0; } @@ -263,7 +264,8 @@ static int stk7700p_tuner_attach(struct else tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); - return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config, + adap->fe->ops.tuner_ops.fe = adap->fe; + return dvb_attach(mt2060_attach, &adap->fe->ops.tuner_ops, tun_i2c, &stk7700p_mt2060_config, st->mt2060_if1[0]) == NULL ? -ENODEV : 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dibusb-common.c --- a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c Mon Jun 18 14:27:55 2007 +0200 @@ -293,9 +293,11 @@ int dibusb_dib3000mc_tuner_attach(struct } tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); - if (dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) { + adap->fe->ops.tuner_ops.fe = adap->fe; + if (dvb_attach(mt2060_attach, &adap->fe->ops.tuner_ops, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) { /* not found - use panasonic pll parameters */ - if (dvb_attach(dvb_pll_attach, adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) + adap->fe->ops.tuner_ops.fe = adap->fe; + if (dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) return -ENOMEM; } else { st->mt2060_present = 1; diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dibusb-mb.c --- a/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c Mon Jun 18 14:27:55 2007 +0200 @@ -32,14 +32,16 @@ static int dibusb_dib3000mb_frontend_att static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, &adap->dev->i2c_adap, &dvb_pll_tua6010xs); return 0; } static int dibusb_panasonic_tuner_attach(struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x60, &adap->dev->i2c_adap, + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x60, &adap->dev->i2c_adap, &dvb_pll_tda665x); return 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/digitv.c --- a/linux/drivers/media/dvb/dvb-usb/digitv.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/digitv.c Mon Jun 18 14:27:55 2007 +0200 @@ -114,11 +114,12 @@ static struct mt352_config digitv_mt352_ .demod_init = digitv_mt352_demod_init, }; -static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) -{ +static int digitv_nxt6000_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *fep) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_usb_adapter *adap = fe->dvb->priv; u8 b[5]; - dvb_usb_tuner_calc_regs(fe,fep,b, 5); + dvb_usb_tuner_calc_regs(&fe->ops.tuner_ops,fep,b, 5); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); @@ -131,10 +132,12 @@ static int digitv_frontend_attach(struct static int digitv_frontend_attach(struct dvb_usb_adapter *adap) { if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) { + adap->fe->ops.tuner_ops.fe = adap->fe; adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; return 0; } if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) { + adap->fe->ops.tuner_ops.fe = adap->fe; adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; return 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c Mon Jun 18 14:27:55 2007 +0200 @@ -47,8 +47,9 @@ int dvb_usb_i2c_exit(struct dvb_usb_devi return 0; } -int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe) +int dvb_usb_tuner_init_i2c(struct v4l_dvb_tuner_ops *ops) { + struct dvb_frontend *fe = ops->fe; struct dvb_usb_adapter *adap = fe->dvb->priv; struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = adap->pll_init, .len = 4 }; int ret = 0; @@ -78,8 +79,9 @@ int dvb_usb_tuner_init_i2c(struct dvb_fr } EXPORT_SYMBOL(dvb_usb_tuner_init_i2c); -int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len) +int dvb_usb_tuner_calc_regs(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *fep, u8 *b, int buf_len) { + struct dvb_frontend *fe = ops->fe; struct dvb_usb_adapter *adap = fe->dvb->priv; if (buf_len != 5) @@ -98,14 +100,15 @@ int dvb_usb_tuner_calc_regs(struct dvb_f } EXPORT_SYMBOL(dvb_usb_tuner_calc_regs); -int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) +int dvb_usb_tuner_set_params_i2c(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *fep) { + struct dvb_frontend *fe = ops->fe; struct dvb_usb_adapter *adap = fe->dvb->priv; int ret = 0; u8 b[5]; struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; - dvb_usb_tuner_calc_regs(fe,fep,b,5); + dvb_usb_tuner_calc_regs(ops,fep,b,5); if (adap->tuner_pass_ctrl) adap->tuner_pass_ctrl(fe, 1, adap->pll_addr); diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dvb-usb.h --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h Mon Jun 18 14:27:55 2007 +0200 @@ -226,7 +226,7 @@ struct dvb_usb_device_properties { int generic_bulk_ctrl_endpoint; int num_device_descs; - struct dvb_usb_device_description devices[9]; + struct dvb_usb_device_description devices[10]; }; /** @@ -404,9 +404,9 @@ extern int dvb_usb_nec_rc_key_to_event(s extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); /* commonly used pll init and set functions */ -extern int dvb_usb_tuner_init_i2c(struct dvb_frontend *); -extern int dvb_usb_tuner_calc_regs(struct dvb_frontend *, struct dvb_frontend_parameters *, u8 *buf, int buf_len); -extern int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); +extern int dvb_usb_tuner_init_i2c(struct v4l_dvb_tuner_ops *); +extern int dvb_usb_tuner_calc_regs(struct v4l_dvb_tuner_ops *, struct dvb_int_frontend_parameters *, u8 *buf, int buf_len); +extern int dvb_usb_tuner_set_params_i2c(struct v4l_dvb_tuner_ops *, struct dvb_int_frontend_parameters *); /* commonly used firmware download types and function */ struct hexline { diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/gl861.c --- a/linux/drivers/media/dvb/dvb-usb/gl861.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/gl861.c Mon Jun 18 14:27:55 2007 +0200 @@ -122,8 +122,9 @@ static struct qt1010_config gl861_qt1010 static int gl861_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; return dvb_attach(qt1010_attach, - adap->fe, &adap->dev->i2c_adap, + &adap->fe->ops.tuner_ops, &adap->dev->i2c_adap, &gl861_qt1010_config) == NULL ? -ENODEV : 0; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/m920x.c --- a/linux/drivers/media/dvb/dvb-usb/m920x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/m920x.c Mon Jun 18 14:27:55 2007 +0200 @@ -513,9 +513,12 @@ static int m920x_tda10046_0b_frontend_at static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; + deb("%s\n",__FUNCTION__); - if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) + if (dvb_attach(qt1010_attach, &adap->fe->ops.tuner_ops, &adap->dev->i2c_adap, + &m920x_qt1010_config) == NULL) return -ENODEV; return 0; @@ -523,9 +526,11 @@ static int m920x_qt1010_tuner_attach(str static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; + deb("%s\n",__FUNCTION__); - if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) + if (dvb_attach(tda827x_attach, &adap->fe->ops.tuner_ops, 0x60, &adap->dev->i2c_adap, NULL) == NULL) return -ENODEV; return 0; @@ -533,9 +538,12 @@ static int m920x_tda8275_60_tuner_attach static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; + deb("%s\n",__FUNCTION__); - if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) + if (dvb_attach(tda827x_attach, &adap->fe->ops.tuner_ops, 0x60, &adap->dev->i2c_adap, + NULL) == NULL) return -ENODEV; return 0; diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/opera1.c --- a/linux/drivers/media/dvb/dvb-usb/opera1.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/opera1.c Mon Jun 18 14:27:55 2007 +0200 @@ -272,8 +272,9 @@ static int opera1_frontend_attach(struct static int opera1_tuner_attach(struct dvb_usb_adapter *adap) { + adap->fe->ops.tuner_ops.fe = adap->fe; dvb_attach( - dvb_pll_attach, adap->fe, 0xc0>>1, + dvb_pll_attach, &adap->fe->ops.tuner_ops, 0xc0>>1, &adap->dev->i2c_adap, &dvb_pll_opera1 ); return 0; diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/ttusb2.c --- a/linux/drivers/media/dvb/dvb-usb/ttusb2.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/ttusb2.c Mon Jun 18 14:27:55 2007 +0200 @@ -167,7 +167,8 @@ static int ttusb2_frontend_attach(struct static int ttusb2_tuner_attach(struct dvb_usb_adapter *adap) { - if (dvb_attach(tda826x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, 0) == NULL) { + adap->fe->ops.tuner_ops.fe = adap->fe; + if (dvb_attach(tda826x_attach, &adap->fe->ops.tuner_ops, 0x60, &adap->dev->i2c_adap, 0) == NULL) { deb_info("TDA8263 attach failed\n"); return -ENODEV; } diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/umt-010.c --- a/linux/drivers/media/dvb/dvb-usb/umt-010.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/dvb-usb/umt-010.c Mon Jun 18 14:27:55 2007 +0200 @@ -65,7 +65,8 @@ static int umt_mt352_frontend_attach(str static int umt_tuner_attach (struct dvb_usb_adapter *adap) { - dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, &dvb_pll_tua6034); + adap->fe->ops.tuner_ops.fe = adap->fe; + dvb_attach(dvb_pll_attach, &adap->fe->ops.tuner_ops, 0x61, NULL, &dvb_pll_tua6034); return 0; } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/at76c651.c --- a/linux/drivers/media/dvb/frontends/at76c651.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/at76c651.c Mon Jun 18 14:27:55 2007 +0200 @@ -245,7 +245,7 @@ static int at76c651_set_parameters(struc struct at76c651_state* state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(fe, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/bsbe1.h --- a/linux/drivers/media/dvb/frontends/bsbe1.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/bsbe1.h Mon Jun 18 14:27:55 2007 +0200 @@ -89,11 +89,12 @@ static int alps_bsbe1_set_symbol_rate(st return 0; } -static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) +static int alps_bsbe1_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) { int ret; u8 data[4]; u32 div; + struct dvb_frontend *fe = ops->fe; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; struct i2c_adapter *i2c = fe->tuner_priv; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/bsru6.h --- a/linux/drivers/media/dvb/frontends/bsru6.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/bsru6.h Mon Jun 18 14:27:55 2007 +0200 @@ -101,10 +101,11 @@ static int alps_bsru6_set_symbol_rate(st return 0; } -static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int alps_bsru6_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) { u8 buf[4]; u32 div; + struct dvb_frontend *fe = ops->fe; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; struct i2c_adapter *i2c = fe->tuner_priv; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/cx22700.c --- a/linux/drivers/media/dvb/frontends/cx22700.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/cx22700.c Mon Jun 18 14:27:55 2007 +0200 @@ -327,7 +327,7 @@ static int cx22700_set_frontend(struct d cx22700_writereg (state, 0x00, 0x00); if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/cx22702.c --- a/linux/drivers/media/dvb/frontends/cx22702.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/cx22702.c Mon Jun 18 14:27:55 2007 +0200 @@ -209,7 +209,7 @@ static int cx22702_set_tps (struct dvb_f struct cx22702_state* state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/cx24110.c --- a/linux/drivers/media/dvb/frontends/cx24110.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/cx24110.c Mon Jun 18 14:27:55 2007 +0200 @@ -538,7 +538,7 @@ static int cx24110_set_frontend(struct d if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dib3000mb.c --- a/linux/drivers/media/dvb/frontends/dib3000mb.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dib3000mb.c Mon Jun 18 14:27:55 2007 +0200 @@ -132,7 +132,7 @@ static int dib3000mb_set_frontend(struct int search_state, seq; if (tuner && fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, fep); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fep)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); deb_setf("bandwidth: "); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dib3000mc.c --- a/linux/drivers/media/dvb/frontends/dib3000mc.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dib3000mc.c Mon Jun 18 14:27:55 2007 +0200 @@ -674,7 +674,7 @@ static int dib3000mc_set_frontend(struct dib3000mc_set_bandwidth(fe, fep->u.ofdm.bandwidth); if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, fep); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fep)); msleep(100); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dib7000m.c --- a/linux/drivers/media/dvb/frontends/dib7000m.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dib7000m.c Mon Jun 18 14:27:55 2007 +0200 @@ -1010,7 +1010,7 @@ static int dib7000m_set_frontend(struct dib7000m_set_bandwidth(fe, fep->u.ofdm.bandwidth); if (fe->ops.tuner_ops.set_params) - fe->ops.tuner_ops.set_params(fe, fep); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fep)); if (fep->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO || fep->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO || diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dib7000p.c --- a/linux/drivers/media/dvb/frontends/dib7000p.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dib7000p.c Mon Jun 18 14:27:55 2007 +0200 @@ -801,7 +801,7 @@ static int dib7000p_set_frontend(struct dib7000p_set_bandwidth(fe, fep->u.ofdm.bandwidth); if (fe->ops.tuner_ops.set_params) - fe->ops.tuner_ops.set_params(fe, fep); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fep)); if (fep->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO || fep->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO || diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dvb-pll.c --- a/linux/drivers/media/dvb/frontends/dvb-pll.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c Mon Jun 18 14:27:55 2007 +0200 @@ -75,7 +75,7 @@ EXPORT_SYMBOL(dvb_pll_thomson_dtt7610); EXPORT_SYMBOL(dvb_pll_thomson_dtt7610); static void thomson_dtt759x_bw(u8 *buf, - const struct dvb_frontend_parameters *params) + const struct dvb_int_frontend_parameters *params) { if (BANDWIDTH_7_MHZ == params->u.ofdm.bandwidth) buf[3] |= 0x10; @@ -202,7 +202,7 @@ EXPORT_SYMBOL(dvb_pll_env57h1xd5); /* Philips TDA6650/TDA6651 * used in Panasonic ENV77H11D5 */ -static void tda665x_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void tda665x_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) buf[3] |= 0x08; @@ -236,7 +236,7 @@ EXPORT_SYMBOL(dvb_pll_tda665x); /* Infineon TUA6034 * used in LG TDTP E102P */ -static void tua6034_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void tua6034_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { if (BANDWIDTH_7_MHZ != params->u.ofdm.bandwidth) buf[3] |= 0x08; @@ -278,7 +278,7 @@ EXPORT_SYMBOL(dvb_pll_lg_tdvs_h06xf); /* Philips FMD1216ME * used in Medion Hybrid PCMCIA card and USB Box */ -static void fmd1216me_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void fmd1216me_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ && params->frequency >= 158870000) @@ -309,7 +309,7 @@ EXPORT_SYMBOL(dvb_pll_fmd1216me); /* ALPS TDED4 * used in Nebula-Cards and USB boxes */ -static void tded4_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void tded4_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) buf[3] |= 0x04; @@ -352,7 +352,7 @@ EXPORT_SYMBOL(dvb_pll_tdhu2); /* Philips TUV1236D * used in ATI HDTV Wonder */ -static void tuv1236d_rf(u8 *buf, const struct dvb_frontend_parameters *params) +static void tuv1236d_rf(u8 *buf, const struct dvb_int_frontend_parameters *params) { switch (params->u.vsb.modulation) { case QAM_64: @@ -421,7 +421,7 @@ EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda /* * Philips TD1316 Tuner. */ -static void td1316_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void td1316_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { u8 band; @@ -476,7 +476,7 @@ struct dvb_pll_desc dvb_pll_thomson_fe66 } }; EXPORT_SYMBOL(dvb_pll_thomson_fe6600); -static void opera1_bw(u8 *buf, const struct dvb_frontend_parameters *params) +static void opera1_bw(u8 *buf, const struct dvb_int_frontend_parameters *params) { if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) buf[2] |= 0x08; @@ -523,7 +523,7 @@ MODULE_PARM_DESC(debug, "enable verbose MODULE_PARM_DESC(debug, "enable verbose debug messages"); int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, - const struct dvb_frontend_parameters *params) + const struct dvb_int_frontend_parameters *params) { u32 div; int i; @@ -563,15 +563,17 @@ int dvb_pll_configure(struct dvb_pll_des } EXPORT_SYMBOL(dvb_pll_configure); -static int dvb_pll_release(struct dvb_frontend *fe) -{ +static int dvb_pll_release(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; kfree(fe->tuner_priv); fe->tuner_priv = NULL; return 0; } -static int dvb_pll_sleep(struct dvb_frontend *fe) -{ +static int dvb_pll_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; if (priv->i2c == NULL) @@ -596,9 +598,10 @@ static int dvb_pll_sleep(struct dvb_fron return -EINVAL; } -static int dvb_pll_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int dvb_pll_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; u8 buf[4]; struct i2c_msg msg = @@ -627,10 +630,11 @@ static int dvb_pll_set_params(struct dvb return 0; } -static int dvb_pll_calc_regs(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params, +static int dvb_pll_calc_regs(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params, u8 *buf, int buf_len) { + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; int result; u32 frequency = 0; @@ -651,22 +655,25 @@ static int dvb_pll_calc_regs(struct dvb_ return 5; } -static int dvb_pll_get_frequency(struct dvb_frontend *fe, u32 *frequency) -{ +static int dvb_pll_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static int dvb_pll_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) -{ +static int dvb_pll_get_bandwidth(struct v4l_dvb_tuner_ops *ops, u32 *bandwidth) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; *bandwidth = priv->bandwidth; return 0; } -static int dvb_pll_init(struct dvb_frontend *fe) -{ +static int dvb_pll_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct dvb_pll_priv *priv = fe->tuner_priv; if (priv->i2c == NULL) @@ -690,7 +697,7 @@ static int dvb_pll_init(struct dvb_front return -EINVAL; } -static struct dvb_tuner_ops dvb_pll_tuner_ops = { +static struct v4l_dvb_tuner_ops dvb_pll_tuner_ops = { .release = dvb_pll_release, .sleep = dvb_pll_sleep, .init = dvb_pll_init, @@ -700,7 +707,7 @@ static struct dvb_tuner_ops dvb_pll_tune .get_bandwidth = dvb_pll_get_bandwidth, }; -struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, +struct v4l_dvb_tuner_ops *dvb_pll_attach(struct v4l_dvb_tuner_ops *ops, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) { @@ -708,6 +715,7 @@ struct dvb_frontend *dvb_pll_attach(stru struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 }; struct dvb_pll_priv *priv = NULL; + struct dvb_frontend *fe = ops->fe; int ret; if (i2c != NULL) { @@ -729,8 +737,7 @@ struct dvb_frontend *dvb_pll_attach(stru priv->i2c = i2c; priv->pll_desc = desc; - memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops, - sizeof(struct dvb_tuner_ops)); + tuner_cpy((&fe->ops.tuner_ops), dvb_pll_tuner_ops); strncpy(fe->ops.tuner_ops.info.name, desc->name, sizeof(fe->ops.tuner_ops.info.name)); @@ -742,7 +749,7 @@ struct dvb_frontend *dvb_pll_attach(stru fe->ops.tuner_ops.sleep = NULL; fe->tuner_priv = priv; - return fe; + return ops; } EXPORT_SYMBOL(dvb_pll_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dvb-pll.h --- a/linux/drivers/media/dvb/frontends/dvb-pll.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dvb-pll.h Mon Jun 18 14:27:55 2007 +0200 @@ -13,7 +13,7 @@ struct dvb_pll_desc { u32 min; u32 max; u32 iffreq; - void (*set)(u8 *buf, const struct dvb_frontend_parameters *params); + void (*set)(u8 *buf, const struct dvb_int_frontend_parameters *params); u8 *initdata; u8 *sleepdata; int count; @@ -51,7 +51,7 @@ extern struct dvb_pll_desc dvb_pll_opera extern struct dvb_pll_desc dvb_pll_opera1; extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, - const struct dvb_frontend_parameters *params); + const struct dvb_int_frontend_parameters *params); /** * Attach a dvb-pll to the supplied frontend structure. @@ -63,15 +63,14 @@ extern int dvb_pll_configure(struct dvb_ * @return Frontend pointer on success, NULL on failure */ #if defined(CONFIG_DVB_PLL) || (defined(CONFIG_DVB_PLL_MODULE) && defined(MODULE)) -extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, - int pll_addr, - struct i2c_adapter *i2c, - struct dvb_pll_desc *desc); +extern struct v4l_dvb_tuner_ops *dvb_pll_attach(struct v4l_dvb_tuner_ops *ops, int pll_addr, + struct i2c_adapter *i2c, + struct dvb_pll_desc *desc); #else -static inline struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, - int pll_addr, - struct i2c_adapter *i2c, - struct dvb_pll_desc *desc) +static inline struct v4l_dvb_tuner_ops *dvb_pll_attach(struct v4l_dvb_tuner_ops *ops, + int pll_addr, + struct i2c_adapter *i2c, + struct dvb_pll_desc *desc) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); return NULL; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/dvb_dummy_fe.c --- a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c Mon Jun 18 14:27:55 2007 +0200 @@ -77,7 +77,7 @@ static int dvb_dummy_fe_set_frontend(str static int dvb_dummy_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { if (fe->ops->tuner_ops->set_params) { - fe->ops->tuner_ops->set_params(fe, p); + fe->ops->tuner_ops->set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/l64781.c --- a/linux/drivers/media/dvb/frontends/l64781.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/l64781.c Mon Jun 18 14:27:55 2007 +0200 @@ -141,7 +141,7 @@ static int apply_frontend_param (struct int bw = p->bandwidth - BANDWIDTH_8_MHZ; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/lgdt330x.c --- a/linux/drivers/media/dvb/frontends/lgdt330x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/lgdt330x.c Mon Jun 18 14:27:55 2007 +0200 @@ -331,6 +331,10 @@ static int lgdt330x_set_parameters(struc static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; int err; + + if (fe->ops.tuner_ops.set_mode) + fe->ops.tuner_ops.set_mode(&fe->ops.tuner_ops, V4L_OPS(param)); + /* Change only if we are actually changing the modulation */ if (state->current_modulation != param->u.vsb.modulation) { switch(param->u.vsb.modulation) { @@ -402,7 +406,7 @@ static int lgdt330x_set_parameters(struc /* Tune to the specified frequency */ if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/mt2060.c --- a/linux/drivers/media/dvb/frontends/mt2060.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/mt2060.c Mon Jun 18 14:27:55 2007 +0200 @@ -159,8 +159,9 @@ static int mt2060_spurcheck(u32 lo1,u32 #define IF2 36150 // IF2 frequency = 36.150 MHz #define FREF 16000 // Quartz oscillator 16 MHz -static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int mt2060_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv; int ret=0; int i=0; @@ -286,40 +287,45 @@ static void mt2060_calibrate(struct mt20 dprintk("FMCAL timed out"); } -static int mt2060_get_frequency(struct dvb_frontend *fe, u32 *frequency) -{ +static int mt2060_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) -{ +static int mt2060_get_bandwidth(struct v4l_dvb_tuner_ops *ops, u32 *bandwidth) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv = fe->tuner_priv; *bandwidth = priv->bandwidth; return 0; } -static int mt2060_init(struct dvb_frontend *fe) -{ +static int mt2060_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv = fe->tuner_priv; return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33); } -static int mt2060_sleep(struct dvb_frontend *fe) -{ +static int mt2060_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv = fe->tuner_priv; return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); } -static int mt2060_release(struct dvb_frontend *fe) -{ +static int mt2060_release(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; kfree(fe->tuner_priv); fe->tuner_priv = NULL; return 0; } -static const struct dvb_tuner_ops mt2060_tuner_ops = { +static const struct v4l_dvb_tuner_ops mt2060_tuner_ops = { .info = { .name = "Microtune MT2060", .frequency_min = 48000000, @@ -334,12 +340,13 @@ static const struct dvb_tuner_ops mt2060 .set_params = mt2060_set_params, .get_frequency = mt2060_get_frequency, - .get_bandwidth = mt2060_get_bandwidth + .get_bandwidth = mt2060_get_bandwidth, }; /* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */ -struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) -{ +struct v4l_dvb_tuner_ops * mt2060_attach(struct v4l_dvb_tuner_ops *ops, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) +{ + struct dvb_frontend *fe = ops->fe; struct mt2060_priv *priv = NULL; u8 id = 0; @@ -361,13 +368,13 @@ struct dvb_frontend * mt2060_attach(stru return NULL; } printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1); - memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops)); + tuner_cpy(ops, mt2060_tuner_ops); fe->tuner_priv = priv; mt2060_calibrate(priv); - return fe; + return ops; } EXPORT_SYMBOL(mt2060_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/mt2060.h --- a/linux/drivers/media/dvb/frontends/mt2060.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/mt2060.h Mon Jun 18 14:27:55 2007 +0200 @@ -22,7 +22,7 @@ #ifndef MT2060_H #define MT2060_H -struct dvb_frontend; +struct v4l_dvb_tuner_ops; struct i2c_adapter; struct mt2060_config { @@ -31,9 +31,9 @@ struct mt2060_config { }; #if defined(CONFIG_DVB_TUNER_MT2060) || (defined(CONFIG_DVB_TUNER_MT2060_MODULE) && defined(MODULE)) -extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); +extern struct v4l_dvb_tuner_ops* mt2060_attach(struct v4l_dvb_tuner_ops *ops, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); #else -static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) +static inline struct v4l_dvb_tuner_ops* mt2060_attach(struct v4l_dvb_tuner_ops *ops, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); return NULL; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/mt312.c --- a/linux/drivers/media/dvb/frontends/mt312.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/mt312.c Mon Jun 18 14:27:55 2007 +0200 @@ -523,7 +523,7 @@ static int mt312_set_frontend(struct dvb } if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/mt352.c --- a/linux/drivers/media/dvb/frontends/mt352.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/mt352.c Mon Jun 18 14:27:55 2007 +0200 @@ -288,7 +288,7 @@ static int mt352_set_parameters(struct d if (state->config.no_tuner) { if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } @@ -297,7 +297,7 @@ static int mt352_set_parameters(struct d _mt352_write(fe, fsm_go, 2); } else { if (fe->ops.tuner_ops.calc_regs) { - fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5); + fe->ops.tuner_ops.calc_regs(&fe->ops.tuner_ops, V4L_OPS(param), buf+8, 5); buf[8] <<= 1; _mt352_write(fe, buf, sizeof(buf)); _mt352_write(fe, tuner_go, 2); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/nxt200x.c --- a/linux/drivers/media/dvb/frontends/nxt200x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/nxt200x.c Mon Jun 18 14:27:55 2007 +0200 @@ -566,7 +566,7 @@ static int nxt200x_setup_frontend_parame if (fe->ops.tuner_ops.calc_regs) { /* get tuning information */ - fe->ops.tuner_ops.calc_regs(fe, p, buf, 5); + fe->ops.tuner_ops.calc_regs(&fe->ops.tuner_ops, V4L_OPS(p), buf, 5); /* write frequency information */ nxt200x_writetuner(state, buf); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/nxt6000.c --- a/linux/drivers/media/dvb/frontends/nxt6000.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/nxt6000.c Mon Jun 18 14:27:55 2007 +0200 @@ -463,7 +463,7 @@ static int nxt6000_set_frontend(struct d int result; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/or51132.c --- a/linux/drivers/media/dvb/frontends/or51132.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/or51132.c Mon Jun 18 14:27:55 2007 +0200 @@ -364,7 +364,7 @@ static int or51132_set_parameters(struct } if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/qt1010.c --- a/linux/drivers/media/dvb/frontends/qt1010.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/qt1010.c Mon Jun 18 14:27:55 2007 +0200 @@ -84,9 +84,10 @@ static void qt1010_dump_regs(struct qt10 printk("%s\n", buf); } -static int qt1010_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int qt1010_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct qt1010_priv *priv; int err; u32 freq, div, mod1, mod2; @@ -319,8 +320,9 @@ static u8 qt1010_init_meas2(struct qt101 return 0; } -static int qt1010_init(struct dvb_frontend *fe) -{ +static int qt1010_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct qt1010_priv *priv = fe->tuner_priv; struct dvb_frontend_parameters params; int err = 0; @@ -401,31 +403,38 @@ static int qt1010_init(struct dvb_fronte params.frequency = 545000000; /* Sigmatek DVB-110 545000000 */ /* MSI Megasky 580 GL861 533000000 */ - return qt1010_set_params(fe, ¶ms); -} - -static int qt1010_release(struct dvb_frontend *fe) -{ - kfree(fe->tuner_priv); - fe->tuner_priv = NULL; - return 0; -} - -static int qt1010_get_frequency(struct dvb_frontend *fe, u32 *frequency) -{ + return qt1010_set_params(&fe->ops.tuner_ops, V4L_OPS((¶ms))); +} + +static int qt1010_release(struct v4l_dvb_tuner_ops *ops) +{ + if (ops != NULL) { + struct dvb_frontend *fe = ops->fe; + if (fe != NULL) { + kfree(fe->tuner_priv); + fe->tuner_priv = NULL; + } + } + return 0; +} + +static int qt1010_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) +{ + struct dvb_frontend *fe = ops->fe; struct qt1010_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static int qt1010_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) -{ +static int qt1010_get_bandwidth(struct v4l_dvb_tuner_ops *ops, u32 *bandwidth) +{ + struct dvb_frontend *fe = ops->fe; struct qt1010_priv *priv = fe->tuner_priv; *bandwidth = priv->bandwidth; return 0; } -static const struct dvb_tuner_ops qt1010_tuner_ops = { +static const struct v4l_dvb_tuner_ops qt1010_tuner_ops = { .info = { .name = "Quantek QT1010", .frequency_min = QT1010_MIN_FREQ, @@ -439,13 +448,14 @@ static const struct dvb_tuner_ops qt1010 .set_params = qt1010_set_params, .get_frequency = qt1010_get_frequency, - .get_bandwidth = qt1010_get_bandwidth + .get_bandwidth = qt1010_get_bandwidth, }; -struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe, +struct v4l_dvb_tuner_ops * qt1010_attach(struct v4l_dvb_tuner_ops *ops, struct i2c_adapter *i2c, struct qt1010_config *cfg) { + struct dvb_frontend *fe = ops->fe; struct qt1010_priv *priv = NULL; u8 id; @@ -473,11 +483,10 @@ struct dvb_frontend * qt1010_attach(stru fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ printk(KERN_INFO "Quantek QT1010 successfully identified.\n"); - memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, - sizeof(struct dvb_tuner_ops)); + tuner_cpy(ops,qt1010_tuner_ops); fe->tuner_priv = priv; - return fe; + return ops; } EXPORT_SYMBOL(qt1010_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/qt1010.h --- a/linux/drivers/media/dvb/frontends/qt1010.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/qt1010.h Mon Jun 18 14:27:55 2007 +0200 @@ -37,11 +37,11 @@ struct qt1010_config { * @return fe pointer on success, NULL on failure */ #if defined(CONFIG_DVB_TUNER_QT1010) || (defined(CONFIG_DVB_TUNER_QT1010_MODULE) && defined(MODULE)) -extern struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe, +extern struct v4l_dvb_tuner_ops *qt1010_attach(struct v4l_dvb_tuner_ops *fe, struct i2c_adapter *i2c, struct qt1010_config *cfg); #else -static inline struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe, +static inline struct v4l_dvb_tuner_ops *qt1010_attach(struct v4l_dvb_tuner_ops *fe, struct i2c_adapter *i2c, struct qt1010_config *cfg) { diff -r 76b92a337aec linux/drivers/media/dvb/frontends/s5h1420.c --- a/linux/drivers/media/dvb/frontends/s5h1420.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/s5h1420.c Mon Jun 18 14:27:55 2007 +0200 @@ -595,12 +595,12 @@ static int s5h1420_set_frontend(struct d (state->symbol_rate == p->u.qpsk.symbol_rate)) { if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } if (fe->ops.tuner_ops.get_frequency) { u32 tmp; - fe->ops.tuner_ops.get_frequency(fe, &tmp); + fe->ops.tuner_ops.get_frequency(&fe->ops.tuner_ops, &tmp); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, p->frequency - tmp); } else { @@ -652,7 +652,7 @@ static int s5h1420_set_frontend(struct d /* set tuner PLL */ if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/sp8870.c --- a/linux/drivers/media/dvb/frontends/sp8870.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/sp8870.c Mon Jun 18 14:27:55 2007 +0200 @@ -261,7 +261,7 @@ static int sp8870_set_frontend_parameter // set tuner parameters if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/sp887x.c --- a/linux/drivers/media/dvb/frontends/sp887x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/sp887x.c Mon Jun 18 14:27:55 2007 +0200 @@ -353,11 +353,11 @@ static int sp887x_setup_frontend_paramet /* setup the PLL */ if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } if (fe->ops.tuner_ops.get_frequency) { - fe->ops.tuner_ops.get_frequency(fe, &actual_freq); + fe->ops.tuner_ops.get_frequency(&fe->ops.tuner_ops, &actual_freq); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } else { actual_freq = p->frequency; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/stv0297.c --- a/linux/drivers/media/dvb/frontends/stv0297.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/stv0297.c Mon Jun 18 14:27:55 2007 +0200 @@ -443,7 +443,7 @@ static int stv0297_set_frontend(struct d stv0297_init(fe); if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/stv0299.c --- a/linux/drivers/media/dvb/frontends/stv0299.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/stv0299.c Mon Jun 18 14:27:55 2007 +0200 @@ -532,7 +532,7 @@ static int stv0299_read_ucblocks(struct return 0; } -static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters * p) +static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { struct stv0299_state* state = fe->demodulator_priv; int invval = 0; @@ -550,7 +550,7 @@ static int stv0299_set_frontend(struct d stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda10021.c --- a/linux/drivers/media/dvb/frontends/tda10021.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda10021.c Mon Jun 18 14:27:55 2007 +0200 @@ -252,7 +252,7 @@ static int tda10021_set_parameters (stru //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate); if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda10023.c --- a/linux/drivers/media/dvb/frontends/tda10023.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda10023.c Mon Jun 18 14:27:55 2007 +0200 @@ -307,7 +307,7 @@ static int tda10023_set_parameters (stru return -EINVAL; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda1004x.c --- a/linux/drivers/media/dvb/frontends/tda1004x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda1004x.c Mon Jun 18 14:27:55 2007 +0200 @@ -701,7 +701,7 @@ static int tda1004x_set_fe(struct dvb_fr // set frequency if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, fe_params); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fe_params)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda10086.c --- a/linux/drivers/media/dvb/frontends/tda10086.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda10086.c Mon Jun 18 14:27:55 2007 +0200 @@ -405,12 +405,12 @@ static int tda10086_set_frontend(struct // set params if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, fe_params); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(fe_params)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); if (fe->ops.tuner_ops.get_frequency) - fe->ops.tuner_ops.get_frequency(fe, &freq); + fe->ops.tuner_ops.get_frequency(&fe->ops.tuner_ops, &freq); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda8083.c --- a/linux/drivers/media/dvb/frontends/tda8083.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda8083.c Mon Jun 18 14:27:55 2007 +0200 @@ -321,7 +321,7 @@ static int tda8083_set_frontend(struct d struct tda8083_state* state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda80xx.c --- a/linux/drivers/media/dvb/frontends/tda80xx.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda80xx.c Mon Jun 18 14:27:55 2007 +0200 @@ -521,7 +521,7 @@ static int tda80xx_set_frontend(struct d struct tda80xx_state* state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda826x.c --- a/linux/drivers/media/dvb/frontends/tda826x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda826x.c Mon Jun 18 14:27:55 2007 +0200 @@ -40,15 +40,17 @@ struct tda826x_priv { u32 frequency; }; -static int tda826x_release(struct dvb_frontend *fe) +static int tda826x_release(struct v4l_dvb_tuner_ops *ops) { + struct dvb_frontend *fe = ops->fe; kfree(fe->tuner_priv); fe->tuner_priv = NULL; return 0; } -static int tda826x_sleep(struct dvb_frontend *fe) +static int tda826x_sleep(struct v4l_dvb_tuner_ops *ops) { + struct dvb_frontend *fe = ops->fe; struct tda826x_priv *priv = fe->tuner_priv; int ret; u8 buf [] = { 0x00, 0x8d }; @@ -70,8 +72,9 @@ static int tda826x_sleep(struct dvb_fron return (ret == 1) ? 0 : ret; } -static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int tda826x_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) { + struct dvb_frontend *fe = ops->fe; struct tda826x_priv *priv = fe->tuner_priv; int ret; u32 div; @@ -109,14 +112,15 @@ static int tda826x_set_params(struct dvb return (ret == 1) ? 0 : ret; } -static int tda826x_get_frequency(struct dvb_frontend *fe, u32 *frequency) +static int tda826x_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) { + struct dvb_frontend *fe = ops->fe; struct tda826x_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static struct dvb_tuner_ops tda826x_tuner_ops = { +static struct v4l_dvb_tuner_ops tda826x_tuner_ops = { .info = { .name = "Philips TDA826X", .frequency_min = 950000, @@ -128,8 +132,9 @@ static struct dvb_tuner_ops tda826x_tune .get_frequency = tda826x_get_frequency, }; -struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c, int has_loopthrough) +struct v4l_dvb_tuner_ops *tda826x_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c, int has_loopthrough) { + struct dvb_frontend *fe = ops->fe; struct tda826x_priv *priv = NULL; u8 b1 [] = { 0, 0 }; struct i2c_msg msg[2] = { @@ -159,11 +164,11 @@ struct dvb_frontend *tda826x_attach(stru priv->i2c = i2c; priv->has_loopthrough = has_loopthrough; - memcpy(&fe->ops.tuner_ops, &tda826x_tuner_ops, sizeof(struct dvb_tuner_ops)); + tuner_cpy(ops, tda826x_tuner_ops); fe->tuner_priv = priv; - return fe; + return ops; } EXPORT_SYMBOL(tda826x_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda826x.h --- a/linux/drivers/media/dvb/frontends/tda826x.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda826x.h Mon Jun 18 14:27:55 2007 +0200 @@ -36,11 +36,11 @@ * @return FE pointer on success, NULL on failure. */ #if defined(CONFIG_DVB_TDA826X) || (defined(CONFIG_DVB_TDA826X_MODULE) && defined(MODULE)) -extern struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, int addr, +extern struct v4l_dvb_tuner_ops* tda826x_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c, int has_loopthrough); #else -static inline struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, +static inline struct v4l_dvb_tuner_ops* tda826x_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c, int has_loopthrough) diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda827x.c --- a/linux/drivers/media/dvb/frontends/tda827x.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda827x.c Mon Jun 18 14:27:55 2007 +0200 @@ -80,9 +80,10 @@ static const struct tda827x_data tda827x { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} }; -static int tda827xo_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int tda827xo_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; u8 buf[14]; @@ -153,8 +154,9 @@ static int tda827xo_set_params(struct dv return 0; } -static int tda827xo_sleep(struct dvb_frontend *fe) -{ +static int tda827xo_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; static u8 buf[] = { 0x30, 0xd0 }; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, @@ -212,9 +214,10 @@ static const struct tda827xa_data tda827 { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} }; -static int tda827xa_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int tda827xa_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; u8 buf[11]; @@ -346,8 +349,9 @@ static int tda827xa_set_params(struct dv return 0; } -static int tda827xa_sleep(struct dvb_frontend *fe) -{ +static int tda827xa_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; static u8 buf[] = { 0x30, 0x90 }; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, @@ -368,29 +372,33 @@ static int tda827xa_sleep(struct dvb_fro return 0; } -static int tda827x_release(struct dvb_frontend *fe) -{ +static int tda827x_release(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; kfree(fe->tuner_priv); fe->tuner_priv = NULL; return 0; } -static int tda827x_get_frequency(struct dvb_frontend *fe, u32 *frequency) -{ +static int tda827x_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) -{ +static int tda827x_get_bandwidth(struct v4l_dvb_tuner_ops *ops, u32 *bandwidth) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; *bandwidth = priv->bandwidth; return 0; } -static int tda827x_init(struct dvb_frontend *fe) -{ +static int tda827x_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = fe->tuner_priv; dprintk("%s:\n", __FUNCTION__); if (priv->cfg && priv->cfg->init) @@ -401,25 +409,27 @@ static int tda827x_init(struct dvb_front static int tda827x_probe_version(struct dvb_frontend *fe); -static int tda827x_initial_init(struct dvb_frontend *fe) -{ +static int tda827x_initial_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; int ret; ret = tda827x_probe_version(fe); if (ret) return ret; - return fe->ops.tuner_ops.init(fe); -} - -static int tda827x_initial_sleep(struct dvb_frontend *fe) -{ + return fe->ops.tuner_ops.init(&fe->ops.tuner_ops); +} + +static int tda827x_initial_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; int ret; ret = tda827x_probe_version(fe); if (ret) return ret; - return fe->ops.tuner_ops.sleep(fe); -} - -static struct dvb_tuner_ops tda827xo_tuner_ops = { + return fe->ops.tuner_ops.sleep(&fe->ops.tuner_ops); +} + +static struct v4l_dvb_tuner_ops tda827xo_tuner_ops = { .info = { .name = "Philips TDA827X", .frequency_min = 55000000, @@ -434,7 +444,7 @@ static struct dvb_tuner_ops tda827xo_tun .get_bandwidth = tda827x_get_bandwidth, }; -static struct dvb_tuner_ops tda827xa_tuner_ops = { +static struct v4l_dvb_tuner_ops tda827xa_tuner_ops = { .info = { .name = "Philips TDA827XA", .frequency_min = 44000000, @@ -467,15 +477,16 @@ static int tda827x_probe_version(struct fe->ops.tuner_ops.sleep = tda827xo_sleep; } else { dprintk("tda827xa tuner found\n"); - memcpy(&fe->ops.tuner_ops, &tda827xa_tuner_ops, sizeof(struct dvb_tuner_ops)); - } - return 0; -} - -struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr, + tuner_cpy((&fe->ops.tuner_ops), tda827xa_tuner_ops); + } + return 0; +} + +struct v4l_dvb_tuner_ops *tda827x_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c, struct tda827x_config *cfg) { + struct dvb_frontend *fe = ops->fe; struct tda827x_priv *priv = NULL; dprintk("%s:\n", __FUNCTION__); @@ -486,11 +497,12 @@ struct dvb_frontend *tda827x_attach(stru priv->i2c_addr = addr; priv->i2c_adap = i2c; priv->cfg = cfg; - memcpy(&fe->ops.tuner_ops, &tda827xo_tuner_ops, sizeof(struct dvb_tuner_ops)); + tuner_cpy(ops, tda827xo_tuner_ops); + fe->tuner_priv = priv; - return fe; + return ops; } EXPORT_SYMBOL(tda827x_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tda827x.h --- a/linux/drivers/media/dvb/frontends/tda827x.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tda827x.h Mon Jun 18 14:27:55 2007 +0200 @@ -45,11 +45,11 @@ struct tda827x_config * @return FE pointer on success, NULL on failure. */ #if defined(CONFIG_DVB_TDA827X) || (defined(CONFIG_DVB_TDA827X_MODULE) && defined(MODULE)) -extern struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, int addr, +extern struct v4l_dvb_tuner_ops* tda827x_attach(struct v4l_dvb_tuner_ops *fe, int addr, struct i2c_adapter *i2c, struct tda827x_config *cfg); #else -static inline struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, +static inline struct v4l_dvb_tuner_ops* tda827x_attach(struct v4l_dvb_tuner_ops *fe, int addr, struct i2c_adapter *i2c, struct tda827x_config *cfg) diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tua6100.c --- a/linux/drivers/media/dvb/frontends/tua6100.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tua6100.c Mon Jun 18 14:27:55 2007 +0200 @@ -41,15 +41,17 @@ struct tua6100_priv { u32 frequency; }; -static int tua6100_release(struct dvb_frontend *fe) -{ +static int tua6100_release(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; kfree(fe->tuner_priv); fe->tuner_priv = NULL; return 0; } -static int tua6100_sleep(struct dvb_frontend *fe) -{ +static int tua6100_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct tua6100_priv *priv = fe->tuner_priv; int ret; u8 reg0[] = { 0x00, 0x00 }; @@ -66,9 +68,10 @@ static int tua6100_sleep(struct dvb_fron return (ret == 1) ? 0 : ret; } -static int tua6100_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int tua6100_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct tua6100_priv *priv = fe->tuner_priv; u32 div; u32 prediv; @@ -148,14 +151,15 @@ static int tua6100_set_params(struct dvb return 0; } -static int tua6100_get_frequency(struct dvb_frontend *fe, u32 *frequency) -{ +static int tua6100_get_frequency(struct v4l_dvb_tuner_ops *ops, u32 *frequency) +{ + struct dvb_frontend *fe = ops->fe; struct tua6100_priv *priv = fe->tuner_priv; *frequency = priv->frequency; return 0; } -static struct dvb_tuner_ops tua6100_tuner_ops = { +static struct v4l_dvb_tuner_ops tua6100_tuner_ops = { .info = { .name = "Infineon TUA6100", .frequency_min = 950000, @@ -168,8 +172,9 @@ static struct dvb_tuner_ops tua6100_tune .get_frequency = tua6100_get_frequency, }; -struct dvb_frontend *tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c) -{ +struct v4l_dvb_tuner_ops *tua6100_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c) +{ + struct dvb_frontend *fe = ops->fe; struct tua6100_priv *priv = NULL; u8 b1 [] = { 0x80 }; u8 b2 [] = { 0x00 }; @@ -193,9 +198,9 @@ struct dvb_frontend *tua6100_attach(stru priv->i2c_address = addr; priv->i2c = i2c; - memcpy(&fe->ops.tuner_ops, &tua6100_tuner_ops, sizeof(struct dvb_tuner_ops)); + tuner_cpy(ops, tua6100_tuner_ops); fe->tuner_priv = priv; - return fe; + return ops; } EXPORT_SYMBOL(tua6100_attach); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/tua6100.h --- a/linux/drivers/media/dvb/frontends/tua6100.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/tua6100.h Mon Jun 18 14:27:55 2007 +0200 @@ -35,9 +35,9 @@ #include "dvb_frontend.h" #if defined(CONFIG_DVB_TUA6100) || (defined(CONFIG_DVB_TUA6100_MODULE) && defined(MODULE)) -extern struct dvb_frontend *tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c); +extern struct v4l_dvb_tuner_ops *tua6100_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c); #else -static inline struct dvb_frontend* tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c) +static inline struct v4l_dvb_tuner_ops* tua6100_attach(struct v4l_dvb_tuner_ops *ops, int addr, struct i2c_adapter *i2c) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); return NULL; diff -r 76b92a337aec linux/drivers/media/dvb/frontends/ves1820.c --- a/linux/drivers/media/dvb/frontends/ves1820.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/ves1820.c Mon Jun 18 14:27:55 2007 +0200 @@ -219,7 +219,7 @@ static int ves1820_set_parameters(struct return -EINVAL; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } diff -r 76b92a337aec linux/drivers/media/dvb/frontends/ves1x93.c --- a/linux/drivers/media/dvb/frontends/ves1x93.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/ves1x93.c Mon Jun 18 14:27:55 2007 +0200 @@ -389,7 +389,7 @@ static int ves1x93_set_frontend(struct d struct ves1x93_state* state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, p); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(p)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } ves1x93_set_inversion (state, p->inversion); diff -r 76b92a337aec linux/drivers/media/dvb/frontends/zl10353.c --- a/linux/drivers/media/dvb/frontends/zl10353.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/frontends/zl10353.c Mon Jun 18 14:27:55 2007 +0200 @@ -168,6 +168,9 @@ static int zl10353_set_parameters(struct u16 nominal_rate; u8 pllbuf[6] = { 0x67 }; + if (fe->ops.tuner_ops.set_mode) + fe->ops.tuner_ops.set_mode(&fe->ops.tuner_ops, V4L_OPS(param)); + /* These settings set "auto-everything" and start the FSM. */ zl10353_single_write(fe, 0x55, 0x80); udelay(200); @@ -192,7 +195,7 @@ static int zl10353_set_parameters(struct // a potential tuner attached somewhere else if (state->config.no_tuner) { if (fe->ops.tuner_ops.set_params) { - fe->ops.tuner_ops.set_params(fe, param); + fe->ops.tuner_ops.set_params(&fe->ops.tuner_ops, V4L_OPS(param)); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } @@ -200,7 +203,7 @@ static int zl10353_set_parameters(struct // if pllbuf is defined, retrieve the settings if (fe->ops.tuner_ops.calc_regs) { - fe->ops.tuner_ops.calc_regs(fe, param, pllbuf+1, 5); + fe->ops.tuner_ops.calc_regs(&fe->ops.tuner_ops, V4L_OPS(param), pllbuf+1, 5); pllbuf[1] <<= 1; } else { // fake pllbuf settings diff -r 76b92a337aec linux/drivers/media/dvb/pluto2/pluto2.c --- a/linux/drivers/media/dvb/pluto2/pluto2.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/pluto2/pluto2.c Mon Jun 18 14:27:55 2007 +0200 @@ -442,9 +442,10 @@ static inline u32 divide(u32 numerator, } /* LG Innotek TDTE-E001P (Infineon TUA6034) */ -static int lg_tdtpe001p_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *p) -{ +static int lg_tdtpe001p_tuner_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *p) +{ + struct dvb_frontend *fe = ops->fe; struct pluto *pluto = frontend_to_pluto(fe); struct i2c_msg msg; int ret; @@ -529,6 +530,7 @@ static int __devinit frontend_init(struc dev_err(&pluto->pdev->dev, "could not attach frontend\n"); return -ENODEV; } + pluto->fe->ops.tuner_ops.fe = pluto->fe; pluto->fe->ops.tuner_ops.set_params = lg_tdtpe001p_tuner_set_params; ret = dvb_register_frontend(&pluto->dvb_adapter, pluto->fe); diff -r 76b92a337aec linux/drivers/media/dvb/ttpci/av7110.c --- a/linux/drivers/media/dvb/ttpci/av7110.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttpci/av7110.c Mon Jun 18 14:27:55 2007 +0200 @@ -1552,8 +1552,9 @@ static int get_firmware(struct av7110* a #endif -static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int alps_bsrv2_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u8 pwr = 0; u8 buf[4]; @@ -1588,8 +1589,9 @@ static struct ves1x93_config alps_bsrv2_ .invert_pwm = 0, }; -static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int alps_tdbe2_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u32 div; u8 data[4]; @@ -1619,8 +1621,9 @@ static struct ves1820_config alps_tdbe2_ -static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int grundig_29504_451_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u32 div; u8 data[4]; @@ -1645,9 +1648,11 @@ static struct tda8083_config grundig_295 -static int philips_cd1516_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int philips_cd1516_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; + u32 div; u32 f = params->frequency; u8 data[4]; @@ -1676,8 +1681,10 @@ static struct ves1820_config philips_cd1 -static int alps_tdlb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int alps_tdlb7_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u32 div, pwr; u8 data[4]; @@ -1813,8 +1820,9 @@ static u8 nexusca_stv0297_inittab[] = { 0xff, 0xff, }; -static int nexusca_stv0297_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int nexusca_stv0297_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u32 div; u8 data[4]; @@ -1868,8 +1876,9 @@ static struct stv0297_config nexusca_stv -static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) -{ +static int grundig_29504_401_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct av7110* av7110 = fe->dvb->priv; u32 div; u8 cfg, cpump, band_select; @@ -2091,6 +2100,7 @@ static int frontend_init(struct av7110 * av7110->fe = dvb_attach(ves1820_attach, &philips_cd1516_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = philips_cd1516_tuner_set_params; } break; @@ -2105,6 +2115,7 @@ static int frontend_init(struct av7110 * // try the ALPS BSRV2 first of all av7110->fe = dvb_attach(ves1x93_attach, &alps_bsrv2_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params; av7110->fe->ops.diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; av7110->fe->ops.diseqc_send_burst = av7110_diseqc_send_burst; @@ -2116,6 +2127,7 @@ static int frontend_init(struct av7110 * // try the ALPS BSRU6 now av7110->fe = dvb_attach(stv0299_attach, &alps_bsru6_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; av7110->fe->tuner_priv = &av7110->i2c_adap; @@ -2129,6 +2141,7 @@ static int frontend_init(struct av7110 * // Try the grundig 29504-451 av7110->fe = dvb_attach(tda8083_attach, &grundig_29504_451_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = grundig_29504_451_tuner_set_params; av7110->fe->ops.diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; av7110->fe->ops.diseqc_send_burst = av7110_diseqc_send_burst; @@ -2144,6 +2157,7 @@ static int frontend_init(struct av7110 * av7110->fe = dvb_attach(ves1820_attach, &philips_cd1516_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = philips_cd1516_tuner_set_params; } break; @@ -2152,6 +2166,7 @@ static int frontend_init(struct av7110 * av7110->fe = dvb_attach(ves1820_attach, &alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; } break; @@ -2162,6 +2177,7 @@ static int frontend_init(struct av7110 * // try ALPS TDLB7 first, then Grundig 29504-401 av7110->fe = dvb_attach(sp8870_attach, &alps_tdlb7_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_tdlb7_tuner_set_params; break; } @@ -2171,6 +2187,7 @@ static int frontend_init(struct av7110 * // Grundig 29504-401 av7110->fe = dvb_attach(l64781_attach, &grundig_29504_401_config, &av7110->i2c_adap); if (av7110->fe) + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params; break; @@ -2178,6 +2195,7 @@ static int frontend_init(struct av7110 * av7110->fe = dvb_attach(ves1820_attach, &alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; } break; @@ -2186,6 +2204,7 @@ static int frontend_init(struct av7110 * /* ALPS BSRV2 */ av7110->fe = dvb_attach(ves1x93_attach, &alps_bsrv2_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params; av7110->fe->ops.diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; av7110->fe->ops.diseqc_send_burst = av7110_diseqc_send_burst; @@ -2198,6 +2217,7 @@ static int frontend_init(struct av7110 * /* Grundig 29504-451 */ av7110->fe = dvb_attach(tda8083_attach, &grundig_29504_451_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = grundig_29504_451_tuner_set_params; av7110->fe->ops.diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; av7110->fe->ops.diseqc_send_burst = av7110_diseqc_send_burst; @@ -2210,6 +2230,7 @@ static int frontend_init(struct av7110 * av7110->fe = dvb_attach(stv0297_attach, &nexusca_stv0297_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; /* set TDA9819 into DVB mode */ @@ -2226,6 +2247,7 @@ static int frontend_init(struct av7110 * /* ALPS BSBE1 */ av7110->fe = dvb_attach(stv0299_attach, &alps_bsbe1_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.fe = av7110->fe; av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; av7110->fe->tuner_priv = &av7110->i2c_adap; diff -r 76b92a337aec linux/drivers/media/dvb/ttpci/budget-av.c --- a/linux/drivers/media/dvb/ttpci/budget-av.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget-av.c Mon Jun 18 14:27:55 2007 +0200 @@ -493,11 +493,12 @@ static int philips_su1278_ty_ci_set_symb return 0; } -static int philips_su1278_ty_ci_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int philips_su1278_ty_ci_tuner_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) { u32 div; u8 buf[4]; + struct dvb_frontend *fe = ops->fe; struct budget *budget = (struct budget *) fe->dvb->priv; struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; @@ -608,8 +609,9 @@ static struct stv0299_config cinergy_120 .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, }; -static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int philips_cu1216_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct budget *budget = (struct budget *) fe->dvb->priv; u8 buf[6]; struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; @@ -667,8 +669,9 @@ static struct tda1002x_config philips_cu .invert = 0, }; -static int philips_tu1216_tuner_init(struct dvb_frontend *fe) -{ +static int philips_tu1216_tuner_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct budget *budget = (struct budget *) fe->dvb->priv; static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; @@ -683,8 +686,9 @@ static int philips_tu1216_tuner_init(str return 0; } -static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int philips_tu1216_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct budget *budget = (struct budget *) fe->dvb->priv; u8 tuner_buf[4]; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = @@ -945,12 +949,14 @@ static void frontend_init(struct budget_ fe = dvb_attach(stv0299_attach, &cinergy_1200s_1894_0010_config, &budget_av->budget.i2c_adap); if (fe) { - dvb_attach(tua6100_attach, fe, 0x60, &budget_av->budget.i2c_adap); + fe->ops.tuner_ops.fe = fe; + dvb_attach(tua6100_attach, &fe->ops.tuner_ops, 0x60, &budget_av->budget.i2c_adap); } } else { fe = dvb_attach(stv0299_attach, &typhoon_config, &budget_av->budget.i2c_adap); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; } } @@ -964,7 +970,8 @@ static void frontend_init(struct budget_ fe = dvb_attach(stv0299_attach, &philips_sd1878_config, &budget_av->budget.i2c_adap); if (fe) { - dvb_attach(dvb_pll_attach, fe, 0x60, + fe->ops.tuner_ops.fe = fe; + dvb_attach(dvb_pll_attach, &fe->ops.tuner_ops, 0x60, &budget_av->budget.i2c_adap, &dvb_pll_philips_sd1878_tda8261); } @@ -974,6 +981,7 @@ static void frontend_init(struct budget_ fe = dvb_attach(stv0299_attach, &typhoon_config, &budget_av->budget.i2c_adap); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; } break; @@ -982,6 +990,7 @@ static void frontend_init(struct budget_ fe = dvb_attach(stv0299_attach, &cinergy_1200s_config, &budget_av->budget.i2c_adap); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; } break; @@ -1000,6 +1009,7 @@ static void frontend_init(struct budget_ &budget_av->budget.i2c_adap, read_pwm(budget_av)); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; } break; @@ -1014,6 +1024,7 @@ static void frontend_init(struct budget_ &budget_av->budget.i2c_adap, read_pwm(budget_av)); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; } break; @@ -1025,6 +1036,7 @@ static void frontend_init(struct budget_ fe = dvb_attach(tda10046_attach, &philips_tu1216_config, &budget_av->budget.i2c_adap); if (fe) { + fe->ops.tuner_ops.fe = fe; fe->ops.tuner_ops.init = philips_tu1216_tuner_init; fe->ops.tuner_ops.set_params = philips_tu1216_tuner_set_params; } diff -r 76b92a337aec linux/drivers/media/dvb/ttpci/budget-ci.c --- a/linux/drivers/media/dvb/ttpci/budget-ci.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget-ci.c Mon Jun 18 14:27:55 2007 +0200 @@ -695,9 +695,10 @@ static int philips_su1278_tt_set_symbol_ return 0; } -static int philips_su1278_tt_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) -{ +static int philips_su1278_tt_tuner_set_params(struct v4l_dvb_tuner_ops *ops, + struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u32 div; u8 buf[4]; @@ -746,8 +747,9 @@ static struct stv0299_config philips_su1 -static int philips_tdm1316l_tuner_init(struct dvb_frontend *fe) -{ +static int philips_tdm1316l_tuner_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 }; @@ -776,8 +778,9 @@ static int philips_tdm1316l_tuner_init(s return 0; } -static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int philips_tdm1316l_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u8 tuner_buf[4]; struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; @@ -891,8 +894,9 @@ static struct tda1004x_config philips_td .request_firmware = philips_tdm1316l_request_firmware, }; -static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int dvbc_philips_tdm1316l_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u8 tuner_buf[5]; struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, @@ -1076,6 +1080,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; break; @@ -1086,6 +1091,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = dvb_attach(stv0299_attach, &philips_su1278_tt_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_su1278_tt_tuner_set_params; break; } @@ -1096,6 +1102,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; break; } @@ -1107,6 +1114,7 @@ static void frontend_init(struct budget_ dvb_attach(tda10045_attach, &philips_tdm1316l_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; } @@ -1118,6 +1126,7 @@ static void frontend_init(struct budget_ dvb_attach(tda10046_attach, &philips_tdm1316l_config_invert, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; } @@ -1126,6 +1135,7 @@ static void frontend_init(struct budget_ case 0x1017: // TT S-1500 PCI budget_ci->budget.dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.fe = budget_ci->budget.dvb_frontend; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; diff -r 76b92a337aec linux/drivers/media/dvb/ttpci/budget-patch.c --- a/linux/drivers/media/dvb/ttpci/budget-patch.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget-patch.c Mon Jun 18 14:27:55 2007 +0200 @@ -258,8 +258,9 @@ static int budget_patch_diseqc_send_burs return 0; } -static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int alps_bsrv2_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; u8 pwr = 0; u8 buf[4]; @@ -294,8 +295,9 @@ static struct ves1x93_config alps_bsrv2_ .invert_pwm = 0, }; -static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int grundig_29504_451_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; u32 div; u8 data[4]; @@ -327,6 +329,7 @@ static void frontend_init(struct budget_ // try the ALPS BSRV2 first of all budget->dvb_frontend = dvb_attach(ves1x93_attach, &alps_bsrv2_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params; budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_patch_diseqc_send_master_cmd; budget->dvb_frontend->ops.diseqc_send_burst = budget_patch_diseqc_send_burst; @@ -337,6 +340,7 @@ static void frontend_init(struct budget_ // try the ALPS BSRU6 now budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget->dvb_frontend->tuner_priv = &budget->i2c_adap; @@ -349,6 +353,7 @@ static void frontend_init(struct budget_ // Try the grundig 29504-451 budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_451_tuner_set_params; budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst; diff -r 76b92a337aec linux/drivers/media/dvb/ttpci/budget.c --- a/linux/drivers/media/dvb/ttpci/budget.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget.c Mon Jun 18 14:27:55 2007 +0200 @@ -192,8 +192,9 @@ static int budget_diseqc_send_burst(stru return 0; } -static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int alps_bsrv2_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget* budget = (struct budget*) fe->dvb->priv; u8 pwr = 0; u8 buf[4]; @@ -228,8 +229,9 @@ static struct ves1x93_config alps_bsrv2_ .invert_pwm = 0, }; -static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int alps_tdbe2_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; u8 data[4]; @@ -255,8 +257,9 @@ static struct ves1820_config alps_tdbe2_ .selagc = VES1820_SELAGC_SIGNAMPERR, }; -static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int grundig_29504_401_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; u8 cfg, cpump, band_select; @@ -292,8 +295,9 @@ static struct l64781_config grundig_2950 .demod_address = 0x55, }; -static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int grundig_29504_451_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; u8 data[4]; @@ -315,8 +319,9 @@ static struct tda8083_config grundig_295 .demod_address = 0x68, }; -static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int s5h1420_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; u8 data[4]; @@ -374,6 +379,7 @@ static void frontend_init(struct budget // try the ALPS BSRV2 first of all budget->dvb_frontend = dvb_attach(ves1x93_attach, &alps_bsrv2_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params; budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst; @@ -384,6 +390,7 @@ static void frontend_init(struct budget // try the ALPS BSRU6 now budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget->dvb_frontend->tuner_priv = &budget->i2c_adap; if (budget->dev->pci->subsystem_device == 0x1003 && diseqc_method == 0) { @@ -399,6 +406,7 @@ static void frontend_init(struct budget budget->dvb_frontend = dvb_attach(ves1820_attach, &alps_tdbe2_config, &budget->i2c_adap, read_pwm(budget)); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; break; } @@ -408,6 +416,7 @@ static void frontend_init(struct budget budget->dvb_frontend = dvb_attach(l64781_attach, &grundig_29504_401_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params; break; } @@ -416,6 +425,7 @@ static void frontend_init(struct budget case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget->dvb_frontend->tuner_priv = &budget->i2c_adap; budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; @@ -426,6 +436,7 @@ static void frontend_init(struct budget case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_451_tuner_set_params; budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; @@ -435,6 +446,7 @@ static void frontend_init(struct budget case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) budget->dvb_frontend = dvb_attach(s5h1420_attach, &s5h1420_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { printk("%s: No LNBP21 found!\n", __FUNCTION__); @@ -452,7 +464,8 @@ static void frontend_init(struct budget budget->dvb_frontend = dvb_attach(tda10086_attach, &tda10086_config, &budget->i2c_adap); if (budget->dvb_frontend) { - if (dvb_attach(tda826x_attach, budget->dvb_frontend, 0x60, &budget->i2c_adap, 0) == NULL) + budget->dvb_frontend->ops.tuner_ops.fe = budget->dvb_frontend; + if (dvb_attach(tda826x_attach, &budget->dvb_frontend->ops.tuner_ops, 0x60, &budget->i2c_adap, 0) == NULL) printk("%s: No tda826x found!\n", __FUNCTION__); if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { printk("%s: No LNBP21 found!\n", __FUNCTION__); diff -r 76b92a337aec linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c --- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c Mon Jun 18 14:27:55 2007 +0200 @@ -1033,8 +1033,9 @@ static u32 functionality(struct i2c_adap -static int alps_tdmb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int alps_tdmb7_tuner_set_params(struct v4l_dvb_tuner_ops* ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; u8 data[4]; struct i2c_msg msg = {.addr=0x61, .flags=0, .buf=data, .len=sizeof(data) }; @@ -1061,8 +1062,9 @@ static struct cx22700_config alps_tdmb7_ -static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe) -{ +static int philips_tdm1316l_tuner_init(struct v4l_dvb_tuner_ops* ops) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 }; @@ -1087,8 +1089,9 @@ static int philips_tdm1316l_tuner_init(s return 0; } -static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int philips_tdm1316l_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; u8 tuner_buf[4]; struct i2c_msg tuner_msg = {.addr=0x60, .flags=0, .buf=tuner_buf, .len=sizeof(tuner_buf) }; @@ -1289,8 +1292,9 @@ static int alps_stv0299_set_symbol_rate( return 0; } -static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int philips_tsa5059_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; u8 buf[4]; u32 div; @@ -1332,8 +1336,9 @@ static struct stv0299_config alps_stv029 .set_symbol_rate = alps_stv0299_set_symbol_rate, }; -static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int ttusb_novas_grundig_29504_491_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; u8 buf[4]; u32 div; @@ -1359,8 +1364,9 @@ static struct tda8083_config ttusb_novas .demod_address = 0x68, }; -static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ +static int alps_tdbe2_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters* params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb* ttusb = fe->dvb->priv; u32 div; u8 data[4]; @@ -1403,8 +1409,9 @@ static u8 read_pwm(struct ttusb* ttusb) } -static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int dvbc_philips_tdm1316l_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct ttusb *ttusb = (struct ttusb *) fe->dvb->priv; u8 tuner_buf[5]; struct i2c_msg tuner_msg = {.addr = 0x60, @@ -1578,6 +1585,7 @@ static void frontend_init(struct ttusb* // try the stv0299 based first ttusb->fe = dvb_attach(stv0299_attach, &alps_stv0299_config, &ttusb->i2c_adap); if (ttusb->fe != NULL) { + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params; if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 @@ -1592,6 +1600,7 @@ static void frontend_init(struct ttusb* // Grundig 29504-491 ttusb->fe = dvb_attach(tda8083_attach, &ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); if (ttusb->fe != NULL) { + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; ttusb->fe->ops.set_voltage = ttusb_set_voltage; break; @@ -1601,12 +1610,14 @@ static void frontend_init(struct ttusb* case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) ttusb->fe = dvb_attach(ves1820_attach, &alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); if (ttusb->fe != NULL) { + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; break; } ttusb->fe = dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &ttusb->i2c_adap); if (ttusb->fe != NULL) { + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; break; } @@ -1616,6 +1627,7 @@ static void frontend_init(struct ttusb* // try the ALPS TDMB7 first ttusb->fe = dvb_attach(cx22700_attach, &alps_tdmb7_config, &ttusb->i2c_adap); if (ttusb->fe != NULL) { + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params; break; } @@ -1624,6 +1636,7 @@ static void frontend_init(struct ttusb* ttusb->fe = dvb_attach(tda10046_attach, &philips_tdm1316l_config, &ttusb->i2c_adap); if (ttusb->fe != NULL) { ttusb->fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init; + ttusb->fe->ops.tuner_ops.fe = ttusb->fe; ttusb->fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; } diff -r 76b92a337aec linux/drivers/media/video/cx88/cx88-dvb.c --- a/linux/drivers/media/video/cx88/cx88-dvb.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/video/cx88/cx88-dvb.c Mon Jun 18 14:27:55 2007 +0200 @@ -385,7 +385,8 @@ static int dvb_register(struct cx8802_de &connexant_refboard_config, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_thomson_dtt759x); } @@ -398,7 +399,8 @@ static int dvb_register(struct cx8802_de &connexant_refboard_config, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x60, &dev->core->i2c_adap, &dvb_pll_thomson_dtt7579); } @@ -412,7 +414,8 @@ static int dvb_register(struct cx8802_de &hauppauge_hvr_config, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_fmd1216me); } break; @@ -421,7 +424,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x60, NULL, &dvb_pll_thomson_dtt7579); break; } @@ -430,7 +434,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv_plus_v1_1, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x60, NULL, &dvb_pll_thomson_dtt7579); } break; @@ -441,7 +446,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv_dual, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_thomson_dtt7579); break; } @@ -450,7 +456,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv_plus_v1_1, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_thomson_dtt7579); } break; @@ -459,7 +466,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_lg_z201); } break; @@ -470,7 +478,8 @@ static int dvb_register(struct cx8802_de &dntv_live_dvbt_config, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_unknown_1); } break; @@ -479,7 +488,8 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, &((struct vp3054_i2c_state *)dev->card_priv)->adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_fmd1216me); } #else @@ -491,7 +501,8 @@ static int dvb_register(struct cx8802_de &dvico_fusionhdtv_hybrid, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_thomson_fe6600); } @@ -500,7 +511,8 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_thomson_dtt761x); } @@ -522,7 +534,8 @@ static int dvb_register(struct cx8802_de &fusionhdtv_3_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_microtune_4042); } @@ -542,7 +555,8 @@ static int dvb_register(struct cx8802_de &fusionhdtv_3_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_thomson_dtt761x); } @@ -562,7 +576,8 @@ static int dvb_register(struct cx8802_de &fusionhdtv_5_gold, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_lg_tdvs_h06xf); } @@ -582,7 +597,8 @@ static int dvb_register(struct cx8802_de &pchdtv_hd5500, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, &dev->core->i2c_adap, &dvb_pll_lg_tdvs_h06xf); } @@ -593,7 +609,8 @@ static int dvb_register(struct cx8802_de &ati_hdtvwonder, &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_tuv1236d); } break; diff -r 76b92a337aec linux/drivers/media/video/saa7134/saa7134-dvb.c --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c Mon Jun 18 14:27:55 2007 +0200 @@ -147,11 +147,12 @@ static int mt352_aver777_init(struct dvb return 0; } -static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params) +static int mt352_pinnacle_tuner_set_params(struct v4l_dvb_tuner_ops* ops, + struct dvb_int_frontend_parameters* params) { u8 off[] = { 0x00, 0xf1}; u8 on[] = { 0x00, 0x71}; + struct dvb_frontend *fe = ops->fe; struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)}; struct saa7134_dev *dev = fe->dvb->priv; @@ -204,8 +205,9 @@ static int philips_tda1004x_request_firm * these tuners are tu1216, td1316(a) */ -static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ +static int philips_tda6651_pll_set(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + struct dvb_frontend *fe = ops->fe; struct saa7134_dev *dev = fe->dvb->priv; struct tda1004x_state *state = fe->demodulator_priv; u8 addr = state->config->tuner_address; @@ -292,8 +294,9 @@ static int philips_tda6651_pll_set(struc return 0; } -static int philips_tu1216_init(struct dvb_frontend *fe) -{ +static int philips_tu1216_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct saa7134_dev *dev = fe->dvb->priv; struct tda1004x_state *state = fe->demodulator_priv; u8 addr = state->config->tuner_address; @@ -337,8 +340,9 @@ static struct tda1004x_config philips_tu /* ------------------------------------------------------------------ */ -static int philips_td1316_tuner_init(struct dvb_frontend *fe) -{ +static int philips_td1316_tuner_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct saa7134_dev *dev = fe->dvb->priv; struct tda1004x_state *state = fe->demodulator_priv; u8 addr = state->config->tuner_address; @@ -353,9 +357,9 @@ static int philips_td1316_tuner_init(str return 0; } -static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) -{ - return philips_tda6651_pll_set(fe, params); +static int philips_td1316_tuner_set_params(struct v4l_dvb_tuner_ops *ops, struct dvb_int_frontend_parameters *params) +{ + return philips_tda6651_pll_set(ops, params); } static int philips_td1316_tuner_sleep(struct dvb_frontend *fe) @@ -376,14 +380,15 @@ static int philips_td1316_tuner_sleep(st /* ------------------------------------------------------------------ */ -static int philips_europa_tuner_init(struct dvb_frontend *fe) -{ +static int philips_europa_tuner_init(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct saa7134_dev *dev = fe->dvb->priv; static u8 msg[] = { 0x00, 0x40}; struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; - if (philips_td1316_tuner_init(fe)) + if (philips_td1316_tuner_init(ops)) return -EIO; msleep(1); if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) @@ -392,8 +397,9 @@ static int philips_europa_tuner_init(str return 0; } -static int philips_europa_tuner_sleep(struct dvb_frontend *fe) -{ +static int philips_europa_tuner_sleep(struct v4l_dvb_tuner_ops *ops) +{ + struct dvb_frontend *fe = ops->fe; struct saa7134_dev *dev = fe->dvb->priv; static u8 msg[] = { 0x00, 0x14 }; @@ -559,7 +565,8 @@ static void configure_tda827x_fe(struct if (dev->dvb.frontend) { if (tda_conf->i2c_gate) dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; - if (dvb_attach(tda827x_attach, dev->dvb.frontend, tda_conf->tuner_address, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + if (dvb_attach(tda827x_attach, &dev->dvb.frontend->ops.tuner_ops, tda_conf->tuner_address, &dev->i2c_adap,&tda827x_cfg) == NULL) { wprintk("no tda827x tuner found at addr: %02x\n", tda_conf->tuner_address); @@ -846,6 +853,7 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, &dev->i2c_adap); if (dev->dvb.frontend) { + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; } break; @@ -855,7 +863,8 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_philips_td1316); } break; @@ -864,7 +873,8 @@ static int dvb_init(struct saa7134_dev * &medion_cardbus, &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, medion_cardbus.tuner_address, &dev->i2c_adap, &dvb_pll_fmd1216me); } break; @@ -874,6 +884,7 @@ static int dvb_init(struct saa7134_dev * &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; } break; @@ -891,6 +902,7 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; } break; @@ -900,6 +912,7 @@ static int dvb_init(struct saa7134_dev * &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; } break; @@ -927,7 +940,8 @@ static int dvb_init(struct saa7134_dev * } else { //satellite dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); if (dev->dvb.frontend) { - if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + if (dvb_attach(tda826x_attach, &dev->dvb.frontend->ops.tuner_ops, 0x63, &dev->i2c_adap, 0) == NULL) { wprintk("%s: Lifeview Trio, No tda826x found!\n", __FUNCTION__); } @@ -944,7 +958,8 @@ static int dvb_init(struct saa7134_dev * &ads_tech_duo_config, &dev->i2c_adap); if (dev->dvb.frontend) { - if (dvb_attach(tda827x_attach,dev->dvb.frontend, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + if (dvb_attach(tda827x_attach,&dev->dvb.frontend->ops.tuner_ops, ads_tech_duo_config.tuner_address, &dev->i2c_adap,&ads_duo_cfg) == NULL) { wprintk("no tda827x tuner found at addr: %02x\n", @@ -962,7 +977,8 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_tdhu2); } break; @@ -970,7 +986,8 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, 0x61, NULL, &dvb_pll_tuv1236d); } break; @@ -978,7 +995,8 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); if (dev->dvb.frontend) { - if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + if (dvb_attach(tda826x_attach, &dev->dvb.frontend->ops.tuner_ops, 0x60, &dev->i2c_adap, 0) == NULL) { wprintk("%s: No tda826x found!\n", __FUNCTION__); } @@ -995,7 +1013,8 @@ static int dvb_init(struct saa7134_dev * dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; - dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; + dvb_attach(dvb_pll_attach, &dev->dvb.frontend->ops.tuner_ops, medion_cardbus.tuner_address, &dev->i2c_adap, &dvb_pll_fmd1216me); } break; @@ -1005,6 +1024,7 @@ static int dvb_init(struct saa7134_dev * &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; + dev->dvb.frontend->ops.tuner_ops.fe = dev->dvb.frontend; dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; } break; @@ -1045,7 +1065,7 @@ static int dvb_init(struct saa7134_dev * if (dev->dvb.frontend->ops.sleep) dev->dvb.frontend->ops.sleep(dev->dvb.frontend); if (dev->dvb.frontend->ops.tuner_ops.sleep) - dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend); + dev->dvb.frontend->ops.tuner_ops.sleep(&dev->dvb.frontend->ops.tuner_ops); } return ret; } diff -r 76b92a337aec linux/drivers/media/video/tuner-core.c --- a/linux/drivers/media/video/tuner-core.c Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/drivers/media/video/tuner-core.c Mon Jun 18 14:27:55 2007 +0200 @@ -21,11 +21,18 @@ #include #include +#include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" #endif #define UNSET (-1U) + +#define TUNER_ATTACH 1 +#define SET_ATTR 2 + +#define MODULE_LOADED 1 +#define MODULE_FAILED 2 /* standard i2c insmod options */ static unsigned short normal_i2c[] = { @@ -105,7 +112,7 @@ static void set_tv_freq(struct i2c_clien tuner_warn ("tuner type not set\n"); return; } - if (NULL == t->ops.set_tv_freq) { + if (NULL == t->oldops.set_tv_freq) { tuner_warn ("Tuner has no way to set tv freq\n"); return; } @@ -120,7 +127,7 @@ static void set_tv_freq(struct i2c_clien else freq = tv_range[1] * 16; } - t->ops.set_tv_freq(c, freq); + t->oldops.set_tv_freq(c, freq); } static void set_radio_freq(struct i2c_client *c, unsigned int freq) @@ -131,7 +138,7 @@ static void set_radio_freq(struct i2c_cl tuner_warn ("tuner type not set\n"); return; } - if (NULL == t->ops.set_radio_freq) { + if (NULL == t->oldops.set_radio_freq) { tuner_warn ("tuner has no way to set radio frequency\n"); return; } @@ -147,7 +154,7 @@ static void set_radio_freq(struct i2c_cl freq = radio_range[1] * 16000; } - t->ops.set_radio_freq(c, freq); + t->oldops.set_radio_freq(c, freq); } static void set_freq(struct i2c_client *c, unsigned long freq) @@ -171,42 +178,148 @@ static void set_freq(struct i2c_client * } } + +static int v4l_dvb_tuner_ioctl(struct v4l_dvb_tuner_ops *dev, int cmd, int arg) +{ + struct tuner *t = i2c_get_clientdata(dev->dev); + if( t->tuner_callback ) + return t->tuner_callback(((struct i2c_client*)dev->dev)->adapter->algo_data, cmd, arg); + else + tuner_dbg("%s: callback requested, but no callback registered? (please report)\n",__FILE__); + return 0; +} + +static int put_tuner(struct i2c_client *c) +{ + struct tuner *t = i2c_get_clientdata(c); + struct v4l_dvb_tuner_ops *ops = t->ops; +#if 0 + switch(t->current_type) { + case TUNER_XCEIVE_XC3028: + tuner_dbg("%s: releasing %s tuner!\n",__FILE__,ops->info.name); + ops->release(ops); + + symbol_put(xc3028_attach); + + t->current_type = TUNER_ABSENT; + break; + } +#endif + t->ops = NULL; + return 0; +} + +static int request_tuner(struct i2c_client *c, unsigned int type) +{ + struct tuner *t = i2c_get_clientdata(c); + struct v4l_dvb_tuner_ops *arg; + + + if (t->ops){ + tuner_dbg("%s: tuner structure already initialized!\n",__FILE__); + return 0; + } + + /* free previous run */ + if ( t->current_type != TUNER_ABSENT ) + put_tuner(c); + + arg = kzalloc(sizeof(struct v4l_dvb_tuner_ops),GFP_KERNEL); + arg->ioctl = v4l_dvb_tuner_ioctl; + arg->dev = c; + + +#if 0 + switch(type) { + case TUNER_XCEIVE_XC3028: + { + struct xc3028_config *config = NULL; + struct v4l_dvb_tuner_ops *(*tuner_init)(struct v4l_dvb_tuner_ops *, struct i2c_adapter *, struct xc3028_config *); + + tuner_init = (void*)symbol_request(xc3028_attach); + if (tuner_init ) { + if (t->tuner_config) { + config = t->tuner_config; + config->current_mode = t->tuner_mode; + } + + t->current_type = TUNER_XCEIVE_XC3028; + + if(tuner_init(arg, c->adapter, config)) { + tuner_dbg("%s: xc3028 tuner successfully loaded\n",__FILE__); + t->ops = arg; + return MODULE_LOADED; + } else { + tuner_dbg("%s: unable to attach xc3028 tuner\n",__FILE__); + put_tuner(c); + return MODULE_FAILED; + } + + } else { + tuner_dbg("%s: xc3028 tuner requested, unable to load xc3028-tuner module\n",__FILE__); + tuner_dbg("%s: be sure module autoloading is enabled in your kernel\n",__FILE__); + return MODULE_FAILED; + } + } + break; + } +#endif + kfree(arg); + return 0; +} + + static void set_type(struct i2c_client *c, unsigned int type, unsigned int new_mode_mask, unsigned int new_config, - int (*tuner_callback) (void *dev, int command,int arg)) + int (*tuner_callback) (void *dev, int command,int arg), int caller) { struct tuner *t = i2c_get_clientdata(c); unsigned char buffer[4]; - if (type == UNSET || type == TUNER_ABSENT) { - tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr); + if (caller == TUNER_ATTACH) + t->setup_done=1; /* now it's safe to call set_type again */ + + t->type = type; + t->config = new_config; + + if (tuner_callback != NULL) { + tuner_dbg("%s: setting tuner callback\n",__FILE__); + t->tuner_callback = tuner_callback; + } + + if (type == TUNER_ABSENT) return; - } - + + + if (caller == SET_ATTR && t->setup_done == 0) { + tuner_dbg("tuner 0x%02x: Configuration acknowledged\n",c->addr); + return; /* we do not want another setupcall here */ + } + + /* TODO: tuner_count is an array count over struct tunertype tuners, since there + are DVB-T only tuners available which also use the attach mechanism + this doesn't work out anymore. */ + +#if 0 if (type >= tuner_count) { tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count); return; } - - t->type = type; - t->config = new_config; - if (tuner_callback != NULL) { - tuner_dbg("defining GPIO callback\n"); - t->tuner_callback = tuner_callback; - } - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - /* This code detects calls by card attach_inform */ - if (NULL == t->i2c.dev.driver) { - tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr); - - return; - } -#endif +#endif + + /* load modularized tuner extension, and return */ + + switch(request_tuner(c,type)) { + case MODULE_LOADED: + return; + case MODULE_FAILED: + tuner_dbg("%s: set_type, failed to load tuner extension\n",__FILE__); + return; + } /* discard private data, in case set_type() was previously called */ - if (t->ops.release) - t->ops.release(c); + if (t->oldops.release) + t->oldops.release(c); else { kfree(t->priv); t->priv = NULL; @@ -260,11 +373,6 @@ static void set_type(struct i2c_client * case TUNER_TDA9887: tda9887_tuner_init(c); break; -#ifdef CONFIG_XC3028 - case TUNER_XCEIVE_XC3028: - xc3028_init(c); - break; -#endif default: default_tuner_init(c); break; @@ -302,8 +410,10 @@ static void set_addr(struct i2c_client * if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) && (t->mode_mask & tun_setup->mode_mask))) || (tun_setup->addr == c->addr)) { + t->tuner_mode = tun_setup->tuner_mode; /* initial mode of tuner */ + t->tuner_config = tun_setup->tuner_config; set_type(c, tun_setup->type, tun_setup->mode_mask, - tun_setup->config, tun_setup->tuner_callback); + tun_setup->config, tun_setup->tuner_callback, SET_ATTR); } } @@ -470,11 +580,11 @@ static void tuner_status(struct i2c_clie tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); if (t->mode != V4L2_TUNER_RADIO) return; - if (t->ops.has_signal) { - tuner_info("Signal strength: %d\n", t->ops.has_signal(client)); - } - if (t->ops.is_stereo) { - tuner_info("Stereo: %s\n", t->ops.is_stereo(client) ? "yes" : "no"); + if (t->oldops.has_signal) { + tuner_info("Signal strength: %d\n", t->oldops.has_signal(client)); + } + if (t->oldops.is_stereo) { + tuner_info("Stereo: %s\n", t->oldops.is_stereo(client) ? "yes" : "no"); } } @@ -506,7 +616,7 @@ static int tuner_attach(struct i2c_adapt t->type = UNSET; t->audmode = V4L2_TUNER_MODE_STEREO; t->mode_mask = T_UNINITIALIZED; - t->ops.tuner_status = tuner_status; + t->oldops.tuner_status = tuner_status; if (show_i2c) { unsigned char buffer[16]; @@ -516,8 +626,8 @@ static int tuner_attach(struct i2c_adapt rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer)); tuner_info("I2C RECV = "); for (i=0;iid == I2C_HW_SAA7146 && addr < 0x4a) @@ -582,7 +692,7 @@ register_client: register_client: tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); i2c_attach_client (&t->i2c); - set_type (&t->i2c,t->type, t->mode_mask, t->config, t->tuner_callback); + set_type (&t->i2c,t->type, t->mode_mask, t->config, t->tuner_callback, TUNER_ATTACH); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) MOD_INC_USE_COUNT; #endif @@ -613,6 +723,9 @@ static int tuner_detach(struct i2c_clien struct tuner *t = i2c_get_clientdata(client); int err; + if (t->ops) + put_tuner(client); + err = i2c_detach_client(&t->i2c); if (err) { tuner_warn @@ -623,8 +736,8 @@ static int tuner_detach(struct i2c_clien #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) MOD_DEC_USE_COUNT; #endif - if (t->ops.release) - t->ops.release(client); + if (t->oldops.release) + t->oldops.release(client); else { kfree(t->priv); #if 0 @@ -644,15 +757,30 @@ MOD_DEC_USE_COUNT; static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) { + struct dvb_int_frontend_parameters params; + + /* external moduls should decide if they want to switch or not */ + if (t->ops) { + params.std = t->std; + params.type = mode; + t->mode = mode; + if(t->ops->set_mode) { + t->ops->set_mode(t->ops, ¶ms); + } + return 0; + } + if (mode == t->mode) return 0; t->mode = mode; + + if (check_mode(t, cmd) == EINVAL) { t->mode = T_STANDBY; - if (t->ops.standby) - t->ops.standby (client); + if (t->oldops.standby) + t->oldops.standby (client); return EINVAL; } return 0; @@ -696,19 +824,32 @@ static int tuner_command(struct i2c_clie set_addr(client, (struct tuner_setup *)arg); break; case AUDC_SET_RADIO: - if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") - == EINVAL) - return 0; - if (t->radio_freq) - set_freq(client, t->radio_freq); - break; + { + struct dvb_int_frontend_parameters params; + if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") + == EINVAL) + return 0; + + if(t->ops && t->ops->set_params) { + params.std = (__u64)t->std; + params.type = t->mode; + params.frequency = t->radio_freq; + t->ops->set_params(t->ops, ¶ms); + } else if (t->radio_freq) + set_freq(client, t->radio_freq); + break; + } case TUNER_SET_STANDBY: - if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) - return 0; - t->mode = T_STANDBY; - if (t->ops.standby) - t->ops.standby (client); - break; + { + if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) + return 0; + t->mode = T_STANDBY; + if (t->ops && t->ops->sleep) + t->ops->sleep(t->ops); + else if (t->oldops.standby) + t->oldops.standby (client); + break; + } #ifdef CONFIG_VIDEO_V4L1 case VIDIOCSAUDIO: if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) @@ -766,10 +907,10 @@ static int tuner_command(struct i2c_clie return 0; if (V4L2_TUNER_RADIO == t->mode) { - if (t->ops.has_signal) - vt->signal = t->ops.has_signal(client); - if (t->ops.is_stereo) { - if (t->ops.is_stereo(client)) + if (t->oldops.has_signal) + vt->signal = t->oldops.has_signal(client); + if (t->oldops.is_stereo) { + if (t->oldops.is_stereo(client)) vt->flags |= VIDEO_TUNER_STEREO_ON; else @@ -797,8 +938,8 @@ static int tuner_command(struct i2c_clie if (check_v4l2(t) == EINVAL) return 0; - if (V4L2_TUNER_RADIO == t->mode && t->ops.is_stereo) - va->mode = t->ops.is_stereo(client) + if (V4L2_TUNER_RADIO == t->mode && t->oldops.is_stereo) + va->mode = t->oldops.is_stereo(client) ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; return 0; } @@ -817,6 +958,7 @@ static int tuner_command(struct i2c_clie case VIDIOC_S_STD: { v4l2_std_id *id = arg; + struct dvb_int_frontend_parameters params; if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") == EINVAL) @@ -826,19 +968,40 @@ static int tuner_command(struct i2c_clie t->std = *id; tuner_fixup_std(t); - if (t->tv_freq) - set_freq(client, t->tv_freq); + if(t->ops && t->ops->set_params) { + params.std = (__u64)t->std; + params.type = t->mode; + params.frequency = t->tv_freq; + t->ops->set_params(t->ops, ¶ms); + } else + if (t->tv_freq) + set_freq(client, t->tv_freq); + break; + } + case VIDIOC_INT_S_TUNER_MODE: + { + int *mode = arg; + set_mode(client, t, *mode, "VIDIOC_INT_S_MODE"); break; } case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *f = arg; + struct dvb_int_frontend_parameters params; if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") == EINVAL) return 0; switch_v4l2(); - set_freq(client,f->frequency); + if(t->ops && t->ops->set_params) { + params.std = (__u64)t->std; + params.type = t->mode; + params.frequency = f->frequency; + t->tv_freq = f->frequency; + t->ops->set_params(t->ops, ¶ms); + } else { + set_freq(client,f->frequency); + } break; } @@ -849,9 +1012,14 @@ static int tuner_command(struct i2c_clie if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL) return 0; switch_v4l2(); + + f->type = t->mode; - f->frequency = (V4L2_TUNER_RADIO == t->mode) ? - t->radio_freq : t->tv_freq; + if(t->ops && t->ops->get_frequency) + t->ops->get_frequency(t->ops, &f->frequency); + else + f->frequency = (V4L2_TUNER_RADIO == t->mode) ? + t->radio_freq : t->tv_freq; break; } case VIDIOC_G_TUNER: @@ -863,8 +1031,8 @@ static int tuner_command(struct i2c_clie switch_v4l2(); tuner->type = t->mode; - if (t->ops.get_afc) - tuner->afc=t->ops.get_afc(client); + if (t->oldops.get_afc) + tuner->afc=t->oldops.get_afc(client); if (t->mode == V4L2_TUNER_ANALOG_TV) tuner->capability |= V4L2_TUNER_CAP_NORM; if (t->mode != V4L2_TUNER_RADIO) { @@ -874,13 +1042,16 @@ static int tuner_command(struct i2c_clie } /* radio mode */ - if (t->ops.has_signal) - tuner->signal = t->ops.has_signal(client); + if (t->ops && t->ops->get_status) { + /* translate status here, the other callbacks aren't + set if an external module is loaded*/ + } else if (t->oldops.has_signal) + tuner->signal = t->oldops.has_signal(client); tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; - if (t->ops.is_stereo) { - tuner->rxsubchans = t->ops.is_stereo(client) ? + if (t->oldops.is_stereo) { + tuner->rxsubchans = t->oldops.is_stereo(client) ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; } @@ -908,8 +1079,8 @@ static int tuner_command(struct i2c_clie break; } case VIDIOC_LOG_STATUS: - if (t->ops.tuner_status) - t->ops.tuner_status(client); + if (t->oldops.tuner_status) + t->oldops.tuner_status(client); break; } diff -r 76b92a337aec linux/include/media/tuner.h --- a/linux/include/media/tuner.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/include/media/tuner.h Mon Jun 18 14:27:55 2007 +0200 @@ -181,6 +181,8 @@ struct tuner_setup { unsigned int mode_mask; /* Allowed tuner modes */ unsigned int config; /* configuraion for more complex tuners */ int (*tuner_callback) (void *dev, int command,int arg); + void *tuner_config; /* tuner config struct */ + enum v4l2_tuner_type *tuner_mode; }; struct tuner_operations { @@ -208,17 +210,24 @@ struct tuner { u16 last_div; unsigned int audmode; v4l2_std_id std; + void *tuner_config; + int using_v4l2; void *priv; + unsigned int current_type; + /* used by tda9887 */ unsigned int tda9887_config; unsigned int config; int (*tuner_callback) (void *dev, int command,int arg); - - struct tuner_operations ops; + struct v4l_dvb_tuner_ops *ops; + unsigned int setup_done:1; + enum v4l2_tuner_type *tuner_mode; + + struct tuner_operations oldops; }; extern unsigned const int tuner_count; diff -r 76b92a337aec linux/include/media/v4l-dvb-tuner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux/include/media/v4l-dvb-tuner.h Mon Jun 18 14:51:56 2007 +0200 @@ -0,0 +1,150 @@ +#ifndef __V4L_DVB_TUNER_H +#define __V4L_DVB_TUNER_H + +/* frontend.h only conaints the missing struct information here + as a fact there's only dvb related stuff in it so it can + remain as it is +*/ + +#include + +struct dvb_tuner_info { + char name[128]; + + u32 frequency_min; + u32 frequency_max; + u32 frequency_step; + + u32 bandwidth_min; + u32 bandwidth_max; + u32 bandwidth_step; +}; + +enum v4l2_int_tuner_type { + V4L2_INT_TUNER_RADIO = 1, + V4L2_INT_TUNER_ANALOG_TV = 2, + V4L2_INT_TUNER_DIGITAL_TV = 3, + V4L2_INT_TUNER_DVBT_TV = 4, + V4L2_INT_TUNER_DVBC_TV = 5, + V4L2_INT_TUNER_ATSC_TV = 6, + V4L2_INT_TUNER_DVBS_TV = 7, + V4L2_INT_UNINITIALIZED = 8, +}; + + +struct dvb_int_frontend_parameters { + __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ + /* intermediate frequency in kHz for QPSK */ + enum v4l2_int_tuner_type type; + __u64 std; + fe_spectral_inversion_t inversion; + union { + struct dvb_qpsk_parameters qpsk; + struct dvb_qam_parameters qam; + struct dvb_ofdm_parameters ofdm; + struct dvb_vsb_parameters vsb; + } u; +}; + +struct v4l_dvb_tuner_ops { + + void *priv; /* some privat data for internal use */ + void *dev; /* v4l private data for tuner-core */ + struct dvb_frontend *fe; /* dvb_frontend, for dvb only drivers, internal use */ + + struct dvb_tuner_info info; + + int (*ioctl)(struct v4l_dvb_tuner_ops *dev, int cmd, int arg); + + int (*release)(struct v4l_dvb_tuner_ops *fe); + int (*init)(struct v4l_dvb_tuner_ops *fe); + int (*sleep)(struct v4l_dvb_tuner_ops *fe); + + /** This is for simple PLLs - set all parameters in one go. */ + int (*set_params)(struct v4l_dvb_tuner_ops *fe, struct dvb_int_frontend_parameters *p); + + /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */ + int (*calc_regs)(struct v4l_dvb_tuner_ops *fe, struct dvb_int_frontend_parameters *p, u8 *buf, int buf_len); + + int (*get_frequency)(struct v4l_dvb_tuner_ops *fe, u32 *frequency); + int (*get_bandwidth)(struct v4l_dvb_tuner_ops *fe, u32 *bandwidth); + +#define TUNER_STATUS_LOCKED 1 + int (*get_status)(struct v4l_dvb_tuner_ops *fe, u32 *status); + + /** These are provided seperately from set_params in order to facilitate silicon + * tuners which require sophisticated tuning loops, controlling each parameter seperately. */ + int (*set_frequency)(struct v4l_dvb_tuner_ops *fe, u32 frequency); + int (*set_bandwidth)(struct v4l_dvb_tuner_ops *fe, u32 bandwidth); + + int (*set_mode)(struct v4l_dvb_tuner_ops *dev, struct dvb_int_frontend_parameters *params); +}; + +#define V4L_OPS(i) ({ \ + struct dvb_int_frontend_parameters __o; \ + __o.frequency = i->frequency; \ + __o.inversion = i->inversion; \ + __o.std = (__u64)0; \ + switch(fe->ops.info.type) { \ + case FE_OFDM: \ + __o.type = V4L2_INT_TUNER_DVBT_TV; \ + break; \ + case FE_QAM: \ + __o.type = V4L2_INT_TUNER_DVBC_TV; \ + break; \ + case FE_ATSC: \ + __o.type = V4L2_INT_TUNER_ATSC_TV; \ + break; \ + case FE_QPSK: \ + __o.type = V4L2_INT_TUNER_DVBS_TV; \ + break; \ + } \ + memcpy(&__o.u, &i->u, sizeof(__o.u)); \ + &__o; \ +}) + +/* current external dvb tuner modules require the dvb_frontend struct + and use to store some priv data with it, tuner_cpy does not + overwrite the priv pointers, if this can be removed then + memcpy could be used again + + for those who don't know these gcc macros: + http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html +*/ + +#define tuner_cpy(__z,__y) ({ \ + if (__y.info.name) \ + strcpy(__z->info.name, __y.info.name); \ + if (__y.info.frequency_min) \ + __z->info.frequency_min = __y.info.frequency_min; \ + if (__y.info.frequency_max) \ + __z->info.frequency_max = __y.info.frequency_max; \ + if (__y.info.frequency_step) \ + __z->info.frequency_step = __y.info.frequency_step; \ + if (__y.release) \ + __z->release = __y.release; \ + if (__y.init) \ + __z->init = __y.init; \ + if (__y.sleep) \ + __z->sleep = __y.sleep; \ + if (__y.set_params) \ + __z->set_params = __y.set_params; \ + if (__y.set_mode) \ + __z->set_mode = __y.set_mode; \ + if (__y.get_frequency) \ + __z->get_frequency = __y.get_frequency; \ + if (__y.set_frequency) \ + __z->set_frequency = __y.set_frequency; \ + if (__y.get_bandwidth) \ + __z->get_bandwidth = __y.get_bandwidth; \ + if (__y.set_bandwidth) \ + __z->set_bandwidth = __y.set_bandwidth; \ + if (__y.calc_regs) \ + __z->calc_regs = __y.calc_regs; \ + if (__y.ioctl) \ + __z->ioctl = __y.ioctl; \ + if (__y.get_status) \ + __z->get_status = __y.get_status; \ +}) + +#endif diff -r 76b92a337aec linux/include/media/v4l2-common.h --- a/linux/include/media/v4l2-common.h Wed Jun 13 15:11:15 2007 -0300 +++ b/linux/include/media/v4l2-common.h Mon Jun 18 14:27:55 2007 +0200 @@ -140,7 +140,7 @@ struct v4l2_decode_vbi_line { #define TDA9887_SET_CONFIG _IOW('d', 92, int) /* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */ -#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type) +#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, unsigned int) /* Generic standby command. Passing -1 (all bits set to 1) will put the whole chip into standby mode, value 0 will make the chip fully active. Specific