diff -Naurp v4l-dvb/linux/drivers/media/dvb/ttpci/av7110.c mp-bc1/linux/drivers/media/dvb/ttpci/av7110.c --- v4l-dvb/linux/drivers/media/dvb/ttpci/av7110.c 2006-06-30 19:59:10.000000000 +0400 +++ mp-bc1/linux/drivers/media/dvb/ttpci/av7110.c 2006-07-08 02:30:47.000000000 +0400 @@ -1548,7 +1548,39 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = (struct av7110*) fe->dvb->priv; + u8 pwr = 0; + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + u32 div = (params->frequency + 479500) / 125; + + if (params->frequency > 2000000) pwr = 3; + else if (params->frequency > 1800000) pwr = 2; + else if (params->frequency > 1600000) pwr = 1; + else if (params->frequency > 1200000) pwr = 0; + else if (params->frequency >= 1100000) pwr = 1; + else pwr = 2; + + buf[0] = (div >> 8) & 0x7f; + buf[1] = div & 0xff; + buf[2] = ((div & 0x18000) >> 10) | 0x95; + buf[3] = (pwr << 6) | 0x30; + + // NOTE: since we're using a prescaler of 2, we set the + // divisor frequency to 62.5kHz and divide by 125 above + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&av7110->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = (struct av7110*) fe->dvb->priv; u8 pwr = 0; @@ -1584,7 +1616,30 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (params->frequency + 35937500 + 31250) / 62500; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x85 | ((div >> 10) & 0x60); + data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = fe->dvb->priv; u32 div; @@ -1615,7 +1670,29 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = params->frequency / 125; + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x8e; + data[3] = 0x00; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = fe->dvb->priv; u32 div; @@ -1641,7 +1718,31 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = fe->dvb->priv; + u32 div; + u32 f = params->frequency; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (f + 36125000 + 31250) / 62500; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x8e; + data[3] = (f < 174000000 ? 0xa1 : f < 470000000 ? 0x92 : 0x34); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int philips_cd1516_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = fe->dvb->priv; u32 div; @@ -1672,7 +1773,35 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = fe->dvb->priv; + u32 div, pwr; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (params->frequency + 36200000) / 166666; + + if (params->frequency <= 782000000) + pwr = 1; + else + pwr = 2; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x85; + data[3] = pwr << 6; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int alps_tdlb7_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = fe->dvb->priv; u32 div, pwr; @@ -1805,7 +1934,54 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x63, .flags = 0, .buf = data, .len = sizeof(data) }; + struct i2c_msg readmsg = { .addr = 0x63, .flags = I2C_M_RD, .buf = data, .len = 1 }; + int i; + + div = (params->frequency + 36150000 + 31250) / 62500; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0xce; + + if (params->frequency < 45000000) + return -EINVAL; + else if (params->frequency < 137000000) + data[3] = 0x01; + else if (params->frequency < 403000000) + data[3] = 0x02; + else if (params->frequency < 860000000) + data[3] = 0x04; + else + return -EINVAL; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &msg, 1) != 1) { + printk("nexusca: pll transfer failed!\n"); + return -EIO; + } + + // wait for PLL lock + for(i = 0; i < 20; i++) { + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&av7110->i2c_adap, &readmsg, 1) == 1) + if (data[0] & 0x40) break; + msleep(10); + } + + return 0; +} + +static int nexusca_stv0297_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = fe->dvb->priv; u32 div; @@ -1860,7 +2036,42 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters *params) +{ + struct av7110* av7110 = (struct av7110*) fe->dvb->priv; + u32 div; + u8 cfg, cpump, band_select; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (36125000 + params->frequency) / 166666; + + cfg = 0x88; + + if (params->frequency < 175000000) cpump = 2; + else if (params->frequency < 390000000) cpump = 1; + else if (params->frequency < 470000000) cpump = 2; + else if (params->frequency < 750000000) cpump = 1; + else cpump = 3; + + if (params->frequency < 175000000) band_select = 0x0e; + else if (params->frequency < 470000000) band_select = 0x05; + else band_select = 0x03; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = ((div >> 10) & 0x60) | cfg; + data[3] = (cpump << 6) | band_select; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&av7110->i2c_adap, &msg, 1) != 1) return -EIO; + return 0; +} + +static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params *params) { struct av7110* av7110 = (struct av7110*) fe->dvb->priv; u32 div; @@ -2081,6 +2292,7 @@ static int frontend_init(struct av7110 * av7110->fe = ves1820_attach(&philips_cd1516_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = philips_cd1516_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = philips_cd1516_tuner_set_params; } break; @@ -2095,6 +2307,7 @@ static int frontend_init(struct av7110 * // try the ALPS BSRV2 first of all av7110->fe = ves1x93_attach(&alps_bsrv2_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_bsrv2_tuner_set_params_compat; 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; @@ -2106,6 +2319,7 @@ static int frontend_init(struct av7110 * // try the ALPS BSRU6 now av7110->fe = stv0299_attach(&alps_bsru6_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_bsru6_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; av7110->fe->tuner_priv = &av7110->i2c_adap; @@ -2119,6 +2333,7 @@ static int frontend_init(struct av7110 * // Try the grundig 29504-451 av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = grundig_29504_451_tuner_set_params_compat; 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; @@ -2134,6 +2349,7 @@ static int frontend_init(struct av7110 * av7110->fe = ves1820_attach(&philips_cd1516_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = philips_cd1516_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = philips_cd1516_tuner_set_params; } break; @@ -2142,6 +2358,7 @@ static int frontend_init(struct av7110 * av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_tdbe2_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; } break; @@ -2153,6 +2370,7 @@ static int frontend_init(struct av7110 * // ALPS TDLB7 av7110->fe = sp8870_attach(&alps_tdlb7_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_tdlb7_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = alps_tdlb7_tuner_set_params; } break; @@ -2161,6 +2379,7 @@ static int frontend_init(struct av7110 * av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_tdbe2_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; } break; @@ -2169,7 +2388,7 @@ static int frontend_init(struct av7110 * /* ALPS BSRV2 */ av7110->fe = ves1x93_attach(&alps_bsrv2_config, &av7110->i2c_adap); if (av7110->fe) { - av7110->fe->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params; + av7110->fe->ops.tuner_ops.set_params_compat = alps_bsrv2_tuner_set_params_compat; av7110->fe->ops.diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; av7110->fe->ops.diseqc_send_burst = av7110_diseqc_send_burst; av7110->fe->ops.set_tone = av7110_set_tone; @@ -2181,6 +2400,7 @@ static int frontend_init(struct av7110 * /* Grundig 29504-451 */ av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = grundig_29504_451_tuner_set_params_compat; 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; @@ -2193,6 +2413,7 @@ static int frontend_init(struct av7110 * av7110->fe = l64781_attach(&grundig_29504_401_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = grundig_29504_401_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params; } break; @@ -2201,6 +2422,7 @@ static int frontend_init(struct av7110 * av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = nexusca_stv0297_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; /* set TDA9819 into DVB mode */ @@ -2217,6 +2439,7 @@ static int frontend_init(struct av7110 * /* ALPS BSBE1 */ av7110->fe = stv0299_attach(&alps_bsbe1_config, &av7110->i2c_adap); if (av7110->fe) { + av7110->fe->ops.tuner_ops.set_params_compat = alps_bsbe1_tuner_set_params_compat; av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; av7110->fe->tuner_priv = &av7110->i2c_adap; diff -Naurp v4l-dvb/linux/drivers/media/dvb/ttpci/budget-av.c mp-bc1/linux/drivers/media/dvb/ttpci/budget-av.c --- v4l-dvb/linux/drivers/media/dvb/ttpci/budget-av.c 2006-06-30 19:59:10.000000000 +0400 +++ mp-bc1/linux/drivers/media/dvb/ttpci/budget-av.c 2006-07-23 11:45:16.000000000 +0400 @@ -512,8 +512,8 @@ 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_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { u32 div; u8 buf[4]; @@ -551,8 +551,8 @@ static int philips_su1278_ty_ci_tuner_se #define MIN2(a,b) ((a) < (b) ? (a) : (b)) #define MIN3(a,b,c) MIN2(MIN2(a,b),c) -static int philips_su1278sh2_tua6100_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int philips_su1278sh2_tua6100_tuner_set_params_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { u8 reg0 [2] = { 0x00, 0x00 }; u8 reg1 [4] = { 0x01, 0x00, 0x00, 0x00 }; @@ -765,7 +765,7 @@ 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_compat(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct budget *budget = (struct budget *) fe->dvb->priv; u8 buf[4]; @@ -811,7 +811,7 @@ 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_compat(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct budget *budget = (struct budget *) fe->dvb->priv; u8 tuner_buf[4]; @@ -956,8 +956,8 @@ static u8 philips_sd1878_inittab[] = { 0xff, 0xff }; -static int philips_sd1878_tda8261_tuner_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int philips_sd1878_tda8261_tuner_set_params_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { u8 buf[4]; int rc; @@ -1101,13 +1101,13 @@ static void frontend_init(struct budget_ fe = stv0299_attach(&cinergy_1200s_1894_0010_config, &budget_av->budget.i2c_adap); if (fe) { - fe->ops.tuner_ops.set_params = philips_su1278sh2_tua6100_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_su1278sh2_tua6100_tuner_set_params_compat; } } else { fe = stv0299_attach(&typhoon_config, &budget_av->budget.i2c_adap); if (fe) { - fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_su1278_ty_ci_tuner_set_params_compat; } } break; @@ -1119,7 +1119,7 @@ static void frontend_init(struct budget_ fe = stv0299_attach(&philips_sd1878_config, &budget_av->budget.i2c_adap); if (fe) { - fe->ops.tuner_ops.set_params = philips_sd1878_tda8261_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_sd1878_tda8261_tuner_set_params_compat; } break; @@ -1128,7 +1128,7 @@ static void frontend_init(struct budget_ fe = stv0299_attach(&typhoon_config, &budget_av->budget.i2c_adap); if (fe) { - fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_su1278_ty_ci_tuner_set_params_compat; } break; @@ -1136,7 +1136,7 @@ static void frontend_init(struct budget_ fe = stv0299_attach(&cinergy_1200s_config, &budget_av->budget.i2c_adap); if (fe) { - fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_su1278_ty_ci_tuner_set_params_compat; } break; @@ -1146,7 +1146,7 @@ static void frontend_init(struct budget_ &budget_av->budget.i2c_adap, read_pwm(budget_av)); if (fe) { - fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_cu1216_tuner_set_params_compat; } break; @@ -1160,7 +1160,7 @@ static void frontend_init(struct budget_ budget_av->tda10021_poclkp = 1; budget_av->tda10021_set_frontend = fe->ops.set_frontend; fe->ops.set_frontend = tda10021_set_frontend; - fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_cu1216_tuner_set_params_compat; } break; @@ -1172,7 +1172,7 @@ static void frontend_init(struct budget_ &budget_av->budget.i2c_adap); if (fe) { fe->ops.tuner_ops.init = philips_tu1216_tuner_init; - fe->ops.tuner_ops.set_params = philips_tu1216_tuner_set_params; + fe->ops.tuner_ops.set_params_compat = philips_tu1216_tuner_set_params_compat; } break; } diff -Naurp v4l-dvb/linux/drivers/media/dvb/ttpci/budget.c mp-bc1/linux/drivers/media/dvb/ttpci/budget.c --- v4l-dvb/linux/drivers/media/dvb/ttpci/budget.c 2006-06-30 19:59:10.000000000 +0400 +++ mp-bc1/linux/drivers/media/dvb/ttpci/budget.c 2006-07-23 11:45:42.000000000 +0400 @@ -186,7 +186,38 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u8 pwr = 0; + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + u32 div = (params->frequency + 479500) / 125; + + if (params->frequency > 2000000) pwr = 3; + else if (params->frequency > 1800000) pwr = 2; + else if (params->frequency > 1600000) pwr = 1; + else if (params->frequency > 1200000) pwr = 0; + else if (params->frequency >= 1100000) pwr = 1; + else pwr = 2; + + buf[0] = (div >> 8) & 0x7f; + buf[1] = div & 0xff; + buf[2] = ((div & 0x18000) >> 10) | 0x95; + buf[3] = (pwr << 6) | 0x30; + + // NOTE: since we're using a prescaler of 2, we set the + // divisor frequency to 62.5kHz and divide by 125 above + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + return 0; +} + +static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget* budget = (struct budget*) fe->dvb->priv; u8 pwr = 0; @@ -222,7 +253,29 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (params->frequency + 35937500 + 31250) / 62500; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x85 | ((div >> 10) & 0x60); + data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + return 0; +} + +static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; @@ -249,7 +302,42 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u32 div; + u8 cfg, cpump, band_select; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = (36125000 + params->frequency) / 166666; + + cfg = 0x88; + + if (params->frequency < 175000000) cpump = 2; + else if (params->frequency < 390000000) cpump = 1; + else if (params->frequency < 470000000) cpump = 2; + else if (params->frequency < 750000000) cpump = 1; + else cpump = 3; + + if (params->frequency < 175000000) band_select = 0x0e; + else if (params->frequency < 470000000) band_select = 0x05; + else band_select = 0x03; + + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = ((div >> 10) & 0x60) | cfg; + data[3] = (cpump << 6) | band_select; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + return 0; +} + +static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; @@ -286,7 +374,28 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = params->frequency / 125; + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x8e; + data[3] = 0x00; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + return 0; +} + +static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; @@ -309,7 +418,37 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = params->frequency / 1000; + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0xc2; + + if (div < 1450) + data[3] = 0x00; + else if (div < 1850) + data[3] = 0x40; + else if (div < 2000) + data[3] = 0x80; + else + data[3] = 0xc0; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + + return 0; +} + +static int s5h1420_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget* budget = (struct budget*) fe->dvb->priv; u32 div; @@ -363,6 +502,7 @@ static void frontend_init(struct budget // try the ALPS BSRV2 first of all budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsrv2_tuner_set_params_compat; 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; @@ -373,6 +513,7 @@ static void frontend_init(struct budget // try the ALPS BSRU6 now budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsru6_tuner_set_params_compat; 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.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; @@ -386,6 +527,7 @@ static void frontend_init(struct budget budget->dvb_frontend = ves1820_attach(&alps_tdbe2_config, &budget->i2c_adap, read_pwm(budget)); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_tdbe2_tuner_set_params_compat; budget->dvb_frontend->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; break; } @@ -395,6 +537,7 @@ static void frontend_init(struct budget budget->dvb_frontend = l64781_attach(&grundig_29504_401_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = grundig_29504_401_tuner_set_params_compat; budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params; break; } @@ -403,6 +546,7 @@ static void frontend_init(struct budget case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsru6_tuner_set_params_compat; 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; @@ -413,6 +557,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 = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = grundig_29504_451_tuner_set_params_compat; 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; @@ -422,6 +567,7 @@ static void frontend_init(struct budget case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = s5h1420_tuner_set_params_compat; budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; if (lnbp21_attach(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { printk("%s: No LNBP21 found!\n", __FUNCTION__); diff -Naurp v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c mp-bc1/linux/drivers/media/dvb/ttpci/budget-ci.c --- v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c 2006-06-30 19:59:10.000000000 +0400 +++ mp-bc1/linux/drivers/media/dvb/ttpci/budget-ci.c 2006-07-23 11:45:20.000000000 +0400 @@ -620,8 +620,8 @@ 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_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u32 div; @@ -656,6 +656,42 @@ static int philips_su1278_tt_tuner_set_p return 0; } +static int philips_su1278_tt_tuner_set_params(struct dvb_frontend *fe, + struct dvbfe_params *params) +{ + struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; + u32 div; + u8 buf[4]; + struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; + + if ((params->frequency < 950000) || (params->frequency > 2150000)) + return -EINVAL; + + div = (params->frequency + (500 - 1)) / 500; // round correctly + buf[0] = (div >> 8) & 0x7f; + buf[1] = div & 0xff; + buf[2] = 0x80 | ((div & 0x18000) >> 10) | 2; + buf[3] = 0x20; + + if (params->delsys.dvbs.symbol_rate < 4000000) + buf[3] |= 1; + + if (params->frequency < 1250000) + buf[3] |= 0; + else if (params->frequency < 1550000) + buf[3] |= 0x40; + else if (params->frequency < 2050000) + buf[3] |= 0x80; + else if (params->frequency < 2150000) + buf[3] |= 0xC0; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + static struct stv0299_config philips_su1278_tt_config = { .demod_address = 0x68, @@ -701,7 +737,8 @@ 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_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u8 tuner_buf[4]; @@ -786,6 +823,92 @@ static int philips_tdm1316l_tuner_set_pa return 0; } +static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, + struct dvbfe_params *params) +{ + 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) }; + int tuner_frequency = 0; + u8 band, cp, filter; + + // determine charge pump + tuner_frequency = params->frequency + 36130000; + if (tuner_frequency < 87000000) + return -EINVAL; + else if (tuner_frequency < 130000000) + cp = 3; + else if (tuner_frequency < 160000000) + cp = 5; + else if (tuner_frequency < 200000000) + cp = 6; + else if (tuner_frequency < 290000000) + cp = 3; + else if (tuner_frequency < 420000000) + cp = 5; + else if (tuner_frequency < 480000000) + cp = 6; + else if (tuner_frequency < 620000000) + cp = 3; + else if (tuner_frequency < 830000000) + cp = 5; + else if (tuner_frequency < 895000000) + cp = 7; + else + return -EINVAL; + + // determine band + if (params->frequency < 49000000) + return -EINVAL; + else if (params->frequency < 159000000) + band = 1; + else if (params->frequency < 444000000) + band = 2; + else if (params->frequency < 861000000) + band = 4; + else + return -EINVAL; + + // setup PLL filter and TDA9889 + switch (params->delsys.dvbt.bandwidth) { + case BANDWIDTH_6_MHZ: + tda1004x_write_byte(fe, 0x0C, 0x14); + filter = 0; + break; + + case BANDWIDTH_7_MHZ: + tda1004x_write_byte(fe, 0x0C, 0x80); + filter = 0; + break; + + case BANDWIDTH_8_MHZ: + tda1004x_write_byte(fe, 0x0C, 0x14); + filter = 1; + break; + + default: + return -EINVAL; + } + + // calculate divisor + // ((36130000+((1000000/6)/2)) + Finput)/(1000000/6) + tuner_frequency = (((params->frequency / 1000) * 6) + 217280) / 1000; + + // setup tuner buffer + tuner_buf[0] = tuner_frequency >> 8; + tuner_buf[1] = tuner_frequency & 0xff; + tuner_buf[2] = 0xca; + tuner_buf[3] = (cp << 5) | (filter << 3) | band; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) + return -EIO; + + msleep(1); + return 0; +} + static int philips_tdm1316l_request_firmware(struct dvb_frontend *fe, const struct firmware **fw, char *name) { @@ -805,7 +928,84 @@ 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_compat(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) +{ + 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, + .flags = 0, + .buf = tuner_buf, + .len = sizeof(tuner_buf) }; + int tuner_frequency = 0; + u8 band, cp, filter; + + // determine charge pump + tuner_frequency = params->frequency + 36125000; + if (tuner_frequency < 87000000) + return -EINVAL; + else if (tuner_frequency < 130000000) { + cp = 3; + band = 1; + } else if (tuner_frequency < 160000000) { + cp = 5; + band = 1; + } else if (tuner_frequency < 200000000) { + cp = 6; + band = 1; + } else if (tuner_frequency < 290000000) { + cp = 3; + band = 2; + } else if (tuner_frequency < 420000000) { + cp = 5; + band = 2; + } else if (tuner_frequency < 480000000) { + cp = 6; + band = 2; + } else if (tuner_frequency < 620000000) { + cp = 3; + band = 4; + } else if (tuner_frequency < 830000000) { + cp = 5; + band = 4; + } else if (tuner_frequency < 895000000) { + cp = 7; + band = 4; + } else + return -EINVAL; + + // assume PLL filter should always be 8MHz for the moment. + filter = 1; + + // calculate divisor + tuner_frequency = (params->frequency + 36125000 + (62500/2)) / 62500; + + // setup tuner buffer + tuner_buf[0] = tuner_frequency >> 8; + tuner_buf[1] = tuner_frequency & 0xff; + tuner_buf[2] = 0xc8; + tuner_buf[3] = (cp << 5) | (filter << 3) | band; + tuner_buf[4] = 0x80; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) + return -EIO; + + msleep(50); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) + return -EIO; + + msleep(1); + + return 0; +} + +static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, + struct dvbfe_params *params) { struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; u8 tuner_buf[5]; @@ -990,6 +1190,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsru6_tuner_set_params_compat; 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; @@ -1000,6 +1201,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = 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.set_params_compat = philips_su1278_tt_tuner_set_params_compat; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_su1278_tt_tuner_set_params; break; } @@ -1010,6 +1212,7 @@ static void frontend_init(struct budget_ budget_ci->budget.dvb_frontend = 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.set_params_compat = dvbc_philips_tdm1316l_tuner_set_params_compat; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; break; } @@ -1021,6 +1224,7 @@ static void frontend_init(struct budget_ 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.set_params_compat = philips_tdm1316l_tuner_set_params_compat; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; } @@ -1032,6 +1236,7 @@ static void frontend_init(struct budget_ tda10046_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.set_params_compat = philips_tdm1316l_tuner_set_params_compat; budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; } @@ -1040,6 +1245,7 @@ static void frontend_init(struct budget_ case 0x1017: // TT S-1500 PCI budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap); if (budget_ci->budget.dvb_frontend) { + budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsbe1_tuner_set_params_compat; 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 -Naurp v4l-dvb/linux/drivers/media/dvb/ttpci/budget-patch.c mp-bc1/linux/drivers/media/dvb/ttpci/budget-patch.c --- v4l-dvb/linux/drivers/media/dvb/ttpci/budget-patch.c 2006-06-30 19:59:10.000000000 +0400 +++ mp-bc1/linux/drivers/media/dvb/ttpci/budget-patch.c 2006-07-23 11:45:33.000000000 +0400 @@ -258,7 +258,39 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; + u8 pwr = 0; + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + u32 div = (params->frequency + 479500) / 125; + + if (params->frequency > 2000000) pwr = 3; + else if (params->frequency > 1800000) pwr = 2; + else if (params->frequency > 1600000) pwr = 1; + else if (params->frequency > 1200000) pwr = 0; + else if (params->frequency >= 1100000) pwr = 1; + else pwr = 2; + + buf[0] = (div >> 8) & 0x7f; + buf[1] = div & 0xff; + buf[2] = ((div & 0x18000) >> 10) | 0x95; + buf[3] = (pwr << 6) | 0x30; + + // NOTE: since we're using a prescaler of 2, we set the + // divisor frequency to 62.5kHz and divide by 125 above + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; u8 pwr = 0; @@ -294,7 +326,29 @@ 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_compat(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; + u32 div; + u8 data[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + div = params->frequency / 125; + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x8e; + data[3] = 0x00; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, + struct dvbfe_params* params) { struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; u32 div; @@ -327,6 +381,7 @@ static void frontend_init(struct budget_ // try the ALPS BSRV2 first of all budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsrv2_tuner_set_params_compat; 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 +392,7 @@ static void frontend_init(struct budget_ // try the ALPS BSRU6 now budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = alps_bsru6_tuner_set_params_compat; budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget->dvb_frontend->tuner_priv = &budget->i2c_adap; @@ -349,6 +405,7 @@ static void frontend_init(struct budget_ // Try the grundig 29504-451 budget->dvb_frontend = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap); if (budget->dvb_frontend) { + budget->dvb_frontend->ops.tuner_ops.set_params_compat = grundig_29504_451_tuner_set_params_compat; 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;
_______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb