From a9ccefdfb8e688f194b7c5aa82f7526c65555215 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 18 Apr 2006 21:47:08 +0100 Subject: create standalone fe_lgh064f header From: Michael Krufky move all pll_set functions for lg-tdvs-h06xf atsc tuners to a standalone header Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/fe_lgh06xf.h | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 linux/drivers/media/dvb/frontends/fe_lgh06xf.h (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/fe_lgh06xf.h b/linux/drivers/media/dvb/frontends/fe_lgh06xf.h new file mode 100644 index 000000000..c5e8b5ff1 --- /dev/null +++ b/linux/drivers/media/dvb/frontends/fe_lgh06xf.h @@ -0,0 +1,66 @@ +/* + * fe_lgh06xf.h - ATSC Tuner support for LG TDVS H06xF + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef FE_LGH06XF_H +#define FE_LGH06XF_H +#include "dvb-pll.h" + +static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_adap, + struct dvb_frontend_parameters* params) +{ + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, + .buf = buf, .len = sizeof(buf) }; + int err; + + dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0); + if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lg_h06xf: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + /* Set the Auxiliary Byte. */ +#if 0 + buf[2] &= ~0x20; + buf[2] |= 0x18; + buf[3] = 0x50; +#else + buf[0] = buf[2]; + buf[0] &= ~0x20; + buf[0] |= 0x18; + buf[1] = 0x50; + msg.len = 2; +#endif + if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lg_h06xf: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + return 0; +} +#endif -- cgit v1.2.3 From 8743017f89633dc04c721dd9f332605aa9e48246 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert at76c651 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/at76c651.c | 25 ++++++++++++++++--------- linux/drivers/media/dvb/frontends/at76c651.h | 4 ---- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/at76c651.c b/linux/drivers/media/dvb/frontends/at76c651.c index ddcb99cc5..556689a80 100644 --- a/linux/drivers/media/dvb/frontends/at76c651.c +++ b/linux/drivers/media/dvb/frontends/at76c651.c @@ -246,9 +246,10 @@ static int at76c651_set_parameters(struct dvb_frontend* fe, int ret; struct at76c651_state* state = fe->demodulator_priv; - at76c651_writereg(state, 0x0c, 0xc3); - state->config->pll_set(fe, p); - at76c651_writereg(state, 0x0c, 0xc2); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } if ((ret = at76c651_set_symbol_rate(state, p->u.qam.symbol_rate))) return ret; @@ -268,12 +269,6 @@ static int at76c651_set_defaults(struct dvb_frontend* fe) at76c651_set_bbfreq(state); at76c651_set_auto_config(state); - if (state->config->pll_init) { - at76c651_writereg(state, 0x0c, 0xc3); - state->config->pll_init(fe); - at76c651_writereg(state, 0x0c, 0xc2); - } - return 0; } @@ -344,6 +339,17 @@ static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) return 0; } +static int at76c651_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct at76c651_state* state = fe->demodulator_priv; + + if (enable) { + return at76c651_writereg(state, 0x0c, 0xc3); + } else { + return at76c651_writereg(state, 0x0c, 0xc2); + } +} + static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *fesettings) { fesettings->min_delay_ms = 50; @@ -414,6 +420,7 @@ static struct dvb_frontend_ops at76c651_ops = { .release = at76c651_release, .init = at76c651_set_defaults, + .i2c_gate_ctrl = at76c651_i2c_gate_ctrl, .set_frontend = at76c651_set_parameters, .get_tune_settings = at76c651_get_tune_settings, diff --git a/linux/drivers/media/dvb/frontends/at76c651.h b/linux/drivers/media/dvb/frontends/at76c651.h index 34054df93..c31db11a2 100644 --- a/linux/drivers/media/dvb/frontends/at76c651.h +++ b/linux/drivers/media/dvb/frontends/at76c651.h @@ -35,10 +35,6 @@ struct at76c651_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, -- cgit v1.2.3 From 97c96aeb1a40db79b142796649ee61c880377e2e Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert cx22700 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/cx22700.c | 26 +++++++++++++++++--------- linux/drivers/media/dvb/frontends/cx22700.h | 4 ---- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx22700.c b/linux/drivers/media/dvb/frontends/cx22700.c index 755f774f6..02fee9047 100644 --- a/linux/drivers/media/dvb/frontends/cx22700.c +++ b/linux/drivers/media/dvb/frontends/cx22700.c @@ -247,12 +247,6 @@ static int cx22700_init (struct dvb_frontend* fe) cx22700_writereg (state, 0x00, 0x01); - if (state->config->pll_init) { - cx22700_writereg (state, 0x0a, 0x00); /* open i2c bus switch */ - state->config->pll_init(fe); - cx22700_writereg (state, 0x0a, 0x01); /* close i2c bus switch */ - } - return 0; } @@ -333,9 +327,11 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ cx22700_writereg (state, 0x00, 0x00); - cx22700_writereg (state, 0x0a, 0x00); /* open i2c bus switch */ - state->config->pll_set(fe, p); - cx22700_writereg (state, 0x0a, 0x01); /* close i2c bus switch */ + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + cx22700_set_inversion (state, p->inversion); cx22700_set_tps (state, &p->u.ofdm); cx22700_writereg (state, 0x37, 0x01); /* PAL loop filter off */ @@ -353,6 +349,17 @@ static int cx22700_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par return cx22700_get_tps (state, &p->u.ofdm); } +static int cx22700_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct cx22700_state* state = fe->demodulator_priv; + + if (enable) { + return cx22700_writereg(state, 0x0a, 0x00); + } else { + return cx22700_writereg(state, 0x0a, 0x01); + } +} + static int cx22700_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) { fesettings->min_delay_ms = 150; @@ -413,6 +420,7 @@ static struct dvb_frontend_ops cx22700_ops = { .release = cx22700_release, .init = cx22700_init, + .i2c_gate_ctrl = cx22700_i2c_gate_ctrl, .set_frontend = cx22700_set_frontend, .get_frontend = cx22700_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/cx22700.h b/linux/drivers/media/dvb/frontends/cx22700.h index c9145b458..dcd8979c1 100644 --- a/linux/drivers/media/dvb/frontends/cx22700.h +++ b/linux/drivers/media/dvb/frontends/cx22700.h @@ -29,10 +29,6 @@ struct cx22700_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, -- cgit v1.2.3 From ba718ac0ff424d206df56b1a7a5126358f0a15ee Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert cx22702 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Remove dvb-pll support - done elsewhere now. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/cx22702.c | 24 ++++-------------------- linux/drivers/media/dvb/frontends/cx22702.h | 7 ------- 2 files changed, 4 insertions(+), 27 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx22702.c b/linux/drivers/media/dvb/frontends/cx22702.c index 0fc899f81..a129fc9cb 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.c +++ b/linux/drivers/media/dvb/frontends/cx22702.c @@ -211,22 +211,10 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet u8 val; struct cx22702_state* state = fe->demodulator_priv; - /* set PLL */ - cx22702_i2c_gate_ctrl(fe, 1); - if (state->config->pll_set) { - state->config->pll_set(fe, p); - } else if (state->config->pll_desc) { - u8 pllbuf[4]; - struct i2c_msg msg = { .addr = state->config->pll_address, - .buf = pllbuf, .len = 4 }; - dvb_pll_configure(state->config->pll_desc, pllbuf, - p->frequency, - p->u.ofdm.bandwidth); - i2c_transfer(state->i2c, &msg, 1); - } else { - BUG(); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); } - cx22702_i2c_gate_ctrl(fe, 0); /* set inversion */ cx22702_set_inversion (state, p->inversion); @@ -358,10 +346,6 @@ static int cx22702_init (struct dvb_frontend* fe) cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02); - /* init PLL */ - if (state->config->pll_init) - state->config->pll_init(fe); - cx22702_i2c_gate_ctrl(fe, 0); return 0; @@ -530,6 +514,7 @@ static struct dvb_frontend_ops cx22702_ops = { .release = cx22702_release, .init = cx22702_init, + .i2c_gate_ctrl = cx22702_i2c_gate_ctrl, .set_frontend = cx22702_set_tps, .get_frontend = cx22702_get_frontend, @@ -540,7 +525,6 @@ static struct dvb_frontend_ops cx22702_ops = { .read_signal_strength = cx22702_read_signal_strength, .read_snr = cx22702_read_snr, .read_ucblocks = cx22702_read_ucblocks, - .i2c_gate_ctrl = cx22702_i2c_gate_ctrl, }; module_param(debug, int, 0644); diff --git a/linux/drivers/media/dvb/frontends/cx22702.h b/linux/drivers/media/dvb/frontends/cx22702.h index 5633976a5..7f2f241e5 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.h +++ b/linux/drivers/media/dvb/frontends/cx22702.h @@ -39,13 +39,6 @@ struct cx22702_config #define CX22702_PARALLEL_OUTPUT 0 #define CX22702_SERIAL_OUTPUT 1 u8 output_mode; - - /* PLL maintenance */ - u8 pll_address; - struct dvb_pll_desc *pll_desc; - - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, -- cgit v1.2.3 From 9a857c4fc991c3689dc1d14e9eb3781d2cb23494 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert mt312 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/mt312.c | 25 ++++++++++++++++--------- linux/drivers/media/dvb/frontends/mt312.h | 4 ---- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/mt312.c b/linux/drivers/media/dvb/frontends/mt312.c index d3aea83cf..46e12a8ac 100644 --- a/linux/drivers/media/dvb/frontends/mt312.c +++ b/linux/drivers/media/dvb/frontends/mt312.c @@ -277,12 +277,6 @@ static int mt312_initfe(struct dvb_frontend* fe) if ((ret = mt312_writereg(state, CS_SW_LIM, 0x69)) < 0) return ret; - if (state->config->pll_init) { - mt312_writereg(state, GPP_CTRL, 0x40); - state->config->pll_init(fe); - mt312_writereg(state, GPP_CTRL, 0x00); - } - return 0; } @@ -529,9 +523,10 @@ static int mt312_set_frontend(struct dvb_frontend* fe, return -EINVAL; } - mt312_writereg(state, GPP_CTRL, 0x40); - state->config->pll_set(fe, p); - mt312_writereg(state, GPP_CTRL, 0x00); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } /* sr = (u16)(sr * 256.0 / 1000000.0) */ sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625); @@ -578,6 +573,17 @@ static int mt312_get_frontend(struct dvb_frontend* fe, return 0; } +static int mt312_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct mt312_state* state = fe->demodulator_priv; + + if (enable) { + return mt312_writereg(state, GPP_CTRL, 0x40); + } else { + return mt312_writereg(state, GPP_CTRL, 0x00); + } +} + static int mt312_sleep(struct dvb_frontend* fe) { struct mt312_state *state = fe->demodulator_priv; @@ -633,6 +639,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = { .init = mt312_initfe, .sleep = mt312_sleep, + .i2c_gate_ctrl = mt312_i2c_gate_ctrl, .set_frontend = mt312_set_frontend, .get_frontend = mt312_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/mt312.h b/linux/drivers/media/dvb/frontends/mt312.h index 074d844f0..666a1bd1c 100644 --- a/linux/drivers/media/dvb/frontends/mt312.h +++ b/linux/drivers/media/dvb/frontends/mt312.h @@ -32,10 +32,6 @@ struct mt312_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, -- cgit v1.2.3 From a66d7de8bc7a3f03f0996b55a783a5b54773022d Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert stv0297 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Remove extra exported pll gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/stv0297.c | 18 ++++++++++-------- linux/drivers/media/dvb/frontends/stv0297.h | 5 ----- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index 54f4414a7..7e8855723 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -276,12 +276,14 @@ static int stv0297_set_inversion(struct stv0297_state *state, fe_spectral_invers return 0; } -int stv0297_enable_plli2c(struct dvb_frontend *fe) +static int stv0297_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { struct stv0297_state *state = fe->demodulator_priv; - stv0297_writereg(state, 0x87, 0x78); - stv0297_writereg(state, 0x86, 0xc8); + if (enable) { + stv0297_writereg(state, 0x87, 0x78); + stv0297_writereg(state, 0x86, 0xc8); + } return 0; } @@ -296,9 +298,6 @@ static int stv0297_init(struct dvb_frontend *fe) stv0297_writereg(state, state->config->inittab[i], state->config->inittab[i+1]); msleep(200); - if (state->config->pll_init) - state->config->pll_init(fe); - return 0; } @@ -421,7 +420,10 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par } stv0297_init(fe); - state->config->pll_set(fe, p); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } /* clear software interrupts */ stv0297_writereg(state, 0x82, 0x0); @@ -668,6 +670,7 @@ static struct dvb_frontend_ops stv0297_ops = { .init = stv0297_init, .sleep = stv0297_sleep, + .i2c_gate_ctrl = stv0297_i2c_gate_ctrl, .set_frontend = stv0297_set_frontend, .get_frontend = stv0297_get_frontend, @@ -684,4 +687,3 @@ MODULE_AUTHOR("Dennis Noermann and Andrew de Quincey"); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(stv0297_attach); -EXPORT_SYMBOL(stv0297_enable_plli2c); diff --git a/linux/drivers/media/dvb/frontends/stv0297.h b/linux/drivers/media/dvb/frontends/stv0297.h index 9e53f019d..8ff793c90 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.h +++ b/linux/drivers/media/dvb/frontends/stv0297.h @@ -37,14 +37,9 @@ struct stv0297_config /* does the "inversion" need inverted? */ u8 invert:1; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, struct i2c_adapter* i2c); -extern int stv0297_enable_plli2c(struct dvb_frontend* fe); #endif // STV0297_H -- cgit v1.2.3 From f9378e87cce2131f14020bac98334a1c92d71c83 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:09 +0100 Subject: Convert tda8083 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda8083.c | 8 +++++--- linux/drivers/media/dvb/frontends/tda8083.h | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda8083.c b/linux/drivers/media/dvb/frontends/tda8083.c index 91baa9ced..0aeaec890 100644 --- a/linux/drivers/media/dvb/frontends/tda8083.c +++ b/linux/drivers/media/dvb/frontends/tda8083.c @@ -293,7 +293,11 @@ static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct tda8083_state* state = fe->demodulator_priv; - state->config->pll_set(fe, p); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + tda8083_set_inversion (state, p->inversion); tda8083_set_fec (state, p->u.qpsk.fec_inner); tda8083_set_symbolrate (state, p->u.qpsk.symbol_rate); @@ -334,8 +338,6 @@ static int tda8083_init(struct dvb_frontend* fe) for (i=0; i<44; i++) tda8083_writereg (state, i, tda8083_init_tab[i]); - if (state->config->pll_init) state->config->pll_init(fe); - tda8083_writereg (state, 0x00, 0x3c); tda8083_writereg (state, 0x00, 0x04); diff --git a/linux/drivers/media/dvb/frontends/tda8083.h b/linux/drivers/media/dvb/frontends/tda8083.h index 466663307..e7a48f61e 100644 --- a/linux/drivers/media/dvb/frontends/tda8083.h +++ b/linux/drivers/media/dvb/frontends/tda8083.h @@ -33,10 +33,6 @@ struct tda8083_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, -- cgit v1.2.3 From 079b0dc26bb807e48641259c368379da67df640b Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert tda80xx to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda80xx.c | 19 ++++++++++++++++--- linux/drivers/media/dvb/frontends/tda80xx.h | 4 ---- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda80xx.c b/linux/drivers/media/dvb/frontends/tda80xx.c index 051be86b3..7954e8732 100644 --- a/linux/drivers/media/dvb/frontends/tda80xx.c +++ b/linux/drivers/media/dvb/frontends/tda80xx.c @@ -523,9 +523,10 @@ static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct tda80xx_state* state = fe->demodulator_priv; - tda80xx_writereg(state, 0x1c, 0x80); - state->config->pll_set(fe, p); - tda80xx_writereg(state, 0x1c, 0x00); + if (fe->ops->tuner_ops->set_params) { + fe->ops->tuner_ops->set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } tda80xx_set_parameters(state, p->inversion, p->u.qpsk.symbol_rate, p->u.qpsk.fec_inner); tda80xx_set_clk(state); @@ -628,6 +629,17 @@ static void tda80xx_release(struct dvb_frontend* fe) kfree(state); } +static int tda80xx_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct tda80xx_state* state = fe->demodulator_priv; + + if (enable) { + return tda80xx_writereg(state, 0x1c, 0x80); + } else { + return tda80xx_writereg(state, 0x1c, 0x00); + } +} + static struct dvb_frontend_ops tda80xx_ops; struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, @@ -709,6 +721,7 @@ static struct dvb_frontend_ops tda80xx_ops = { .init = tda80xx_init, .sleep = tda80xx_sleep, + .i2c_gate_ctrl = tda80xx_i2c_gate_ctrl, .set_frontend = tda80xx_set_frontend, .get_frontend = tda80xx_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/tda80xx.h b/linux/drivers/media/dvb/frontends/tda80xx.h index cd639a0aa..435dd9477 100644 --- a/linux/drivers/media/dvb/frontends/tda80xx.h +++ b/linux/drivers/media/dvb/frontends/tda80xx.h @@ -39,10 +39,6 @@ struct tda80xx_config /* Register setting to use for 18v */ u8 volt18setting; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, -- cgit v1.2.3 From 27c56fe609a585291d4da99709ad8f2fa230a6be Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert ves1820 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/ves1820.c | 9 +++++---- linux/drivers/media/dvb/frontends/ves1820.h | 4 ---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index ad8647a3c..9810e2dcb 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -204,9 +204,6 @@ static int ves1820_init(struct dvb_frontend* fe) ves1820_writereg(state, 0x34, state->pwm); - if (state->config->pll_init) - state->config->pll_init(fe); - return 0; } @@ -223,7 +220,11 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p if (real_qam < 0 || real_qam > 4) return -EINVAL; - state->config->pll_set(fe, p); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + ves1820_set_symbolrate(state, p->u.qam.symbol_rate); ves1820_writereg(state, 0x34, state->pwm); diff --git a/linux/drivers/media/dvb/frontends/ves1820.h b/linux/drivers/media/dvb/frontends/ves1820.h index 355f130b1..520f09522 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.h +++ b/linux/drivers/media/dvb/frontends/ves1820.h @@ -39,10 +39,6 @@ struct ves1820_config /* SELAGC control */ u8 selagc:1; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, -- cgit v1.2.3 From 0d09d01434eb3d027d7ea74534ad8ee7047612aa Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert ves1x93 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/ves1x93.c | 25 ++++++++++++++++--------- linux/drivers/media/dvb/frontends/ves1x93.h | 4 ---- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/ves1x93.c b/linux/drivers/media/dvb/frontends/ves1x93.c index 821df8e83..660aa7bb9 100644 --- a/linux/drivers/media/dvb/frontends/ves1x93.c +++ b/linux/drivers/media/dvb/frontends/ves1x93.c @@ -278,12 +278,6 @@ static int ves1x93_init (struct dvb_frontend* fe) } } - if (state->config->pll_init) { - ves1x93_writereg(state, 0x00, 0x11); - state->config->pll_init(fe); - ves1x93_writereg(state, 0x00, 0x01); - } - return 0; } @@ -395,9 +389,10 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct ves1x93_state* state = fe->demodulator_priv; - ves1x93_writereg(state, 0x00, 0x11); - state->config->pll_set(fe, p); - ves1x93_writereg(state, 0x00, 0x01); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } ves1x93_set_inversion (state, p->inversion); ves1x93_set_fec (state, p->u.qpsk.fec_inner); ves1x93_set_symbolrate (state, p->u.qpsk.symbol_rate); @@ -442,6 +437,17 @@ static void ves1x93_release(struct dvb_frontend* fe) kfree(state); } +static int ves1x93_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct ves1x93_state* state = fe->demodulator_priv; + + if (enable) { + return ves1x93_writereg(state, 0x00, 0x11); + } else { + return ves1x93_writereg(state, 0x00, 0x01); + } +} + static struct dvb_frontend_ops ves1x93_ops; struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, @@ -523,6 +529,7 @@ static struct dvb_frontend_ops ves1x93_ops = { .init = ves1x93_init, .sleep = ves1x93_sleep, + .i2c_gate_ctrl = ves1x93_i2c_gate_ctrl, .set_frontend = ves1x93_set_frontend, .get_frontend = ves1x93_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/ves1x93.h b/linux/drivers/media/dvb/frontends/ves1x93.h index 1627e37c5..ba88ae085 100644 --- a/linux/drivers/media/dvb/frontends/ves1x93.h +++ b/linux/drivers/media/dvb/frontends/ves1x93.h @@ -38,10 +38,6 @@ struct ves1x93_config /* should PWM be inverted? */ u8 invert_pwm:1; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, -- cgit v1.2.3 From 0eb9bcafc9d4a9704b01ee1261a60cfaa579f658 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert stv0299 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Remove extra exported function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/stv0299.c | 35 ++++++++++++++--------------- linux/drivers/media/dvb/frontends/stv0299.h | 5 ----- 2 files changed, 17 insertions(+), 23 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 5bcd00f79..5a8131023 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -131,13 +131,6 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len return ret == 2 ? 0 : ret; } -int stv0299_enable_plli2c (struct dvb_frontend* fe) -{ - struct stv0299_state* state = fe->demodulator_priv; - - return stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ -} - static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) { dprintk ("%s\n", __FUNCTION__); @@ -457,12 +450,6 @@ static int stv0299_init (struct dvb_frontend* fe) for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); - if (state->config->pll_init) { - stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ - state->config->pll_init(fe, state->i2c); - stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ - } - return 0; } @@ -560,9 +547,10 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par if (state->config->invert) invval = (~invval) & 1; stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); - stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ - state->config->pll_set(fe, state->i2c, p); - stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } stv0299_set_FEC (state, p->u.qpsk.fec_inner); stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); @@ -611,6 +599,17 @@ static int stv0299_sleep(struct dvb_frontend* fe) return 0; } +static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct stv0299_state* state = fe->demodulator_priv; + + if (enable) { + return stv0299_writeregI(state, 0x05, 0xb5); + } else { + return stv0299_writeregI(state, 0x05, 0x35); + } +} + static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) { struct stv0299_state* state = fe->demodulator_priv; @@ -695,6 +694,7 @@ static struct dvb_frontend_ops stv0299_ops = { .init = stv0299_init, .sleep = stv0299_sleep, + .i2c_gate_ctrl = stv0299_i2c_gate_ctrl, .set_frontend = stv0299_set_frontend, .get_frontend = stv0299_get_frontend, @@ -721,9 +721,8 @@ MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver"); MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, " - "Andreas Oberritter, Andrew de Quincey, Kenneth Aafløy"); + "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly"); MODULE_LICENSE("GPL"); -EXPORT_SYMBOL(stv0299_enable_plli2c); EXPORT_SYMBOL(stv0299_writereg); EXPORT_SYMBOL(stv0299_attach); diff --git a/linux/drivers/media/dvb/frontends/stv0299.h b/linux/drivers/media/dvb/frontends/stv0299.h index 32c87b4c2..1504828e4 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.h +++ b/linux/drivers/media/dvb/frontends/stv0299.h @@ -87,14 +87,9 @@ struct stv0299_config /* Set the symbol rate */ int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend *fe, struct i2c_adapter *i2c); - int (*pll_set)(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params); }; extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); -extern int stv0299_enable_plli2c (struct dvb_frontend* fe); extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, struct i2c_adapter* i2c); -- cgit v1.2.3 From 2083f24577e41c4d2457226399956dcfa110da8c Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert sp887x to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/sp887x.c | 34 +++++++++++++++++++----------- linux/drivers/media/dvb/frontends/sp887x.h | 6 ------ 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/sp887x.c b/linux/drivers/media/dvb/frontends/sp887x.c index eb8a60219..543dfa145 100644 --- a/linux/drivers/media/dvb/frontends/sp887x.c +++ b/linux/drivers/media/dvb/frontends/sp887x.c @@ -208,15 +208,6 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware /* bit 0x010: enable data valid signal */ sp887x_writereg(state, 0xd00, 0x010); sp887x_writereg(state, 0x0d1, 0x000); - - /* setup the PLL */ - if (state->config->pll_init) { - sp887x_writereg(state, 0x206, 0x001); - state->config->pll_init(fe); - sp887x_writereg(state, 0x206, 0x000); - } - - printk ("done.\n"); return 0; }; @@ -362,9 +353,16 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, sp887x_microcontroller_stop(state); /* setup the PLL */ - sp887x_writereg(state, 0x206, 0x001); - actual_freq = state->config->pll_set(fe, p); - sp887x_writereg(state, 0x206, 0x000); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, 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); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } else { + actual_freq = p->frequency; + } /* read status reg in order to clear demodulator_priv; + + if (enable) { + return sp887x_writereg(state, 0x206, 0x001); + } else { + return sp887x_writereg(state, 0x206, 0x000); + } +} + static int sp887x_sleep(struct dvb_frontend* fe) { struct sp887x_state* state = fe->demodulator_priv; @@ -589,6 +598,7 @@ static struct dvb_frontend_ops sp887x_ops = { .init = sp887x_init, .sleep = sp887x_sleep, + .i2c_gate_ctrl = sp887x_i2c_gate_ctrl, .set_frontend = sp887x_setup_frontend_parameters, .get_tune_settings = sp887x_get_tune_settings, diff --git a/linux/drivers/media/dvb/frontends/sp887x.h b/linux/drivers/media/dvb/frontends/sp887x.h index 6a05d8f8e..c44b0ebdf 100644 --- a/linux/drivers/media/dvb/frontends/sp887x.h +++ b/linux/drivers/media/dvb/frontends/sp887x.h @@ -13,12 +13,6 @@ struct sp887x_config /* the demodulator's i2c address */ u8 demod_address; - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - - /* this should return the actual frequency tuned to */ - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); - /* request firmware for device */ int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); }; -- cgit v1.2.3 From 55da3e06806a376eb5e0b51bf41f5ba320d6d9fd Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert sp8870 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/sp8870.c | 26 ++++++++++++++++---------- linux/drivers/media/dvb/frontends/sp8870.h | 4 ---- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/sp8870.c b/linux/drivers/media/dvb/frontends/sp8870.c index 73829e647..4d553c0da 100644 --- a/linux/drivers/media/dvb/frontends/sp8870.c +++ b/linux/drivers/media/dvb/frontends/sp8870.c @@ -262,9 +262,10 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, sp8870_microcontroller_stop(state); // set tuner parameters - sp8870_writereg(state, 0x206, 0x001); - state->config->pll_set(fe, p); - sp8870_writereg(state, 0x206, 0x000); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } // sample rate correction bit [23..17] sp8870_writereg(state, 0x0319, 0x000A); @@ -349,13 +350,6 @@ static int sp8870_init (struct dvb_frontend* fe) sp8870_writereg(state, 0x0D00, 0x010); sp8870_writereg(state, 0x0D01, 0x000); - /* setup PLL */ - if (state->config->pll_init) { - sp8870_writereg(state, 0x206, 0x001); - state->config->pll_init(fe); - sp8870_writereg(state, 0x206, 0x000); - } - return 0; } @@ -541,6 +535,17 @@ static int sp8870_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend return 0; } +static int sp8870_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct sp8870_state* state = fe->demodulator_priv; + + if (enable) { + return sp8870_writereg(state, 0x206, 0x001); + } else { + return sp8870_writereg(state, 0x206, 0x000); + } +} + static void sp8870_release(struct dvb_frontend* fe) { struct sp8870_state* state = fe->demodulator_priv; @@ -597,6 +602,7 @@ static struct dvb_frontend_ops sp8870_ops = { .init = sp8870_init, .sleep = sp8870_sleep, + .i2c_gate_ctrl = sp8870_i2c_gate_ctrl, .set_frontend = sp8870_set_frontend, .get_tune_settings = sp8870_get_tune_settings, diff --git a/linux/drivers/media/dvb/frontends/sp8870.h b/linux/drivers/media/dvb/frontends/sp8870.h index f3b555dbc..93afbb969 100644 --- a/linux/drivers/media/dvb/frontends/sp8870.h +++ b/linux/drivers/media/dvb/frontends/sp8870.h @@ -31,10 +31,6 @@ struct sp8870_config /* the demodulator's i2c address */ u8 demod_address; - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); - /* request firmware for device */ int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); }; -- cgit v1.2.3 From 14db495e904eb1d7698b02e28cd00dacf569aa66 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert tda1004x to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Remove europa specific hack (moved into appropriate card driver) Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda1004x.c | 47 +++++++++------------------- linux/drivers/media/dvb/frontends/tda1004x.h | 5 --- 2 files changed, 15 insertions(+), 37 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda1004x.c b/linux/drivers/media/dvb/frontends/tda1004x.c index b83dafa4e..d9abce753 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.c +++ b/linux/drivers/media/dvb/frontends/tda1004x.c @@ -600,13 +600,6 @@ static int tda10045_init(struct dvb_frontend* fe) tda1004x_write_mask(state, TDA1004X_CONFADC1, 0x10, 0); // wake up the ADC - // Init the PLL - if (state->config->pll_init) { - tda1004x_enable_tuner_i2c(state); - state->config->pll_init(fe); - tda1004x_disable_tuner_i2c(state); - } - // tda setup tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream @@ -635,16 +628,6 @@ static int tda10046_init(struct dvb_frontend* fe) return -EIO; } - // Init the tuner PLL - if (state->config->pll_init) { - tda1004x_enable_tuner_i2c(state); - if (state->config->pll_init(fe)) { - printk(KERN_ERR "tda1004x: pll init failed\n"); - return -EIO; - } - tda1004x_disable_tuner_i2c(state); - } - // tda setup tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87); // 100 ppm crystal, select HP stream @@ -712,12 +695,10 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, } // set frequency - tda1004x_enable_tuner_i2c(state); - if (state->config->pll_set(fe, fe_params)) { - printk(KERN_ERR "tda1004x: pll set failed\n"); - return -EIO; + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, fe_params); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); } - tda1004x_disable_tuner_i2c(state); // Hardcoded to use auto as much as possible on the TDA10045 as it // is very unreliable if AUTO mode is _not_ used. @@ -1183,16 +1164,6 @@ static int tda1004x_sleep(struct dvb_frontend* fe) break; case TDA1004X_DEMOD_TDA10046: - if (state->config->pll_sleep != NULL) { - tda1004x_enable_tuner_i2c(state); - state->config->pll_sleep(fe); - if (state->config->if_freq != TDA10046_FREQ_052) { - /* special hack for Philips EUROPA Based boards: - * keep the I2c bridge open for tuner access in analog mode - */ - tda1004x_disable_tuner_i2c(state); - } - } /* set outputs to tristate */ tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xff); tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); @@ -1202,6 +1173,17 @@ static int tda1004x_sleep(struct dvb_frontend* fe) return 0; } +static int tda1004x_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct tda1004x_state* state = fe->demodulator_priv; + + if (enable) { + return tda1004x_enable_tuner_i2c(state); + } else { + return tda1004x_disable_tuner_i2c(state); + } +} + static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) { fesettings->min_delay_ms = 800; @@ -1235,6 +1217,7 @@ static struct dvb_frontend_ops tda10045_ops = { .init = tda10045_init, .sleep = tda1004x_sleep, + .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl, .set_frontend = tda1004x_set_fe, .get_frontend = tda1004x_get_fe, diff --git a/linux/drivers/media/dvb/frontends/tda1004x.h b/linux/drivers/media/dvb/frontends/tda1004x.h index cc0c4af64..b877b23ed 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.h +++ b/linux/drivers/media/dvb/frontends/tda1004x.h @@ -66,11 +66,6 @@ struct tda1004x_config /* AGC configuration */ enum tda10046_agc agc_config; - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - void (*pll_sleep)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); - /* request firmware for device */ /* set this to NULL if the card has a firmware EEPROM */ int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); -- cgit v1.2.3 From 436c44011002f45d14d26754b55f979c63551e81 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert s5h1420 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/s5h1420.c | 39 ++++++++++++++++++----------- linux/drivers/media/dvb/frontends/s5h1420.h | 4 --- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/s5h1420.c b/linux/drivers/media/dvb/frontends/s5h1420.c index d69477596..5dee51154 100644 --- a/linux/drivers/media/dvb/frontends/s5h1420.c +++ b/linux/drivers/media/dvb/frontends/s5h1420.c @@ -584,7 +584,6 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, struct s5h1420_state* state = fe->demodulator_priv; int frequency_delta; struct dvb_frontend_tune_settings fesettings; - u32 tmp; /* check if we should do a fast-tune */ memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); @@ -596,10 +595,17 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, (state->fec_inner == p->u.qpsk.fec_inner) && (state->symbol_rate == p->u.qpsk.symbol_rate)) { - if (state->config->pll_set) { - s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); - state->config->pll_set(fe, p, &tmp); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, 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); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, p->frequency - tmp); + } else { + s5h1420_setfreqoffset(state, 0); } return 0; } @@ -646,9 +652,9 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); /* set tuner PLL */ - if (state->config->pll_set) { - s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); - state->config->pll_set(fe, p, &tmp); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, 0); } @@ -708,6 +714,17 @@ static int s5h1420_get_tune_settings(struct dvb_frontend* fe, return 0; } +static int s5h1420_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct s5h1420_state* state = fe->demodulator_priv; + + if (enable) { + return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); + } else { + return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); + } +} + static int s5h1420_init (struct dvb_frontend* fe) { struct s5h1420_state* state = fe->demodulator_priv; @@ -717,13 +734,6 @@ static int s5h1420_init (struct dvb_frontend* fe) msleep(10); s5h1420_reset(state); - /* init PLL */ - if (state->config->pll_init) { - s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); - state->config->pll_init(fe); - s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); - } - return 0; } @@ -800,6 +810,7 @@ static struct dvb_frontend_ops s5h1420_ops = { .init = s5h1420_init, .sleep = s5h1420_sleep, + .i2c_gate_ctrl = s5h1420_i2c_gate_ctrl, .set_frontend = s5h1420_set_frontend, .get_frontend = s5h1420_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/s5h1420.h b/linux/drivers/media/dvb/frontends/s5h1420.h index 73296f13c..4e39015fa 100644 --- a/linux/drivers/media/dvb/frontends/s5h1420.h +++ b/linux/drivers/media/dvb/frontends/s5h1420.h @@ -32,10 +32,6 @@ struct s5h1420_config /* does the inversion require inversion? */ u8 invert:1; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout); }; extern struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, -- cgit v1.2.3 From 221ca03a6bb8452d31108a42fb3c711abc7f8a90 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert l64871 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/l64781.c | 7 ++++--- linux/drivers/media/dvb/frontends/l64781.h | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/l64781.c b/linux/drivers/media/dvb/frontends/l64781.c index 1c7c91224..fa4a87e00 100644 --- a/linux/drivers/media/dvb/frontends/l64781.c +++ b/linux/drivers/media/dvb/frontends/l64781.c @@ -141,7 +141,10 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa u8 val0x06; int bw = p->bandwidth - BANDWIDTH_8_MHZ; - state->config->pll_set(fe, param); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, param); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } if (param->inversion != INVERSION_ON && param->inversion != INVERSION_OFF) @@ -463,8 +466,6 @@ static int l64781_init(struct dvb_frontend* fe) /* Everything is two's complement, soft bit and CSI_OUT too */ l64781_writereg (state, 0x1e, 0x09); - if (state->config->pll_init) state->config->pll_init(fe); - /* delay a bit after first init attempt */ if (state->first) { state->first = 0; diff --git a/linux/drivers/media/dvb/frontends/l64781.h b/linux/drivers/media/dvb/frontends/l64781.h index 947f65f87..83b8bc210 100644 --- a/linux/drivers/media/dvb/frontends/l64781.h +++ b/linux/drivers/media/dvb/frontends/l64781.h @@ -29,10 +29,6 @@ struct l64781_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; -- cgit v1.2.3 From 34c1d39d5c2da047879453b7daca02c6dc6ee651 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert mt352 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointer from structure. Use standardised pllbuf function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/mt352.c | 7 +++++-- linux/drivers/media/dvb/frontends/mt352.h | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index aaaec909d..a7a347a3c 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -286,9 +286,12 @@ static int mt352_set_parameters(struct dvb_frontend* fe, mt352_calc_nominal_rate(state, op->bandwidth, buf+4); mt352_calc_input_freq(state, buf+6); - state->config.pll_set(fe, param, buf+8); - mt352_write(fe, buf, sizeof(buf)); + if (fe->ops->tuner_ops.pllbuf) { + fe->ops->tuner_ops.pllbuf(fe, param, buf+8, 5); + buf[8] <<= 1; + mt352_write(fe, buf, sizeof(buf)); + } if (state->config.no_tuner) { /* start decoding */ mt352_write(fe, fsm_go, 2); diff --git a/linux/drivers/media/dvb/frontends/mt352.h b/linux/drivers/media/dvb/frontends/mt352.h index 03040cd59..9e7ff4b8f 100644 --- a/linux/drivers/media/dvb/frontends/mt352.h +++ b/linux/drivers/media/dvb/frontends/mt352.h @@ -49,12 +49,6 @@ struct mt352_config /* Initialise the demodulator and PLL. Cannot be NULL */ int (*demod_init)(struct dvb_frontend* fe); - - /* PLL setup - fill out the supplied 5 byte buffer with your PLL settings. - * byte0: Set to pll i2c address (nonlinux; left shifted by 1) - * byte1-4: PLL configuration. - */ - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf); }; extern struct dvb_frontend* mt352_attach(const struct mt352_config* config, -- cgit v1.2.3 From a43e69c7722a1ae7357fe55d2f31bb785e7e37d6 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert tda10021 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda10021.c | 27 +++++++++++++++++---------- linux/drivers/media/dvb/frontends/tda10021.h | 4 ---- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda10021.c b/linux/drivers/media/dvb/frontends/tda10021.c index 876519586..e49cfa027 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.c +++ b/linux/drivers/media/dvb/frontends/tda10021.c @@ -225,13 +225,6 @@ static int tda10021_init (struct dvb_frontend *fe) //Activate PLL tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef); - - if (state->config->pll_init) { - lock_tuner(state); - state->config->pll_init(fe); - unlock_tuner(state); - } - return 0; } @@ -259,9 +252,10 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate); - lock_tuner(state); - state->config->pll_set(fe, p); - unlock_tuner(state); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } tda10021_set_symbolrate (state, p->u.qam.symbol_rate); tda10021_writereg (state, 0x34, state->pwm); @@ -376,6 +370,18 @@ static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa return 0; } +static int tda10021_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct tda10021_state* state = fe->demodulator_priv; + + if (enable) { + lock_tuner(state); + } else { + unlock_tuner(state); + } + return 0; +} + static int tda10021_sleep(struct dvb_frontend* fe) { struct tda10021_state* state = fe->demodulator_priv; @@ -448,6 +454,7 @@ static struct dvb_frontend_ops tda10021_ops = { .init = tda10021_init, .sleep = tda10021_sleep, + .i2c_gate_ctrl = tda10021_i2c_gate_ctrl, .set_frontend = tda10021_set_parameters, .get_frontend = tda10021_get_frontend, diff --git a/linux/drivers/media/dvb/frontends/tda10021.h b/linux/drivers/media/dvb/frontends/tda10021.h index 53be939e8..3fc338e0e 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.h +++ b/linux/drivers/media/dvb/frontends/tda10021.h @@ -30,10 +30,6 @@ struct tda10021_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, -- cgit v1.2.3 From 38bffdc81d82ff8ba137f6765c84618f07ac9286 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert cx24110 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Remove unneeded sleep function completely. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/cx24110.c | 19 ++++++------------- linux/drivers/media/dvb/frontends/cx24110.h | 5 ----- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx24110.c b/linux/drivers/media/dvb/frontends/cx24110.c index a8d0edd02..8d98ffb61 100644 --- a/linux/drivers/media/dvb/frontends/cx24110.c +++ b/linux/drivers/media/dvb/frontends/cx24110.c @@ -366,17 +366,6 @@ static int cx24110_initfe(struct dvb_frontend* fe) cx24110_writereg(state, cx24110_regdata[i].reg, cx24110_regdata[i].data); }; - if (state->config->pll_init) state->config->pll_init(fe); - - return 0; -} - -static int cx24110_sleep(struct dvb_frontend *fe) -{ - struct cx24110_state *state = fe->demodulator_priv; - - if (state->config->pll_sleep) - return state->config->pll_sleep(fe); return 0; } @@ -548,7 +537,12 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct cx24110_state *state = fe->demodulator_priv; - state->config->pll_set(fe, p); + + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, p); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + cx24110_set_inversion (state, p->inversion); cx24110_set_fec (state, p->u.qpsk.fec_inner); cx24110_set_symbolrate (state, p->u.qpsk.symbol_rate); @@ -651,7 +645,6 @@ static struct dvb_frontend_ops cx24110_ops = { .release = cx24110_release, .init = cx24110_initfe, - .sleep = cx24110_sleep, .set_frontend = cx24110_set_frontend, .get_frontend = cx24110_get_frontend, .read_status = cx24110_read_status, diff --git a/linux/drivers/media/dvb/frontends/cx24110.h b/linux/drivers/media/dvb/frontends/cx24110.h index 609ac642b..b354a64e0 100644 --- a/linux/drivers/media/dvb/frontends/cx24110.h +++ b/linux/drivers/media/dvb/frontends/cx24110.h @@ -31,11 +31,6 @@ struct cx24110_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); - int (*pll_sleep)(struct dvb_frontend* fe); }; extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, -- cgit v1.2.3 From 00010492edce8b02fd88596c9a5b1e6402992ae6 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert dvb_dummy_fe to refactored tuner code From: Andrew de Quincey Make it call the tuner calls - in case someone wants to use it to develop a tuner without a demod. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/dvb_dummy_fe.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c index 645946a99..78ea4ff03 100644 --- a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c @@ -77,6 +77,11 @@ static int dvb_dummy_fe_get_frontend(struct dvb_frontend* fe, struct dvb_fronten 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); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + return 0; } -- cgit v1.2.3 From 6493103733613f60f5426f45903d3a7389283fb8 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert or51132 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove dvb-pll code - done elsewhere now. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/or51132.c | 12 ++++-------- linux/drivers/media/dvb/frontends/or51132.h | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/or51132.c b/linux/drivers/media/dvb/frontends/or51132.c index c25ec7344..19f75e6ed 100644 --- a/linux/drivers/media/dvb/frontends/or51132.c +++ b/linux/drivers/media/dvb/frontends/or51132.c @@ -331,7 +331,6 @@ static int or51132_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *param) { int ret; - u8 buf[4]; struct or51132_state* state = fe->demodulator_priv; const struct firmware *fw; const char *fwname; @@ -384,13 +383,10 @@ static int or51132_set_parameters(struct dvb_frontend* fe, or51132_setmode(fe); } - dvb_pll_configure(state->config->pll_desc, buf, - param->frequency, 0); - dprintk("set_parameters tuner bytes: 0x%02x 0x%02x " - "0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]); - if (i2c_writebytes(state, state->config->pll_address, buf, 4)) - printk(KERN_WARNING "or51132: set_parameters error " - "writing to tuner\n"); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, param); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } /* Set to current mode */ or51132_setmode(fe); diff --git a/linux/drivers/media/dvb/frontends/or51132.h b/linux/drivers/media/dvb/frontends/or51132.h index 622cdd183..89658883a 100644 --- a/linux/drivers/media/dvb/frontends/or51132.h +++ b/linux/drivers/media/dvb/frontends/or51132.h @@ -29,8 +29,6 @@ struct or51132_config { /* The demodulator's i2c address */ u8 demod_address; - u8 pll_address; - struct dvb_pll_desc *pll_desc; /* Need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); -- cgit v1.2.3 From 9e0f7fefa77a40b756221e8ad5af80d9418e50d7 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:10 +0100 Subject: Convert nxt200x to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Standardise the calls used to retrieve tuner data. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/nxt200x.c | 16 +++++++++------- linux/drivers/media/dvb/frontends/nxt200x.h | 4 ---- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c index 9e3535394..809ffd40f 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.c +++ b/linux/drivers/media/dvb/frontends/nxt200x.c @@ -333,17 +333,17 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) dprintk("%s\n", __FUNCTION__); - dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]); + dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[1], data[2], data[3], data[4]); /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip. * direct write is required for Philips TUV1236D and ALPS TDHU2 */ switch (state->demod_chip) { case NXT2004: - if (i2c_writebytes(state, state->config->pll_address, data, 4)) + if (i2c_writebytes(state, data[0], data+1, 4)) printk(KERN_WARNING "nxt200x: error writing to tuner\n"); /* wait until we have a lock */ while (count < 20) { - i2c_readbytes(state, state->config->pll_address, &buf, 1); + i2c_readbytes(state, data[0], &buf, 1); if (buf & 0x40) return 0; msleep(100); @@ -361,10 +361,10 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) nxt200x_writebytes(state, 0x34, &buf, 1); /* write actual tuner bytes */ - nxt200x_writebytes(state, 0x36, data, 4); + nxt200x_writebytes(state, 0x36, data+1, 4); /* set tuner i2c address */ - buf = state->config->pll_address; + buf = data[0] << 1; nxt200x_writebytes(state, 0x35, &buf, 1); /* write UC Opmode to begin transfer */ @@ -534,7 +534,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { struct nxt200x_state* state = fe->demodulator_priv; - u8 buf[4]; + u8 buf[5]; /* stop the micro first */ nxt200x_microcontroller_stop(state); @@ -548,7 +548,9 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, } /* get tuning information */ - dvb_pll_configure(state->config->pll_desc, buf, p->frequency, 0); + if (fe->ops->tuner_ops.pllbuf) { + fe->ops->tuner_ops.pllbuf(fe, p, buf, 5); + } /* set additional params */ switch (p->u.vsb.modulation) { diff --git a/linux/drivers/media/dvb/frontends/nxt200x.h b/linux/drivers/media/dvb/frontends/nxt200x.h index 1d9d70bc3..34d617358 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.h +++ b/linux/drivers/media/dvb/frontends/nxt200x.h @@ -38,10 +38,6 @@ struct nxt200x_config /* the demodulator's i2c address */ u8 demod_address; - /* tuner information */ - u8 pll_address; - struct dvb_pll_desc *pll_desc; - /* used to set pll input */ int (*set_pll_input)(u8* buf, int input); -- cgit v1.2.3 From ffb483d0d47968d903cfe9027501b43d63a88ddb Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert nxt6000 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/nxt6000.c | 25 ++++++++++++++++--------- linux/drivers/media/dvb/frontends/nxt6000.h | 4 ---- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/nxt6000.c b/linux/drivers/media/dvb/frontends/nxt6000.c index a16eeba00..bca83266a 100644 --- a/linux/drivers/media/dvb/frontends/nxt6000.c +++ b/linux/drivers/media/dvb/frontends/nxt6000.c @@ -207,12 +207,6 @@ static void nxt6000_setup(struct dvb_frontend* fe) nxt6000_writereg(state, SUB_DIAG_MODE_SEL, 0); nxt6000_writereg(state, TS_FORMAT, 0); - - if (state->config->pll_init) { - nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ - state->config->pll_init(fe); - nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); /* close i2c bus switch */ - } } static void nxt6000_dump_status(struct nxt6000_state *state) @@ -469,9 +463,10 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par struct nxt6000_state* state = fe->demodulator_priv; int result; - nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ - state->config->pll_set(fe, param); - nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); /* close i2c bus switch */ + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, param); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) return result; @@ -532,6 +527,17 @@ static int nxt6000_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_fron return 0; } +static int nxt6000_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +{ + struct nxt6000_state* state = fe->demodulator_priv; + + if (enable) { + return nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); + } else { + return nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); + } +} + static struct dvb_frontend_ops nxt6000_ops; struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, @@ -584,6 +590,7 @@ static struct dvb_frontend_ops nxt6000_ops = { .release = nxt6000_release, .init = nxt6000_init, + .i2c_gate_ctrl = nxt6000_i2c_gate_ctrl, .get_tune_settings = nxt6000_fe_get_tune_settings, diff --git a/linux/drivers/media/dvb/frontends/nxt6000.h b/linux/drivers/media/dvb/frontends/nxt6000.h index b7d9bead3..117031d11 100644 --- a/linux/drivers/media/dvb/frontends/nxt6000.h +++ b/linux/drivers/media/dvb/frontends/nxt6000.h @@ -31,10 +31,6 @@ struct nxt6000_config /* should clock inversion be used? */ u8 clock_inversion:1; - - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, -- cgit v1.2.3 From b6c785b318edd67bd77b5c8d3748f827a7935f60 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert zl10353 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Use standardised pllbuf call. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/zl10353.c | 8 +++++--- linux/drivers/media/dvb/frontends/zl10353.h | 5 ----- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/zl10353.c b/linux/drivers/media/dvb/frontends/zl10353.c index 10bb871fa..c81b8902c 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.c +++ b/linux/drivers/media/dvb/frontends/zl10353.c @@ -129,7 +129,6 @@ static int zl10353_sleep(struct dvb_frontend *fe) static int zl10353_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_parameters *param) { - struct zl10353_state *state = fe->demodulator_priv; u8 pllbuf[6] = { 0x67 }; /* These settings set "auto-everything" and start the FSM. */ @@ -146,8 +145,11 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, zl10353_single_write(fe, 0x66, 0xE9); zl10353_single_write(fe, 0x62, 0x0A); - state->config.pll_set(fe, param, pllbuf + 1); - zl10353_write(fe, pllbuf, sizeof(pllbuf)); + if (fe->ops->tuner_ops.pllbuf) { + fe->ops->tuner_ops.pllbuf(fe, param, pllbuf+1, 5); + pllbuf[1] <<= 1; + zl10353_write(fe, pllbuf, sizeof(pllbuf)); + } zl10353_single_write(fe, 0x70, 0x01); udelay(250); diff --git a/linux/drivers/media/dvb/frontends/zl10353.h b/linux/drivers/media/dvb/frontends/zl10353.h index 5cc4ae718..63c36ec02 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.h +++ b/linux/drivers/media/dvb/frontends/zl10353.h @@ -28,11 +28,6 @@ struct zl10353_config { /* demodulator's I2C address */ u8 demod_address; - - /* function which configures the PLL buffer (for secondary I2C - * connected tuner) or tunes the PLL (for direct connected tuner) */ - int (*pll_set)(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params, u8 *pllbuf); }; extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, -- cgit v1.2.3 From e498804a03d7eb9e55b9ba2004df3a91906b0456 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert cx24123 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/cx24123.c | 3 --- linux/drivers/media/dvb/frontends/cx24123.h | 4 ---- 2 files changed, 7 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index 56280cd58..89b3a6c63 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -698,9 +698,6 @@ static int cx24123_initfe(struct dvb_frontend* fe) for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); - if (state->config->pll_init) - state->config->pll_init(fe); - /* Configure the LNB for 14V */ if (state->config->use_isl6421) cx24123_writelnbreg(state, 0x0, 0x2a); diff --git a/linux/drivers/media/dvb/frontends/cx24123.h b/linux/drivers/media/dvb/frontends/cx24123.h index 0c922b5e9..7ec4ee856 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.h +++ b/linux/drivers/media/dvb/frontends/cx24123.h @@ -35,10 +35,6 @@ struct cx24123_config */ int use_isl6421; - /* PLL maintenance */ - int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); - /* Need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); -- cgit v1.2.3 From ff2297269dc60818ddbbf8e48bc4800c0eed9519 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert dib3000* to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/dib3000.h | 4 ---- linux/drivers/media/dvb/frontends/dib3000mb.c | 8 +++----- linux/drivers/media/dvb/frontends/dib3000mc.c | 8 +++----- 3 files changed, 6 insertions(+), 14 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dib3000.h b/linux/drivers/media/dvb/frontends/dib3000.h index 2d5475b5c..ec927628d 100644 --- a/linux/drivers/media/dvb/frontends/dib3000.h +++ b/linux/drivers/media/dvb/frontends/dib3000.h @@ -30,10 +30,6 @@ struct dib3000_config { /* the demodulator's i2c address */ u8 demod_address; - - /* PLL maintenance and the i2c address of the PLL */ - int (*pll_init)(struct dvb_frontend *fe); - int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params); }; struct dib_fe_xfer_ops diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c index ae589adb1..f2f8071ad 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mb.c +++ b/linux/drivers/media/dvb/frontends/dib3000mb.c @@ -60,8 +60,9 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, fe_code_rate_t fe_cr = FEC_NONE; int search_state, seq; - if (tuner && state->config.pll_set) { - state->config.pll_set(fe, fep); + if (tuner && fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, fep); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); deb_setf("bandwidth: "); switch (ofdm->bandwidth) { @@ -386,9 +387,6 @@ static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) wr(DIB3000MB_REG_DATA_IN_DIVERSITY, DIB3000MB_DATA_DIVERSITY_IN_OFF); - if (state->config.pll_init) - state->config.pll_init(fe); - return 0; } diff --git a/linux/drivers/media/dvb/frontends/dib3000mc.c b/linux/drivers/media/dvb/frontends/dib3000mc.c index 3b303dbb6..68a443b3d 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mc.c +++ b/linux/drivers/media/dvb/frontends/dib3000mc.c @@ -462,8 +462,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, int search_state,auto_val; u16 val; - if (tuner && state->config.pll_set) { /* initial call from dvb */ - state->config.pll_set(fe,fep); + if (tuner && fe->ops->tuner_ops.set_params) { /* initial call from dvb */ + fe->ops->tuner_ops.set_params(fe, fep); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); state->last_tuned_freq = fep->frequency; // if (!scanboost) { @@ -642,9 +643,6 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); - if (state->config.pll_init) - state->config.pll_init(fe); - deb_info("init end\n"); return 0; } -- cgit v1.2.3 From 2d1d22049e38a7b369d113ec29ec44d387236c5a Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert lgdt330x to refactored tuner code From: Andrew de Quincey Convert to tuner_ops calls. Remove pll function pointers from structure. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/lgdt330x.c | 6 ++++-- linux/drivers/media/dvb/frontends/lgdt330x.h | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c index 25ea3a838..cf1b0fefe 100644 --- a/linux/drivers/media/dvb/frontends/lgdt330x.c +++ b/linux/drivers/media/dvb/frontends/lgdt330x.c @@ -400,8 +400,10 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, } /* Tune to the specified frequency */ - if (state->config->pll_set) - state->config->pll_set(fe, param); + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, param); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } /* Keep track of the new frequency */ /* FIXME this is the wrong way to do this... */ diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.h b/linux/drivers/media/dvb/frontends/lgdt330x.h index 2a6529ccc..bad903c6f 100644 --- a/linux/drivers/media/dvb/frontends/lgdt330x.h +++ b/linux/drivers/media/dvb/frontends/lgdt330x.h @@ -43,7 +43,6 @@ struct lgdt330x_config /* PLL interface */ int (*pll_rf_set) (struct dvb_frontend* fe, int index); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); /* Need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); -- cgit v1.2.3 From 5963aaf6c15a377623fb24e82b5dbdd558617aad Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:11 +0100 Subject: Convert bsbe1/bsru6 to refactored tuner code From: Andrew de Quincey Convert to tuner_ops call API. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/bsbe1.h | 4 ++-- linux/drivers/media/dvb/frontends/bsru6.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/bsbe1.h b/linux/drivers/media/dvb/frontends/bsbe1.h index 78573b22a..6b52d5abf 100644 --- a/linux/drivers/media/dvb/frontends/bsbe1.h +++ b/linux/drivers/media/dvb/frontends/bsbe1.h @@ -89,12 +89,13 @@ static int alps_bsbe1_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra return 0; } -static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) +static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters *params) { int ret; u8 data[4]; u32 div; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + struct i2c_adapter *i2c = fe->tuner_priv; if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL; @@ -117,7 +118,6 @@ static struct stv0299_config alps_bsbe1_config = { .skip_reinit = 0, .min_delay_ms = 100, .set_symbol_rate = alps_bsbe1_set_symbol_rate, - .pll_set = alps_bsbe1_pll_set, }; #endif diff --git a/linux/drivers/media/dvb/frontends/bsru6.h b/linux/drivers/media/dvb/frontends/bsru6.h index 2a5366ce7..5d13c5e4d 100644 --- a/linux/drivers/media/dvb/frontends/bsru6.h +++ b/linux/drivers/media/dvb/frontends/bsru6.h @@ -101,11 +101,12 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ra return 0; } -static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) +static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { u8 buf[4]; u32 div; struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + struct i2c_adapter *i2c = fe->tuner_priv; if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL; @@ -134,7 +135,6 @@ static struct stv0299_config alps_bsru6_config = { .volt13_op0_op1 = STV0299_VOLT13_OP1, .min_delay_ms = 100, .set_symbol_rate = alps_bsru6_set_symbol_rate, - .pll_set = alps_bsru6_pll_set, }; #endif -- cgit v1.2.3 From e18ac1866bfbb2f1f3222042bcb1ccf557f4c98e Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:12 +0100 Subject: Convert dvb-pll to be a refactored tuner From: Andrew de Quincey Rename pll calls to appropriate tuner calls. Remove pll functions from demod structures. Hook tuner call into tuner_ops. Remove BUG_ON() and convert to a soft error. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/dvb-pll.c | 173 +++++++++++++++++++++++++++- linux/drivers/media/dvb/frontends/dvb-pll.h | 16 ++- 2 files changed, 187 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index b6e2c387a..5f463e8ae 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -419,6 +419,19 @@ struct dvb_pll_desc dvb_pll_thomson_fe6600 = { }; EXPORT_SYMBOL(dvb_pll_thomson_fe6600); +struct dvb_pll_priv { + /* i2c details */ + int pll_i2c_address; + struct i2c_adapter *i2c; + + /* the PLL descriptor */ + struct dvb_pll_desc *pll_desc; + + /* cached frequency/bandwidth */ + u32 frequency; + u32 bandwidth; +}; + /* ----------------------------------------------------------- */ /* code */ @@ -443,7 +456,8 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, if (debug) printk("pll: %s: freq=%d bw=%d | i=%d/%d\n", desc->name, freq, bandwidth, i, desc->count); - BUG_ON(i == desc->count); + if (i == desc->count) + return -EINVAL; div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize; buf[0] = div >> 8; @@ -462,6 +476,163 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, } EXPORT_SYMBOL(dvb_pll_configure); +static int dvb_pll_release(struct dvb_frontend *fe) +{ + if (fe->tuner_priv) + kfree(fe->tuner_priv); + fe->tuner_priv = NULL; + return 0; +} + +static int dvb_pll_sleep(struct dvb_frontend *fe) +{ + struct dvb_pll_priv *priv = fe->tuner_priv; + u8 buf[4]; + struct i2c_msg msg = + { .addr = priv->pll_i2c_address, .flags = 0, .buf = buf, .len = sizeof(buf) }; + int i; + int result; + + for (i = 0; i < priv->pll_desc->count; i++) { + if (priv->pll_desc->entries[i].limit == 0) + break; + } + if (i == priv->pll_desc->count) + return 0; + + buf[0] = 0; + buf[1] = 0; + buf[2] = priv->pll_desc->entries[i].config; + buf[3] = priv->pll_desc->entries[i].cb; + + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); + if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { + return result; + } + + return 0; +} + +static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + struct dvb_pll_priv *priv = fe->tuner_priv; + u8 buf[4]; + struct i2c_msg msg = + { .addr = priv->pll_i2c_address, .flags = 0, .buf = buf, .len = sizeof(buf) }; + int result; + u32 div; + int i; + u32 bandwidth = 0; + + if (priv->i2c == NULL) + return -EINVAL; + + // DVBT bandwidth only just now + if (fe->ops->info.type == FE_OFDM) { + bandwidth = params->u.ofdm.bandwidth; + } + + if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, bandwidth)) != 0) + return result; + + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); + if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { + return result; + } + + // calculate the frequency we set it to + for (i = 0; i < priv->pll_desc->count; i++) { + if (params->frequency > priv->pll_desc->entries[i].limit) + continue; + break; + } + div = (params->frequency + priv->pll_desc->entries[i].offset) / priv->pll_desc->entries[i].stepsize; + priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - priv->pll_desc->entries[i].offset; + priv->bandwidth = bandwidth; + + return 0; +} + +static int dvb_pll_pllbuf(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8 *buf, int buf_len) +{ + struct dvb_pll_priv *priv = fe->tuner_priv; + int result; + u32 div; + int i; + u32 bandwidth = 0; + + if (buf_len < 5) + return -EINVAL; + + // DVBT bandwidth only just now + if (fe->ops->info.type == FE_OFDM) { + bandwidth = params->u.ofdm.bandwidth; + } + + if ((result = dvb_pll_configure(priv->pll_desc, buf+1, params->frequency, bandwidth)) != 0) + return result; + buf[0] = priv->pll_i2c_address; + + // calculate the frequency we set it to + for (i = 0; i < priv->pll_desc->count; i++) { + if (params->frequency > priv->pll_desc->entries[i].limit) + continue; + break; + } + div = (params->frequency + priv->pll_desc->entries[i].offset) / priv->pll_desc->entries[i].stepsize; + priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - priv->pll_desc->entries[i].offset; + priv->bandwidth = bandwidth; + + return 5; +} + +static int dvb_pll_get_frequency(struct dvb_frontend *fe, u32 *frequency) +{ + 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) +{ + struct dvb_pll_priv *priv = fe->tuner_priv; + *bandwidth = priv->bandwidth; + return 0; +} + +static struct dvb_tuner_ops dvb_pll_tuner_ops = { + .release = dvb_pll_release, + .sleep = dvb_pll_sleep, + .set_params = dvb_pll_set_params, + .pllbuf = dvb_pll_pllbuf, + .get_frequency = dvb_pll_get_frequency, + .get_bandwidth = dvb_pll_get_bandwidth, +}; + +int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) +{ + struct dvb_pll_priv *priv = NULL; + + priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); + if (priv == NULL) + return -ENOMEM; + + priv->pll_i2c_address = pll_addr; + priv->i2c = i2c; + priv->pll_desc = desc; + + memcpy(&fe->ops->tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops)); + strncpy(fe->ops->tuner_ops.info.name, desc->name, 128); + fe->ops->tuner_ops.info.frequency_min = desc->min; + fe->ops->tuner_ops.info.frequency_min = desc->max; + + fe->tuner_priv = priv; + return 0; +} +EXPORT_SYMBOL(dvb_pll_attach); + MODULE_DESCRIPTION("dvb pll library"); MODULE_AUTHOR("Gerd Knorr"); MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.h b/linux/drivers/media/dvb/frontends/dvb-pll.h index 2b8461784..3908ae1d4 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.h +++ b/linux/drivers/media/dvb/frontends/dvb-pll.h @@ -5,6 +5,9 @@ #ifndef __DVB_PLL_H__ #define __DVB_PLL_H__ +#include +#include "dvb_frontend.h" + struct dvb_pll_desc { char *name; u32 min; @@ -44,7 +47,18 @@ extern struct dvb_pll_desc dvb_pll_philips_td1316; extern struct dvb_pll_desc dvb_pll_thomson_fe6600; -int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, +extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, u32 freq, int bandwidth); +/** + * Attach a dvb-pll to the supplied frontend structure. + * + * @param fe Frontend to attach to. + * @param pll_addr i2c address of the PLL (if used). + * @param i2c i2c adapter to use (set to NULL if not used). + * @param desc dvb_pll_desc to use. + * @return 0 on success, nonzero on failure. + */ +extern int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc); + #endif -- cgit v1.2.3 From b567a613dbe04986b2731674f5a0a71bdabd8065 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:12 +0100 Subject: Sort out support for non-attached tuners on mt352 From: Andrew de Quincey Make it use set_params/pllbuf as appropriate so it works with dvb_pll_attach()ed tuners. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/mt352.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index a7a347a3c..3c86018e7 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -287,18 +287,32 @@ static int mt352_set_parameters(struct dvb_frontend* fe, mt352_calc_nominal_rate(state, op->bandwidth, buf+4); mt352_calc_input_freq(state, buf+6); + // if there is no secondary tuner, call set_params to set up a potential + // tuner attached elsewhere + if (state->config.no_tuner) { + if (fe->ops->tuner_ops.set_params) { + fe->ops->tuner_ops.set_params(fe, param); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + + /* start decoding only */ + mt352_write(fe, fsm_go, 2); + } + + // retrieve the pllbuf - we do this even if there is no + // secondary tuner simply so we have a record of what was sent for + // debugging. if (fe->ops->tuner_ops.pllbuf) { fe->ops->tuner_ops.pllbuf(fe, param, buf+8, 5); buf[8] <<= 1; mt352_write(fe, buf, sizeof(buf)); } - if (state->config.no_tuner) { - /* start decoding */ - mt352_write(fe, fsm_go, 2); - } else { - /* start tuning */ + + // send PLL and start tuning and then decoding + if (!state->config.no_tuner) { mt352_write(fe, tuner_go, 2); } + return 0; } -- cgit v1.2.3 From 3b3dfc47ebdc7d825d84ab44ee4f00136e90df45 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 18 Apr 2006 21:47:12 +0100 Subject: Add support for non-attached tuners to zl10353 From: Andrew de Quincey Add no_tuner setting like in mt352. Update to use correct tuner API calls. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/zl10353.c | 24 +++++++++++++++++++++++- linux/drivers/media/dvb/frontends/zl10353.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/zl10353.c b/linux/drivers/media/dvb/frontends/zl10353.c index c81b8902c..f4851907a 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.c +++ b/linux/drivers/media/dvb/frontends/zl10353.c @@ -129,6 +129,8 @@ static int zl10353_sleep(struct dvb_frontend *fe) static int zl10353_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_parameters *param) { + struct zl10353_state *state = fe->demodulator_priv; + u8 pllbuf[6] = { 0x67 }; /* These settings set "auto-everything" and start the FSM. */ @@ -145,12 +147,32 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, zl10353_single_write(fe, 0x66, 0xE9); zl10353_single_write(fe, 0x62, 0x0A); + // if there is no attached secondary tuner, we call set_params to program + // 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); + if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + } + } + + // if pllbuf is defined, retrieve the settings if (fe->ops->tuner_ops.pllbuf) { fe->ops->tuner_ops.pllbuf(fe, param, pllbuf+1, 5); pllbuf[1] <<= 1; - zl10353_write(fe, pllbuf, sizeof(pllbuf)); + } else { + // fake pllbuf settings + pllbuf[1] = 0x61 << 1; + pllbuf[2] = 0; + pllbuf[3] = 0; + pllbuf[3] = 0; + pllbuf[4] = 0; } + // there is no call to _just_ start decoding, so we send the pllbuf anyway + // even if there isn't a PLL attached to the secondary bus + zl10353_write(fe, pllbuf, sizeof(pllbuf)); + zl10353_single_write(fe, 0x70, 0x01); udelay(250); zl10353_single_write(fe, 0xE4, 0x00); diff --git a/linux/drivers/media/dvb/frontends/zl10353.h b/linux/drivers/media/dvb/frontends/zl10353.h index 63c36ec02..9770cb840 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.h +++ b/linux/drivers/media/dvb/frontends/zl10353.h @@ -28,6 +28,9 @@ struct zl10353_config { /* demodulator's I2C address */ u8 demod_address; + + /* set if no pll is connected to the secondary i2c bus */ + int no_tuner; }; extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, -- cgit v1.2.3 From 8c360c7605e4751038ad67e9fd79e5c1c96b81d6 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Wed, 19 Apr 2006 01:38:49 +0100 Subject: Convert calls from _pllbuf() to _calc_reg() From: Andrew de Quincey Johannes Stezenbach suggested this change - definite improvement. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/dvb-pll.c | 4 ++-- linux/drivers/media/dvb/frontends/mt352.c | 4 ++-- linux/drivers/media/dvb/frontends/nxt200x.c | 4 ++-- linux/drivers/media/dvb/frontends/zl10353.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index 5f463e8ae..1a92ac8d2 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -555,7 +555,7 @@ static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_param return 0; } -static int dvb_pll_pllbuf(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8 *buf, int buf_len) +static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8 *buf, int buf_len) { struct dvb_pll_priv *priv = fe->tuner_priv; int result; @@ -606,7 +606,7 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = { .release = dvb_pll_release, .sleep = dvb_pll_sleep, .set_params = dvb_pll_set_params, - .pllbuf = dvb_pll_pllbuf, + .calc_regs = dvb_pll_calc_regs, .get_frequency = dvb_pll_get_frequency, .get_bandwidth = dvb_pll_get_bandwidth, }; diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index 3c86018e7..ed3bede02 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -302,8 +302,8 @@ static int mt352_set_parameters(struct dvb_frontend* fe, // retrieve the pllbuf - we do this even if there is no // secondary tuner simply so we have a record of what was sent for // debugging. - if (fe->ops->tuner_ops.pllbuf) { - fe->ops->tuner_ops.pllbuf(fe, param, buf+8, 5); + if (fe->ops->tuner_ops.calc_regs) { + fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); buf[8] <<= 1; mt352_write(fe, buf, sizeof(buf)); } diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c index 809ffd40f..9b13f14f1 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.c +++ b/linux/drivers/media/dvb/frontends/nxt200x.c @@ -548,8 +548,8 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, } /* get tuning information */ - if (fe->ops->tuner_ops.pllbuf) { - fe->ops->tuner_ops.pllbuf(fe, p, buf, 5); + if (fe->ops->tuner_ops.calc_regs) { + fe->ops->tuner_ops.calc_regs(fe, p, buf, 5); } /* set additional params */ diff --git a/linux/drivers/media/dvb/frontends/zl10353.c b/linux/drivers/media/dvb/frontends/zl10353.c index f4851907a..1018baae0 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.c +++ b/linux/drivers/media/dvb/frontends/zl10353.c @@ -157,8 +157,8 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, } // if pllbuf is defined, retrieve the settings - if (fe->ops->tuner_ops.pllbuf) { - fe->ops->tuner_ops.pllbuf(fe, param, pllbuf+1, 5); + if (fe->ops->tuner_ops.calc_regs) { + fe->ops->tuner_ops.calc_regs(fe, param, pllbuf+1, 5); pllbuf[1] <<= 1; } else { // fake pllbuf settings -- cgit v1.2.3 From 48c7a56c98cf2342c83cedb2e25748b602383d9c Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Wed, 19 Apr 2006 22:31:03 +0100 Subject: Fix tda10046 tuning From: Andrew de Quincey I'd missed the i2c gate ctrl function out of the tda10046, so tuning didn't work Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda1004x.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda1004x.c b/linux/drivers/media/dvb/frontends/tda1004x.c index d9abce753..5288b44cf 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.c +++ b/linux/drivers/media/dvb/frontends/tda1004x.c @@ -1276,6 +1276,7 @@ static struct dvb_frontend_ops tda10046_ops = { .init = tda10046_init, .sleep = tda1004x_sleep, + .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl, .set_frontend = tda1004x_set_fe, .get_frontend = tda1004x_get_fe, -- cgit v1.2.3 From 43b81c829e515e8e949cab05782c68c9b2dd5c64 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 22 Apr 2006 15:15:07 -0400 Subject: fix frequency values in the ranges structures of the LG TDVS H06xF tuners From: Rusty Scott Frequency range values in the current driver for the LG TDVS H06xF tuners appear to have been a transposing of the 5 in the mid range 160-455 instead of 165-450. This patch corrects the pll programming for these tuners as per the datasheet. Signed-off-by: Rusty Scott Signed-off-by: Mac Michaels Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/dvb-pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index b6e2c387a..791706ec1 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -235,8 +235,8 @@ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { .max = 863000000, .count = 3, .entries = { - { 160000000, 44000000, 62500, 0xce, 0x01 }, - { 455000000, 44000000, 62500, 0xce, 0x02 }, + { 165000000, 44000000, 62500, 0xce, 0x01 }, + { 450000000, 44000000, 62500, 0xce, 0x02 }, { 999999999, 44000000, 62500, 0xce, 0x04 }, }, }; -- cgit v1.2.3 From a3443fe26243f9e8a2d5c4f74624990d9be848c5 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 22 Apr 2006 15:15:11 -0400 Subject: fix display name for LG TDVS-H06xF From: Michael Krufky This patch fixes the display name for LG TDVS-H06xF tuners in both tuner and dvb-pll modules. Changing the names of the actual pll_desc struct and tuner definitions has been held back until after the dvb tuner refactoring gets merged. Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/dvb-pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index 791706ec1..50a79eea8 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -227,10 +227,10 @@ struct dvb_pll_desc dvb_pll_tua6034 = { EXPORT_SYMBOL(dvb_pll_tua6034); /* Infineon TUA6034 - * used in LG TDVS H061F and LG TDVS H062F + * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F */ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { - .name = "LG/Infineon TUA6034", + .name = "LG TDVS-H06xF", .min = 54000000, .max = 863000000, .count = 3, -- cgit v1.2.3 From edb3b432e5bd483b361a5461c744c987a33b999d Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 24 Apr 2006 22:21:46 -0400 Subject: rename fe_lgh06xf.h to lg_h06xf.h From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/fe_lgh06xf.h | 66 -------------------------- linux/drivers/media/dvb/frontends/lg_h06xf.h | 66 ++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 linux/drivers/media/dvb/frontends/fe_lgh06xf.h create mode 100644 linux/drivers/media/dvb/frontends/lg_h06xf.h (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/fe_lgh06xf.h b/linux/drivers/media/dvb/frontends/fe_lgh06xf.h deleted file mode 100644 index c5e8b5ff1..000000000 --- a/linux/drivers/media/dvb/frontends/fe_lgh06xf.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * fe_lgh06xf.h - ATSC Tuner support for LG TDVS H06xF - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef FE_LGH06XF_H -#define FE_LGH06XF_H -#include "dvb-pll.h" - -static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_adap, - struct dvb_frontend_parameters* params) -{ - u8 buf[4]; - struct i2c_msg msg = { .addr = 0x61, .flags = 0, - .buf = buf, .len = sizeof(buf) }; - int err; - - dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0); - if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { - printk(KERN_WARNING "lg_h06xf: %s error " - "(addr %02x <- %02x, err = %i)\n", - __FUNCTION__, buf[0], buf[1], err); - if (err < 0) - return err; - else - return -EREMOTEIO; - } - - /* Set the Auxiliary Byte. */ -#if 0 - buf[2] &= ~0x20; - buf[2] |= 0x18; - buf[3] = 0x50; -#else - buf[0] = buf[2]; - buf[0] &= ~0x20; - buf[0] |= 0x18; - buf[1] = 0x50; - msg.len = 2; -#endif - if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { - printk(KERN_WARNING "lg_h06xf: %s error " - "(addr %02x <- %02x, err = %i)\n", - __FUNCTION__, buf[0], buf[1], err); - if (err < 0) - return err; - else - return -EREMOTEIO; - } - - return 0; -} -#endif diff --git a/linux/drivers/media/dvb/frontends/lg_h06xf.h b/linux/drivers/media/dvb/frontends/lg_h06xf.h new file mode 100644 index 000000000..355a4a498 --- /dev/null +++ b/linux/drivers/media/dvb/frontends/lg_h06xf.h @@ -0,0 +1,66 @@ +/* + * lg_h06xf.h - ATSC Tuner support for LG TDVS-H06xF + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _LG_H06XF_H_ +#define _LG_H06XF_H_ +#include "dvb-pll.h" + +static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_adap, + struct dvb_frontend_parameters* params) +{ + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, + .buf = buf, .len = sizeof(buf) }; + int err; + + dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0); + if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lg_h06xf: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + /* Set the Auxiliary Byte. */ +#if 0 + buf[2] &= ~0x20; + buf[2] |= 0x18; + buf[3] = 0x50; +#else + buf[0] = buf[2]; + buf[0] &= ~0x20; + buf[0] |= 0x18; + buf[1] = 0x50; + msg.len = 2; +#endif + if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lg_h06xf: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + return 0; +} +#endif -- cgit v1.2.3 From 248256f91d487672dd126161381f5364b0b29ce6 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 27 Apr 2006 00:31:26 -0400 Subject: dvb: rename dvb_pll_tdvs_tua6034 to dvb_pll_lg_tdvs_h06xf From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/dvb-pll.c | 4 ++-- linux/drivers/media/dvb/frontends/dvb-pll.h | 2 +- linux/drivers/media/dvb/frontends/lg_h06xf.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index 7e65841b1..a1a4be41e 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -229,7 +229,7 @@ EXPORT_SYMBOL(dvb_pll_tua6034); /* Infineon TUA6034 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F */ -struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { +struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = { .name = "LG TDVS-H06xF", .min = 54000000, .max = 863000000, @@ -240,7 +240,7 @@ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { { 999999999, 44000000, 62500, 0xce, 0x04 }, }, }; -EXPORT_SYMBOL(dvb_pll_tdvs_tua6034); +EXPORT_SYMBOL(dvb_pll_lg_tdvs_h06xf); /* Philips FMD1216ME * used in Medion Hybrid PCMCIA card and USB Box diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.h b/linux/drivers/media/dvb/frontends/dvb-pll.h index 3908ae1d4..66361cd18 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.h +++ b/linux/drivers/media/dvb/frontends/dvb-pll.h @@ -34,7 +34,7 @@ extern struct dvb_pll_desc dvb_pll_unknown_1; extern struct dvb_pll_desc dvb_pll_tua6010xs; extern struct dvb_pll_desc dvb_pll_env57h1xd5; extern struct dvb_pll_desc dvb_pll_tua6034; -extern struct dvb_pll_desc dvb_pll_tdvs_tua6034; +extern struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf; extern struct dvb_pll_desc dvb_pll_tda665x; extern struct dvb_pll_desc dvb_pll_fmd1216me; extern struct dvb_pll_desc dvb_pll_tded4; diff --git a/linux/drivers/media/dvb/frontends/lg_h06xf.h b/linux/drivers/media/dvb/frontends/lg_h06xf.h index 355a4a498..6869cbd03 100644 --- a/linux/drivers/media/dvb/frontends/lg_h06xf.h +++ b/linux/drivers/media/dvb/frontends/lg_h06xf.h @@ -28,7 +28,7 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada .buf = buf, .len = sizeof(buf) }; int err; - dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0); + dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0); if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "lg_h06xf: %s error " "(addr %02x <- %02x, err = %i)\n", -- cgit v1.2.3 From 761ff2c05b56e086da5a180666c4d9160155c4ec Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Fri, 28 Apr 2006 01:45:01 +0100 Subject: Convert lnbp21 to a module From: Andrew de Quincey Convert lnbp21.h into a linux kernel module. Fix up previous users to use it. Convert dvb-ttusb-budget to use it. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/Kconfig | 10 ++ linux/drivers/media/dvb/frontends/Makefile | 1 + linux/drivers/media/dvb/frontends/lnbp21.c | 145 +++++++++++++++++++++++++++++ linux/drivers/media/dvb/frontends/lnbp21.h | 102 +------------------- 4 files changed, 160 insertions(+), 98 deletions(-) create mode 100644 linux/drivers/media/dvb/frontends/lnbp21.c (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/Kconfig b/linux/drivers/media/dvb/frontends/Kconfig index 6d90ff3f7..64cd63623 100644 --- a/linux/drivers/media/dvb/frontends/Kconfig +++ b/linux/drivers/media/dvb/frontends/Kconfig @@ -216,4 +216,14 @@ config DVB_LGDT330X An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want to support this frontend. + +comment "Miscellaneous devices" + depends on DVB_CORE + +config DVB_LNBP21 + tristate "LNBP21 SEC controller" + depends on DVB_CORE + help + An SEC control chip. + endmenu diff --git a/linux/drivers/media/dvb/frontends/Makefile b/linux/drivers/media/dvb/frontends/Makefile index d09b6071f..7238e6ef2 100644 --- a/linux/drivers/media/dvb/frontends/Makefile +++ b/linux/drivers/media/dvb/frontends/Makefile @@ -31,3 +31,4 @@ obj-$(CONFIG_DVB_BCM3510) += bcm3510.o obj-$(CONFIG_DVB_S5H1420) += s5h1420.o obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o obj-$(CONFIG_DVB_CX24123) += cx24123.o +obj-$(CONFIG_DVB_LNBP21) += lnbp21.o diff --git a/linux/drivers/media/dvb/frontends/lnbp21.c b/linux/drivers/media/dvb/frontends/lnbp21.c new file mode 100644 index 000000000..c9152c1fb --- /dev/null +++ b/linux/drivers/media/dvb/frontends/lnbp21.c @@ -0,0 +1,145 @@ +/* + * lnbp21.h - driver for lnb supply and control ic lnbp21 + * + * Copyright (C) 2006 Oliver Endriss + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + * + * + * the project's page is at http://www.linuxtv.org + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dvb_frontend.h" +#include "lnbp21.h" + +struct lnbp21 { + u8 config; + u8 override_or; + u8 override_and; + struct i2c_adapter *i2c; + void (*release_chain)(struct dvb_frontend* fe); +}; + +static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) +{ + struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; + struct i2c_msg msg = { .addr = 0x08, .flags = 0, + .buf = &lnbp21->config, + .len = sizeof(lnbp21->config) }; + + lnbp21->config &= ~(LNBP21_VSEL | LNBP21_EN); + + switch(voltage) { + case SEC_VOLTAGE_OFF: + break; + case SEC_VOLTAGE_13: + lnbp21->config |= LNBP21_EN; + break; + case SEC_VOLTAGE_18: + lnbp21->config |= (LNBP21_EN | LNBP21_VSEL); + break; + default: + return -EINVAL; + }; + + lnbp21->config |= lnbp21->override_or; + lnbp21->config &= lnbp21->override_and; + + return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO; +} + +static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) +{ + struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; + struct i2c_msg msg = { .addr = 0x08, .flags = 0, + .buf = &lnbp21->config, + .len = sizeof(lnbp21->config) }; + + if (arg) + lnbp21->config |= LNBP21_LLC; + else + lnbp21->config &= ~LNBP21_LLC; + + lnbp21->config |= lnbp21->override_or; + lnbp21->config &= lnbp21->override_and; + + return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO; +} + +static void lnbp21_release(struct dvb_frontend *fe) +{ + struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; + + /* LNBP power off */ + lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); + + /* free data & call next release routine */ + fe->ops->release = lnbp21->release_chain; + kfree(fe->misc_priv); + fe->misc_priv = NULL; + if (fe->ops->release) + fe->ops->release(fe); +} + +int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) +{ + struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); + if (!lnbp21) + return -ENOMEM; + + /* default configuration */ + lnbp21->config = LNBP21_ISEL; + lnbp21->i2c = i2c; + fe->misc_priv = lnbp21; + + /* bits which should be forced to '1' */ + lnbp21->override_or = override_set; + + /* bits which should be forced to '0' */ + lnbp21->override_and = ~override_clear; + + /* detect if it is present or not */ + if (lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF)) { + kfree(lnbp21); + fe->misc_priv = NULL; + return -EIO; + } + + /* install release callback */ + lnbp21->release_chain = fe->ops->release; + fe->ops->release = lnbp21_release; + + /* override frontend ops */ + fe->ops->set_voltage = lnbp21_set_voltage; + fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; + + return 0; +} +EXPORT_SYMBOL(lnbp21_attach); + +MODULE_DESCRIPTION("Driver for lnb supply and control ic lnbp21"); +MODULE_AUTHOR("Oliver Endriss"); +MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/dvb/frontends/lnbp21.h b/linux/drivers/media/dvb/frontends/lnbp21.h index 0dcbe61b6..047a4ab68 100644 --- a/linux/drivers/media/dvb/frontends/lnbp21.h +++ b/linux/drivers/media/dvb/frontends/lnbp21.h @@ -27,7 +27,7 @@ #ifndef _LNBP21_H #define _LNBP21_H -/* system register */ +/* system register bits */ #define LNBP21_OLF 0x01 #define LNBP21_OTF 0x02 #define LNBP21_EN 0x04 @@ -37,103 +37,9 @@ #define LNBP21_ISEL 0x40 #define LNBP21_PCL 0x80 -struct lnbp21 { - u8 config; - u8 override_or; - u8 override_and; - struct i2c_adapter *i2c; - void (*release_chain)(struct dvb_frontend* fe); -}; +#include -static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -{ - struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; - struct i2c_msg msg = { .addr = 0x08, .flags = 0, - .buf = &lnbp21->config, - .len = sizeof(lnbp21->config) }; - - lnbp21->config &= ~(LNBP21_VSEL | LNBP21_EN); - - switch(voltage) { - case SEC_VOLTAGE_OFF: - break; - case SEC_VOLTAGE_13: - lnbp21->config |= LNBP21_EN; - break; - case SEC_VOLTAGE_18: - lnbp21->config |= (LNBP21_EN | LNBP21_VSEL); - break; - default: - return -EINVAL; - }; - - lnbp21->config |= lnbp21->override_or; - lnbp21->config &= lnbp21->override_and; - - return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO; -} - -static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) -{ - struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; - struct i2c_msg msg = { .addr = 0x08, .flags = 0, - .buf = &lnbp21->config, - .len = sizeof(lnbp21->config) }; - - if (arg) - lnbp21->config |= LNBP21_LLC; - else - lnbp21->config &= ~LNBP21_LLC; - - lnbp21->config |= lnbp21->override_or; - lnbp21->config &= lnbp21->override_and; - - return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO; -} - -static void lnbp21_exit(struct dvb_frontend *fe) -{ - struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; - - /* LNBP power off */ - lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); - - /* free data & call next release routine */ - fe->ops->release = lnbp21->release_chain; - kfree(fe->misc_priv); - fe->misc_priv = NULL; - if (fe->ops->release) - fe->ops->release(fe); -} - -static int lnbp21_init(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) -{ - struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); - - if (!lnbp21) - return -ENOMEM; - - /* default configuration */ - lnbp21->config = LNBP21_ISEL; - - /* bits which should be forced to '1' */ - lnbp21->override_or = override_set; - - /* bits which should be forced to '0' */ - lnbp21->override_and = ~override_clear; - - /* install release callback */ - lnbp21->release_chain = fe->ops->release; - fe->ops->release = lnbp21_exit; - - /* override frontend ops */ - fe->ops->set_voltage = lnbp21_set_voltage; - fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; - - lnbp21->i2c = i2c; - fe->misc_priv = lnbp21; - - return lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); -} +/* override_set and override_clear control which system register bits (above) to always set & clear */ +extern int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear); #endif -- cgit v1.2.3 From b5fe0362594b93998d9ab6c01554cc2b9dd95951 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Fri, 28 Apr 2006 01:45:09 +0100 Subject: Add isl6421 module From: Andrew de Quincey Driver for the ISL6421 LNB chip Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/Kconfig | 6 ++ linux/drivers/media/dvb/frontends/Makefile | 1 + linux/drivers/media/dvb/frontends/isl6421.c | 149 ++++++++++++++++++++++++++++ linux/drivers/media/dvb/frontends/isl6421.h | 46 +++++++++ 4 files changed, 202 insertions(+) create mode 100644 linux/drivers/media/dvb/frontends/isl6421.c create mode 100644 linux/drivers/media/dvb/frontends/isl6421.h (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/Kconfig b/linux/drivers/media/dvb/frontends/Kconfig index 64cd63623..0ef361f03 100644 --- a/linux/drivers/media/dvb/frontends/Kconfig +++ b/linux/drivers/media/dvb/frontends/Kconfig @@ -226,4 +226,10 @@ config DVB_LNBP21 help An SEC control chip. +config DVB_ISL6421 + tristate "ISL6421 SEC controller" + depends on DVB_CORE + help + An SEC control chip. + endmenu diff --git a/linux/drivers/media/dvb/frontends/Makefile b/linux/drivers/media/dvb/frontends/Makefile index 7238e6ef2..5222245c7 100644 --- a/linux/drivers/media/dvb/frontends/Makefile +++ b/linux/drivers/media/dvb/frontends/Makefile @@ -32,3 +32,4 @@ obj-$(CONFIG_DVB_S5H1420) += s5h1420.o obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o obj-$(CONFIG_DVB_CX24123) += cx24123.o obj-$(CONFIG_DVB_LNBP21) += lnbp21.o +obj-$(CONFIG_DVB_ISL6421) += isl6421.o diff --git a/linux/drivers/media/dvb/frontends/isl6421.c b/linux/drivers/media/dvb/frontends/isl6421.c new file mode 100644 index 000000000..36992077a --- /dev/null +++ b/linux/drivers/media/dvb/frontends/isl6421.c @@ -0,0 +1,149 @@ +/* + * isl6421.h - driver for lnb supply and control ic ISL6421 + * + * Copyright (C) 2006 Andrew de Quincey + * Copyright (C) 2006 Oliver Endriss + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + * + * + * the project's page is at http://www.linuxtv.org + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dvb_frontend.h" +#include "isl6421.h" + +struct isl6421 { + u8 config; + u8 override_or; + u8 override_and; + struct i2c_adapter *i2c; + u8 i2c_addr; + void (*release_chain)(struct dvb_frontend* fe); +}; + +static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) +{ + struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; + struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, + .buf = &isl6421->config, + .len = sizeof(isl6421->config) }; + + isl6421->config &= ~(ISL6421_VSEL1 | ISL6421_EN1); + + switch(voltage) { + case SEC_VOLTAGE_OFF: + break; + case SEC_VOLTAGE_13: + isl6421->config |= ISL6421_EN1; + break; + case SEC_VOLTAGE_18: + isl6421->config |= (ISL6421_EN1 | ISL6421_VSEL1); + break; + default: + return -EINVAL; + }; + + isl6421->config |= isl6421->override_or; + isl6421->config &= isl6421->override_and; + + return (i2c_transfer(isl6421->i2c, &msg, 1) == 1) ? 0 : -EIO; +} + +static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) +{ + struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; + struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, + .buf = &isl6421->config, + .len = sizeof(isl6421->config) }; + + if (arg) + isl6421->config |= ISL6421_LLC1; + else + isl6421->config &= ~ISL6421_LLC1; + + isl6421->config |= isl6421->override_or; + isl6421->config &= isl6421->override_and; + + return (i2c_transfer(isl6421->i2c, &msg, 1) == 1) ? 0 : -EIO; +} + +static void isl6421_release(struct dvb_frontend *fe) +{ + struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; + + /* power off */ + isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); + + /* free data & call next release routine */ + fe->ops->release = isl6421->release_chain; + kfree(fe->misc_priv); + fe->misc_priv = NULL; + if (fe->ops->release) + fe->ops->release(fe); +} + +int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, + u8 override_set, u8 override_clear) +{ + struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL); + if (!isl6421) + return -ENOMEM; + + /* default configuration */ + isl6421->config = ISL6421_ISEL1; + isl6421->i2c = i2c; + isl6421->i2c_addr = i2c_addr; + fe->misc_priv = isl6421; + + /* bits which should be forced to '1' */ + isl6421->override_or = override_set; + + /* bits which should be forced to '0' */ + isl6421->override_and = ~override_clear; + + /* detect if it is present or not */ + if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { + kfree(isl6421); + fe->misc_priv = NULL; + return -EIO; + } + + /* install release callback */ + isl6421->release_chain = fe->ops->release; + fe->ops->release = isl6421_release; + + /* override frontend ops */ + fe->ops->set_voltage = isl6421_set_voltage; + fe->ops->enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; + + return 0; +} +EXPORT_SYMBOL(isl6421_attach); + +MODULE_DESCRIPTION("Driver for lnb supply and control ic isl6421"); +MODULE_AUTHOR("Andrew de Quincey & Oliver Endriss"); +MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/dvb/frontends/isl6421.h b/linux/drivers/media/dvb/frontends/isl6421.h new file mode 100644 index 000000000..675f80a19 --- /dev/null +++ b/linux/drivers/media/dvb/frontends/isl6421.h @@ -0,0 +1,46 @@ +/* + * isl6421.h - driver for lnb supply and control ic ISL6421 + * + * Copyright (C) 2006 Andrew de Quincey + * Copyright (C) 2006 Oliver Endriss + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + * + * + * the project's page is at http://www.linuxtv.org + */ + +#ifndef _ISL6421_H +#define _ISL6421_H + +#include + +/* system register bits */ +#define ISL6421_OLF1 0x01 +#define ISL6421_EN1 0x02 +#define ISL6421_VSEL1 0x04 +#define ISL6421_LLC1 0x08 +#define ISL6421_ENT1 0x10 +#define ISL6421_ISEL1 0x20 +#define ISL6421_DCL 0x40 + +/* override_set and override_clear control which system register bits (above) to always set & clear */ +extern int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, + u8 override_set, u8 override_clear); + +#endif -- cgit v1.2.3 From a8030bb8f293d1eba3527eba4f91543aa9a48a0d Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Fri, 28 Apr 2006 01:45:20 +0100 Subject: Support new dvb-ttusb-budget boards with stv0297 From: Thomas Kaiser Added config switch to stv0297 to control i2c STOP during write behaviour. Update frontend init in dvb-ttusb-budget. Enable i2c STOP on other users of stv0297. Signed-off-by: Thomas Kaiser Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/stv0297.c | 49 ++++++++++++++++++----------- linux/drivers/media/dvb/frontends/stv0297.h | 3 ++ 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index 7e8855723..9c5788c2e 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -68,19 +68,25 @@ static int stv0297_readreg(struct stv0297_state *state, u8 reg) int ret; u8 b0[] = { reg }; u8 b1[] = { 0 }; - struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = - 1}, - {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1} - }; + struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = 1}, + {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1} + }; // this device needs a STOP between the register and data - if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { - dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); - return -1; - } - if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { - dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); - return -1; + if (state->config->stop_during_read) { + if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); + return -1; + } + if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); + return -1; + } + } else { + if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); + return -1; + } } return b1[0]; @@ -107,13 +113,20 @@ static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len }; // this device needs a STOP between the register and data - if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { - dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); - return -1; - } - if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { - dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); - return -1; + if (state->config->stop_during_read) { + if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); + return -1; + } + if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); + return -1; + } + } else { + if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); + return -1; + } } return 0; diff --git a/linux/drivers/media/dvb/frontends/stv0297.h b/linux/drivers/media/dvb/frontends/stv0297.h index 8ff793c90..1da5384fb 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.h +++ b/linux/drivers/media/dvb/frontends/stv0297.h @@ -37,6 +37,9 @@ struct stv0297_config /* does the "inversion" need inverted? */ u8 invert:1; + + /* set to 1 if the device requires an i2c STOP during reading */ + u8 stop_during_read:1; }; extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, -- cgit v1.2.3 From ab12813a48c3dbc4f0d9f2b3e93e7a5465744f9c Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Fri, 28 Apr 2006 01:47:05 +0100 Subject: Add missing pll gate control calls From: Andrew de Quincey I'd missed some of these out, breaking the av7110 tuning. I then checked for more and added them in where necessary. They may not actually be necessary in all these locations, but if not, they'll simply have no effect. Add small delay to stv0299 pll gate control to fix tuning problems. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/bsbe1.h | 2 ++ linux/drivers/media/dvb/frontends/bsru6.h | 2 ++ linux/drivers/media/dvb/frontends/lg_h06xf.h | 4 ++++ linux/drivers/media/dvb/frontends/stv0299.c | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/bsbe1.h b/linux/drivers/media/dvb/frontends/bsbe1.h index 6b52d5abf..b2aeddb14 100644 --- a/linux/drivers/media/dvb/frontends/bsbe1.h +++ b/linux/drivers/media/dvb/frontends/bsbe1.h @@ -106,6 +106,8 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); ret = i2c_transfer(i2c, &msg, 1); return (ret != 1) ? -EIO : 0; } diff --git a/linux/drivers/media/dvb/frontends/bsru6.h b/linux/drivers/media/dvb/frontends/bsru6.h index 5d13c5e4d..5533512b0 100644 --- a/linux/drivers/media/dvb/frontends/bsru6.h +++ b/linux/drivers/media/dvb/frontends/bsru6.h @@ -120,6 +120,8 @@ static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_front if (params->frequency > 1530000) buf[3] = 0xc0; + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; return 0; diff --git a/linux/drivers/media/dvb/frontends/lg_h06xf.h b/linux/drivers/media/dvb/frontends/lg_h06xf.h index 6869cbd03..21acb5bad 100644 --- a/linux/drivers/media/dvb/frontends/lg_h06xf.h +++ b/linux/drivers/media/dvb/frontends/lg_h06xf.h @@ -29,6 +29,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada int err; dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0); + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "lg_h06xf: %s error " "(addr %02x <- %02x, err = %i)\n", @@ -51,6 +53,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada buf[1] = 0x50; msg.len = 2; #endif + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "lg_h06xf: %s error " "(addr %02x <- %02x, err = %i)\n", diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 5a8131023..e91bb5842 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -604,10 +604,12 @@ static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) struct stv0299_state* state = fe->demodulator_priv; if (enable) { - return stv0299_writeregI(state, 0x05, 0xb5); + stv0299_writeregI(state, 0x05, 0xb5); } else { - return stv0299_writeregI(state, 0x05, 0x35); + stv0299_writeregI(state, 0x05, 0x35); } + udelay(1); + return 0; } static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) -- cgit v1.2.3 From 304dfa39df9db3695e21bd87ac2c84819c889359 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Thu, 4 May 2006 16:39:44 +0100 Subject: Fix CI interface on KNC1 DVBT and DVBC cards From: Andrew de Quincey These cards need special handling for CI - reinitialising the frontend device when the CI module is reset. Additionally the tda10021 needs to be set into a different transport stream mode when a CI module is present. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/tda10021.c | 8 ++++++++ linux/drivers/media/dvb/frontends/tda10021.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/tda10021.c b/linux/drivers/media/dvb/frontends/tda10021.c index e49cfa027..1950c72fd 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.c +++ b/linux/drivers/media/dvb/frontends/tda10021.c @@ -90,6 +90,14 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) return (ret != 1) ? -EREMOTEIO : 0; } +int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data) +{ + struct tda10021_state* state = fe->demodulator_priv; + + return tda10021_writereg(state, reg, data); +} +EXPORT_SYMBOL(tda10021_write_byte); + static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) { u8 b0 [] = { reg }; diff --git a/linux/drivers/media/dvb/frontends/tda10021.h b/linux/drivers/media/dvb/frontends/tda10021.h index 3fc338e0e..b1df4259b 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.h +++ b/linux/drivers/media/dvb/frontends/tda10021.h @@ -35,4 +35,6 @@ struct tda10021_config extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, struct i2c_adapter* i2c, u8 pwm); +extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data); + #endif // TDA10021_H -- cgit v1.2.3 From 201eab753e49c4d8d6fe340e174b3907ac22325a Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Sat, 13 May 2006 00:31:51 +0100 Subject: Fix cx24123 diseqc From: Andrew de Quincey Rework diseqc support to be more in line with the other demod drivers. Fix Nova-S-Plus/Nova-SE2 diseqc. Cleanup API. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/cx24123.c | 184 ++++++++-------------------- linux/drivers/media/dvb/frontends/cx24123.h | 9 -- 2 files changed, 48 insertions(+), 145 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index 89b3a6c63..a2647472c 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -48,7 +48,6 @@ struct cx24123_state u32 lastber; u16 snr; - u8 lnbreg; /* Some PLL specifics for tuning */ u32 VCAarg; @@ -260,29 +259,6 @@ static int cx24123_writereg(struct cx24123_state* state, int reg, int data) return 0; } -static int cx24123_writelnbreg(struct cx24123_state* state, int reg, int data) -{ - u8 buf[] = { reg, data }; - /* fixme: put the intersil addr int the config */ - struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; - int err; - - if (debug>1) - printk("cx24123: %s: writeln addr=0x08, reg 0x%02x, value 0x%02x\n", - __FUNCTION__,reg, data); - - if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { - printk("%s: writelnbreg error (err == %i, reg == 0x%02x," - " data == 0x%02x)\n", __FUNCTION__, err, reg, data); - return -EREMOTEIO; - } - - /* cache the write, no way to read back */ - state->lnbreg = data; - - return 0; -} - static int cx24123_readreg(struct cx24123_state* state, u8 reg) { int ret; @@ -306,11 +282,6 @@ static int cx24123_readreg(struct cx24123_state* state, u8 reg) return b1[0]; } -static int cx24123_readlnbreg(struct cx24123_state* state, u8 reg) -{ - return state->lnbreg; -} - static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) { u8 nom_reg = cx24123_readreg(state, 0x0e); @@ -698,10 +669,6 @@ static int cx24123_initfe(struct dvb_frontend* fe) for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); - /* Configure the LNB for 14V */ - if (state->config->use_isl6421) - cx24123_writelnbreg(state, 0x0, 0x2a); - return 0; } @@ -710,50 +677,18 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage struct cx24123_state *state = fe->demodulator_priv; u8 val; - switch (state->config->use_isl6421) { - - case 1: + val = cx24123_readreg(state, 0x29) & ~0x40; - val = cx24123_readlnbreg(state, 0x0); - - switch (voltage) { - case SEC_VOLTAGE_13: - dprintk("%s: isl6421 voltage = 13V\n",__FUNCTION__); - return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ - case SEC_VOLTAGE_18: - dprintk("%s: isl6421 voltage = 18V\n",__FUNCTION__); - return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ - case SEC_VOLTAGE_OFF: - dprintk("%s: isl5421 voltage off\n",__FUNCTION__); - return cx24123_writelnbreg(state, 0x0, val & 0x30); - default: - return -EINVAL; - }; - - case 0: - - val = cx24123_readreg(state, 0x29); - - switch (voltage) { - case SEC_VOLTAGE_13: - dprintk("%s: setting voltage 13V\n", __FUNCTION__); - if (state->config->enable_lnb_voltage) - state->config->enable_lnb_voltage(fe, 1); - return cx24123_writereg(state, 0x29, val | 0x80); - case SEC_VOLTAGE_18: - dprintk("%s: setting voltage 18V\n", __FUNCTION__); - if (state->config->enable_lnb_voltage) - state->config->enable_lnb_voltage(fe, 1); - return cx24123_writereg(state, 0x29, val & 0x7f); - case SEC_VOLTAGE_OFF: - dprintk("%s: setting voltage off\n", __FUNCTION__); - if (state->config->enable_lnb_voltage) - state->config->enable_lnb_voltage(fe, 0); - return 0; - default: - return -EINVAL; - }; - } + switch (voltage) { + case SEC_VOLTAGE_13: + dprintk("%s: setting voltage 13V\n", __FUNCTION__); + return cx24123_writereg(state, 0x29, val | 0x80); + case SEC_VOLTAGE_18: + dprintk("%s: setting voltage 18V\n", __FUNCTION__); + return cx24123_writereg(state, 0x29, val & 0x7f); + default: + return -EINVAL; + }; return 0; } @@ -774,27 +709,20 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state) static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) { struct cx24123_state *state = fe->demodulator_priv; - int i, val; + int i, val, tone; dprintk("%s:\n",__FUNCTION__); - /* check if continuous tone has been stopped */ - if (state->config->use_isl6421) - val = cx24123_readlnbreg(state, 0x00) & 0x10; - else - val = cx24123_readreg(state, 0x29) & 0x10; - - - if (val) { - printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); - return -ENOTSUPP; - } + /* stop continuous tone if enabled */ + tone = cx24123_readreg(state, 0x29); + if (tone & 0x10) + cx24123_writereg(state, 0x29, tone & ~0x50); /* wait for diseqc queue ready */ cx24123_wait_for_diseqc(state); /* select tone mode */ - cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8); + cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xfb); for (i = 0; i < cmd->msg_len; i++) cx24123_writereg(state, 0x2C + i, cmd->msg[i]); @@ -805,36 +733,33 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma /* wait for diseqc message to finish sending */ cx24123_wait_for_diseqc(state); + /* restart continuous tone if enabled */ + if (tone & 0x10) { + cx24123_writereg(state, 0x29, tone & ~0x40); + } + return 0; } static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) { struct cx24123_state *state = fe->demodulator_priv; - int val; + int val, tone; dprintk("%s:\n", __FUNCTION__); - /* check if continuous tone has been stoped */ - if (state->config->use_isl6421) - val = cx24123_readlnbreg(state, 0x00) & 0x10; - else - val = cx24123_readreg(state, 0x29) & 0x10; - - - if (val) { - printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); - return -ENOTSUPP; - } + /* stop continuous tone if enabled */ + tone = cx24123_readreg(state, 0x29); + if (tone & 0x10) + cx24123_writereg(state, 0x29, tone & ~0x50); + /* wait for diseqc queue ready */ cx24123_wait_for_diseqc(state); /* select tone mode */ - val = cx24123_readreg(state, 0x2a) & 0xf8; - cx24123_writereg(state, 0x2a, val | 0x04); - + cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) | 0x4); + msleep(30); val = cx24123_readreg(state, 0x29); - if (burst == SEC_MINI_A) cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x00)); else if (burst == SEC_MINI_B) @@ -843,7 +768,12 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t return -EINVAL; cx24123_wait_for_diseqc(state); + cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xfb); + /* restart continuous tone if enabled */ + if (tone & 0x10) { + cx24123_writereg(state, 0x29, tone & ~0x40); + } return 0; } @@ -984,38 +914,21 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) struct cx24123_state *state = fe->demodulator_priv; u8 val; - switch (state->config->use_isl6421) { - case 1: - - val = cx24123_readlnbreg(state, 0x0); - - switch (tone) { - case SEC_TONE_ON: - dprintk("%s: isl6421 sec tone on\n",__FUNCTION__); - return cx24123_writelnbreg(state, 0x0, val | 0x10); - case SEC_TONE_OFF: - dprintk("%s: isl6421 sec tone off\n",__FUNCTION__); - return cx24123_writelnbreg(state, 0x0, val & 0x2f); - default: - printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); - return -EINVAL; - } - - case 0: + /* wait for diseqc queue ready */ + cx24123_wait_for_diseqc(state); - val = cx24123_readreg(state, 0x29); + val = cx24123_readreg(state, 0x29) & ~0x40; - switch (tone) { - case SEC_TONE_ON: - dprintk("%s: setting tone on\n", __FUNCTION__); - return cx24123_writereg(state, 0x29, val | 0x10); - case SEC_TONE_OFF: - dprintk("%s: setting tone off\n",__FUNCTION__); - return cx24123_writereg(state, 0x29, val & 0xef); - default: - printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); - return -EINVAL; - } + switch (tone) { + case SEC_TONE_ON: + dprintk("%s: setting tone on\n", __FUNCTION__); + return cx24123_writereg(state, 0x29, val | 0x10); + case SEC_TONE_OFF: + dprintk("%s: setting tone off\n",__FUNCTION__); + return cx24123_writereg(state, 0x29, val & 0xef); + default: + printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); + return -EINVAL; } return 0; @@ -1051,7 +964,6 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, memcpy(&state->ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); state->lastber = 0; state->snr = 0; - state->lnbreg = 0; state->VCAarg = 0; state->VGAarg = 0; state->bandselectarg = 0; diff --git a/linux/drivers/media/dvb/frontends/cx24123.h b/linux/drivers/media/dvb/frontends/cx24123.h index 7ec4ee856..9606f8259 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.h +++ b/linux/drivers/media/dvb/frontends/cx24123.h @@ -28,17 +28,8 @@ struct cx24123_config /* the demodulator's i2c address */ u8 demod_address; - /* - cards like Hauppauge Nova-S Plus/Nova-SE2 use an Intersil ISL6421 chip - for LNB control, while KWorld DVB-S 100 use the LNBDC and LNBTone bits - from register 0x29 of the CX24123 demodulator - */ - int use_isl6421; - /* Need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); - - void (*enable_lnb_voltage)(struct dvb_frontend* fe, int on); }; extern struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, -- cgit v1.2.3 From 7a655551e942a6eae6fee9e25411a41f841046c9 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Sat, 13 May 2006 00:31:51 +0100 Subject: Change the sweeprate for TT C1500 using QAM64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Per Dalén This patch changes the sweeprate for TT C1500 using QAM64. It has been proven to work using QAM64 at a SRate of 6875 for the two different cable networks. Signed-off-by: Per Dalén Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/stv0297.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index 9c5788c2e..9dd0766d1 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -401,7 +401,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par case QAM_32: case QAM_64: delay = 100; - sweeprate = 1500; + sweeprate = 1000; break; case QAM_128: -- cgit v1.2.3 From d7e9bdcf5053c838a7421c8e52fed2a0bd4644fb Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Sun, 14 May 2006 10:01:31 +0200 Subject: Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend From: Patrick Boettcher The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver is having a field of dvb_frontend_ops in its private-state-struct and using the reference for filling the pointer-field in dvb_frontend. - It saves at least two lines of code per demod-driver, - reduces object size (one less dereference per frontend_ops-access), - be coherent with dvb_tuner_ops, - makes it a little bit easier for newbies to understand how it works and - avoids stupid mistakes because you would have to copy the dvb_frontend_ops always, before you could assign the static pointer directly, which was dangerous. Signed-off-by: Patrick Boettcher --- linux/drivers/media/dvb/frontends/at76c651.c | 11 ++++----- linux/drivers/media/dvb/frontends/bcm3510.c | 4 +--- linux/drivers/media/dvb/frontends/bsbe1.h | 4 ++-- linux/drivers/media/dvb/frontends/bsru6.h | 4 ++-- linux/drivers/media/dvb/frontends/cx22700.c | 11 ++++----- linux/drivers/media/dvb/frontends/cx22702.c | 11 ++++----- linux/drivers/media/dvb/frontends/cx24110.c | 11 ++++----- linux/drivers/media/dvb/frontends/cx24123.c | 8 +++---- linux/drivers/media/dvb/frontends/dib3000-common.h | 2 -- linux/drivers/media/dvb/frontends/dib3000mb.c | 9 ++++---- linux/drivers/media/dvb/frontends/dib3000mc.c | 12 ++++------ linux/drivers/media/dvb/frontends/dvb-pll.c | 20 ++++++++-------- linux/drivers/media/dvb/frontends/dvb_dummy_fe.c | 16 +++---------- linux/drivers/media/dvb/frontends/isl6421.c | 14 +++++------ linux/drivers/media/dvb/frontends/l64781.c | 10 ++++---- linux/drivers/media/dvb/frontends/lg_h06xf.h | 8 +++---- linux/drivers/media/dvb/frontends/lgdt330x.c | 17 +++++++------- linux/drivers/media/dvb/frontends/lnbp21.c | 14 +++++------ linux/drivers/media/dvb/frontends/mt312.c | 27 +++++++++++----------- linux/drivers/media/dvb/frontends/mt352.c | 14 +++++------ linux/drivers/media/dvb/frontends/nxt200x.c | 8 +++---- linux/drivers/media/dvb/frontends/nxt6000.c | 10 ++++---- linux/drivers/media/dvb/frontends/or51132.c | 12 ++++------ linux/drivers/media/dvb/frontends/or51211.c | 4 +--- linux/drivers/media/dvb/frontends/s5h1420.c | 22 ++++++++---------- linux/drivers/media/dvb/frontends/sp8870.c | 11 ++++----- linux/drivers/media/dvb/frontends/sp887x.c | 16 ++++++------- linux/drivers/media/dvb/frontends/stv0297.c | 10 ++++---- linux/drivers/media/dvb/frontends/stv0299.c | 10 ++++---- linux/drivers/media/dvb/frontends/tda10021.c | 10 ++++---- linux/drivers/media/dvb/frontends/tda1004x.c | 13 ++++------- linux/drivers/media/dvb/frontends/tda8083.c | 10 ++++---- linux/drivers/media/dvb/frontends/tda80xx.c | 11 ++++----- linux/drivers/media/dvb/frontends/ves1820.c | 16 ++++++------- linux/drivers/media/dvb/frontends/ves1x93.c | 10 ++++---- linux/drivers/media/dvb/frontends/zl10353.c | 14 +++++------ 36 files changed, 171 insertions(+), 243 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/at76c651.c b/linux/drivers/media/dvb/frontends/at76c651.c index 556689a80..600462b70 100644 --- a/linux/drivers/media/dvb/frontends/at76c651.c +++ b/linux/drivers/media/dvb/frontends/at76c651.c @@ -41,8 +41,6 @@ struct at76c651_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct at76c651_config* config; struct dvb_frontend frontend; @@ -246,9 +244,9 @@ static int at76c651_set_parameters(struct dvb_frontend* fe, int ret; struct at76c651_state* state = fe->demodulator_priv; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } if ((ret = at76c651_set_symbol_rate(state, p->u.qam.symbol_rate))) @@ -385,10 +383,9 @@ struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, /* finalise state setup */ state->i2c = i2c; state->revision = at76c651_readreg(state, 0x0f) & 0xfe; - memcpy(&state->ops, &at76c651_ops, sizeof(struct dvb_frontend_ops)); /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &at76c651_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/bcm3510.c b/linux/drivers/media/dvb/frontends/bcm3510.c index ee154299f..104e8592e 100644 --- a/linux/drivers/media/dvb/frontends/bcm3510.c +++ b/linux/drivers/media/dvb/frontends/bcm3510.c @@ -51,7 +51,6 @@ struct bcm3510_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct bcm3510_config* config; struct dvb_frontend frontend; @@ -798,10 +797,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, state->config = config; state->i2c = i2c; - memcpy(&state->ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops)); /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; mutex_init(&state->hab_mutex); diff --git a/linux/drivers/media/dvb/frontends/bsbe1.h b/linux/drivers/media/dvb/frontends/bsbe1.h index b2aeddb14..d8f65738e 100644 --- a/linux/drivers/media/dvb/frontends/bsbe1.h +++ b/linux/drivers/media/dvb/frontends/bsbe1.h @@ -106,8 +106,8 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); ret = i2c_transfer(i2c, &msg, 1); return (ret != 1) ? -EIO : 0; } diff --git a/linux/drivers/media/dvb/frontends/bsru6.h b/linux/drivers/media/dvb/frontends/bsru6.h index 5533512b0..e231cd84b 100644 --- a/linux/drivers/media/dvb/frontends/bsru6.h +++ b/linux/drivers/media/dvb/frontends/bsru6.h @@ -120,8 +120,8 @@ static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_front if (params->frequency > 1530000) buf[3] = 0xc0; - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; return 0; diff --git a/linux/drivers/media/dvb/frontends/cx22700.c b/linux/drivers/media/dvb/frontends/cx22700.c index 02fee9047..3c7c09a36 100644 --- a/linux/drivers/media/dvb/frontends/cx22700.c +++ b/linux/drivers/media/dvb/frontends/cx22700.c @@ -34,8 +34,6 @@ struct cx22700_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct cx22700_config* config; struct dvb_frontend frontend; @@ -327,9 +325,9 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ cx22700_writereg (state, 0x00, 0x00); - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } cx22700_set_inversion (state, p->inversion); @@ -388,13 +386,12 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &cx22700_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if (cx22700_readreg(state, 0x07) < 0) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &cx22700_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/cx22702.c b/linux/drivers/media/dvb/frontends/cx22702.c index a129fc9cb..4106d46c9 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.c +++ b/linux/drivers/media/dvb/frontends/cx22702.c @@ -40,8 +40,6 @@ struct cx22702_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct cx22702_config* config; @@ -211,9 +209,9 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet u8 val; struct cx22702_state* state = fe->demodulator_priv; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* set inversion */ @@ -479,7 +477,6 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &cx22702_ops, sizeof(struct dvb_frontend_ops)); state->prevUCBlocks = 0; /* check if the demod is there */ @@ -487,7 +484,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &cx22702_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/cx24110.c b/linux/drivers/media/dvb/frontends/cx24110.c index 8d98ffb61..ce3c7398b 100644 --- a/linux/drivers/media/dvb/frontends/cx24110.c +++ b/linux/drivers/media/dvb/frontends/cx24110.c @@ -36,8 +36,6 @@ struct cx24110_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct cx24110_config* config; struct dvb_frontend frontend; @@ -538,9 +536,9 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par struct cx24110_state *state = fe->demodulator_priv; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } cx24110_set_inversion (state, p->inversion); @@ -606,7 +604,6 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &cx24110_ops, sizeof(struct dvb_frontend_ops)); state->lastber = 0; state->lastbler = 0; state->lastesn0 = 0; @@ -616,7 +613,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, if ((ret != 0x5a) && (ret != 0x69)) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &cx24110_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index 89b3a6c63..46186c2dc 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -41,7 +41,6 @@ static int debug; struct cx24123_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct cx24123_config* config; struct dvb_frontend frontend; @@ -469,8 +468,8 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) u8 pll_mult; /* check if symbol rate is within limits */ - if ((srate > state->ops.info.symbol_rate_max) || - (srate < state->ops.info.symbol_rate_min)) + if ((srate > state->frontend.ops.info.symbol_rate_max) || + (srate < state->frontend.ops.info.symbol_rate_min)) return -EOPNOTSUPP;; /* choose the sampling rate high enough for the required operation, @@ -1048,7 +1047,6 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); state->lastber = 0; state->snr = 0; state->lnbreg = 0; @@ -1067,7 +1065,7 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/dib3000-common.h b/linux/drivers/media/dvb/frontends/dib3000-common.h index c31d6df15..be1c0d3e1 100644 --- a/linux/drivers/media/dvb/frontends/dib3000-common.h +++ b/linux/drivers/media/dvb/frontends/dib3000-common.h @@ -38,8 +38,6 @@ struct dib3000_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ struct dib3000_config config; diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c index f2f8071ad..7c6dc7e30 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mb.c +++ b/linux/drivers/media/dvb/frontends/dib3000mb.c @@ -60,9 +60,9 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, fe_code_rate_t fe_cr = FEC_NONE; int search_state, seq; - if (tuner && fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, fep); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (tuner && fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, fep); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); deb_setf("bandwidth: "); switch (ofdm->bandwidth) { @@ -705,7 +705,6 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, /* setup the state */ state->i2c = i2c; memcpy(&state->config,config,sizeof(struct dib3000_config)); - memcpy(&state->ops, &dib3000mb_ops, sizeof(struct dvb_frontend_ops)); /* check for the correct demod */ if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) @@ -715,7 +714,7 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dib3000mb_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; /* set the xfer operations */ diff --git a/linux/drivers/media/dvb/frontends/dib3000mc.c b/linux/drivers/media/dvb/frontends/dib3000mc.c index 68a443b3d..6c3be2529 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mc.c +++ b/linux/drivers/media/dvb/frontends/dib3000mc.c @@ -462,9 +462,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, int search_state,auto_val; u16 val; - if (tuner && fe->ops->tuner_ops.set_params) { /* initial call from dvb */ - fe->ops->tuner_ops.set_params(fe, fep); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */ + fe->ops.tuner_ops.set_params(fe, fep); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); state->last_tuned_freq = fep->frequency; // if (!scanboost) { @@ -837,7 +837,6 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, /* setup the state */ state->i2c = i2c; memcpy(&state->config,config,sizeof(struct dib3000_config)); - memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); /* check for the correct demod */ if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) @@ -857,7 +856,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; /* set the xfer operations */ @@ -874,6 +873,7 @@ error: kfree(state); return NULL; } +EXPORT_SYMBOL(dib3000mc_attach); static struct dvb_frontend_ops dib3000mc_ops = { @@ -912,5 +912,3 @@ static struct dvb_frontend_ops dib3000mc_ops = { MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(dib3000mc_attach); diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index a1a4be41e..a18968345 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -505,8 +505,8 @@ static int dvb_pll_sleep(struct dvb_frontend *fe) buf[2] = priv->pll_desc->entries[i].config; buf[3] = priv->pll_desc->entries[i].cb; - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { return result; } @@ -529,15 +529,15 @@ static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_param return -EINVAL; // DVBT bandwidth only just now - if (fe->ops->info.type == FE_OFDM) { + if (fe->ops.info.type == FE_OFDM) { bandwidth = params->u.ofdm.bandwidth; } if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, bandwidth)) != 0) return result; - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { return result; } @@ -567,7 +567,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parame return -EINVAL; // DVBT bandwidth only just now - if (fe->ops->info.type == FE_OFDM) { + if (fe->ops.info.type == FE_OFDM) { bandwidth = params->u.ofdm.bandwidth; } @@ -623,10 +623,10 @@ int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2 priv->i2c = i2c; priv->pll_desc = desc; - memcpy(&fe->ops->tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops)); - strncpy(fe->ops->tuner_ops.info.name, desc->name, 128); - fe->ops->tuner_ops.info.frequency_min = desc->min; - fe->ops->tuner_ops.info.frequency_min = desc->max; + memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops)); + strncpy(fe->ops.tuner_ops.info.name, desc->name, 128); + fe->ops.tuner_ops.info.frequency_min = desc->min; + fe->ops.tuner_ops.info.frequency_min = desc->max; fe->tuner_priv = priv; return 0; diff --git a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c index 78ea4ff03..6271b1e7f 100644 --- a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c @@ -30,7 +30,6 @@ struct dvb_dummy_fe_state { - struct dvb_frontend_ops ops; struct dvb_frontend frontend; }; @@ -121,11 +120,8 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); if (state == NULL) goto error; - /* setup the state */ - memcpy(&state->ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops)); - /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; @@ -144,11 +140,8 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach() state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); if (state == NULL) goto error; - /* setup the state */ - memcpy(&state->ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops)); - /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; @@ -167,11 +160,8 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach() state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); if (state == NULL) goto error; - /* setup the state */ - memcpy(&state->ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops)); - /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/isl6421.c b/linux/drivers/media/dvb/frontends/isl6421.c index 36992077a..58c34db31 100644 --- a/linux/drivers/media/dvb/frontends/isl6421.c +++ b/linux/drivers/media/dvb/frontends/isl6421.c @@ -99,11 +99,11 @@ static void isl6421_release(struct dvb_frontend *fe) isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); /* free data & call next release routine */ - fe->ops->release = isl6421->release_chain; + fe->ops.release = isl6421->release_chain; kfree(fe->misc_priv); fe->misc_priv = NULL; - if (fe->ops->release) - fe->ops->release(fe); + if (fe->ops.release) + fe->ops.release(fe); } int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, @@ -133,12 +133,12 @@ int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr } /* install release callback */ - isl6421->release_chain = fe->ops->release; - fe->ops->release = isl6421_release; + isl6421->release_chain = fe->ops.release; + fe->ops.release = isl6421_release; /* override frontend ops */ - fe->ops->set_voltage = isl6421_set_voltage; - fe->ops->enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; + fe->ops.set_voltage = isl6421_set_voltage; + fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; return 0; } diff --git a/linux/drivers/media/dvb/frontends/l64781.c b/linux/drivers/media/dvb/frontends/l64781.c index fa4a87e00..f3bc82e44 100644 --- a/linux/drivers/media/dvb/frontends/l64781.c +++ b/linux/drivers/media/dvb/frontends/l64781.c @@ -32,7 +32,6 @@ struct l64781_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct l64781_config* config; struct dvb_frontend frontend; @@ -141,9 +140,9 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa u8 val0x06; int bw = p->bandwidth - BANDWIDTH_8_MHZ; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } if (param->inversion != INVERSION_ON && @@ -509,7 +508,6 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &l64781_ops, sizeof(struct dvb_frontend_ops)); state->first = 1; /** @@ -555,7 +553,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &l64781_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/lg_h06xf.h b/linux/drivers/media/dvb/frontends/lg_h06xf.h index 21acb5bad..d41e0299f 100644 --- a/linux/drivers/media/dvb/frontends/lg_h06xf.h +++ b/linux/drivers/media/dvb/frontends/lg_h06xf.h @@ -29,8 +29,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada int err; dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0); - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "lg_h06xf: %s error " "(addr %02x <- %02x, err = %i)\n", @@ -53,8 +53,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada buf[1] = 0x50; msg.len = 2; #endif - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "lg_h06xf: %s error " "(addr %02x <- %02x, err = %i)\n", diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c index cf1b0fefe..2a28b768c 100644 --- a/linux/drivers/media/dvb/frontends/lgdt330x.c +++ b/linux/drivers/media/dvb/frontends/lgdt330x.c @@ -60,7 +60,6 @@ if (debug) printk(KERN_DEBUG "lgdt330x: " args); \ struct lgdt330x_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* Configuration settings */ const struct lgdt330x_config* config; @@ -400,9 +399,9 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, } /* Tune to the specified frequency */ - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* Keep track of the new frequency */ @@ -740,16 +739,19 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, /* Setup the state */ state->config = config; state->i2c = i2c; + + /* Create dvb_frontend */ switch (config->demod_chip) { case LGDT3302: - memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->frontend.ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); break; case LGDT3303: - memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->frontend.ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); break; default: goto error; } + state->frontend.demodulator_priv = state; /* Verify communication with demod chip */ if (i2c_read_demod_bytes(state, 2, buf, 1)) @@ -758,9 +760,6 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, state->current_frequency = -1; state->current_modulation = -1; - /* Create dvb_frontend */ - state->frontend.ops = &state->ops; - state->frontend.demodulator_priv = state; return &state->frontend; error: diff --git a/linux/drivers/media/dvb/frontends/lnbp21.c b/linux/drivers/media/dvb/frontends/lnbp21.c index c9152c1fb..e933edc8d 100644 --- a/linux/drivers/media/dvb/frontends/lnbp21.c +++ b/linux/drivers/media/dvb/frontends/lnbp21.c @@ -97,11 +97,11 @@ static void lnbp21_release(struct dvb_frontend *fe) lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); /* free data & call next release routine */ - fe->ops->release = lnbp21->release_chain; + fe->ops.release = lnbp21->release_chain; kfree(fe->misc_priv); fe->misc_priv = NULL; - if (fe->ops->release) - fe->ops->release(fe); + if (fe->ops.release) + fe->ops.release(fe); } int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) @@ -129,12 +129,12 @@ int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_ } /* install release callback */ - lnbp21->release_chain = fe->ops->release; - fe->ops->release = lnbp21_release; + lnbp21->release_chain = fe->ops.release; + fe->ops.release = lnbp21_release; /* override frontend ops */ - fe->ops->set_voltage = lnbp21_set_voltage; - fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; + fe->ops.set_voltage = lnbp21_set_voltage; + fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; return 0; } diff --git a/linux/drivers/media/dvb/frontends/mt312.c b/linux/drivers/media/dvb/frontends/mt312.c index 46e12a8ac..1ef821825 100644 --- a/linux/drivers/media/dvb/frontends/mt312.c +++ b/linux/drivers/media/dvb/frontends/mt312.c @@ -39,7 +39,6 @@ struct mt312_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct mt312_config* config; struct dvb_frontend frontend; @@ -471,16 +470,16 @@ static int mt312_set_frontend(struct dvb_frontend* fe, dprintk("%s: Freq %d\n", __FUNCTION__, p->frequency); - if ((p->frequency < fe->ops->info.frequency_min) - || (p->frequency > fe->ops->info.frequency_max)) + if ((p->frequency < fe->ops.info.frequency_min) + || (p->frequency > fe->ops.info.frequency_max)) return -EINVAL; if ((p->inversion < INVERSION_OFF) || (p->inversion > INVERSION_ON)) return -EINVAL; - if ((p->u.qpsk.symbol_rate < fe->ops->info.symbol_rate_min) - || (p->u.qpsk.symbol_rate > fe->ops->info.symbol_rate_max)) + if ((p->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min) + || (p->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max)) return -EINVAL; if ((p->u.qpsk.fec_inner < FEC_NONE) @@ -523,9 +522,9 @@ static int mt312_set_frontend(struct dvb_frontend* fe, return -EINVAL; } - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* sr = (u16)(sr * 256.0 / 1000000.0) */ @@ -670,19 +669,22 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if (mt312_readreg(state, ID, &state->id) < 0) goto error; + /* create dvb_frontend */ + memcpy(&state->frontend.ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops)); + state->frontend.demodulator_priv = state; + switch (state->id) { case ID_VP310: - strcpy(state->ops.info.name, "Zarlink VP310 DVB-S"); + strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S"); state->frequency = 90; break; case ID_MT312: - strcpy(state->ops.info.name, "Zarlink MT312 DVB-S"); + strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S"); state->frequency = 60; break; default: @@ -690,9 +692,6 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, goto error; } - /* create dvb_frontend */ - state->frontend.ops = &state->ops; - state->frontend.demodulator_priv = state; return &state->frontend; error: diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index ed3bede02..b24053733 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -45,7 +45,6 @@ struct mt352_state { struct i2c_adapter* i2c; struct dvb_frontend frontend; - struct dvb_frontend_ops ops; /* configuration settings */ struct mt352_config config; @@ -290,9 +289,9 @@ static int mt352_set_parameters(struct dvb_frontend* fe, // if there is no secondary tuner, call set_params to set up a potential // tuner attached elsewhere if (state->config.no_tuner) { - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* start decoding only */ @@ -302,8 +301,8 @@ static int mt352_set_parameters(struct dvb_frontend* fe, // retrieve the pllbuf - we do this even if there is no // secondary tuner simply so we have a record of what was sent for // debugging. - if (fe->ops->tuner_ops.calc_regs) { - fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); + if (fe->ops.tuner_ops.calc_regs) { + fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5); buf[8] <<= 1; mt352_write(fe, buf, sizeof(buf)); } @@ -558,13 +557,12 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, /* setup the state */ state->i2c = i2c; memcpy(&state->config,config,sizeof(struct mt352_config)); - memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c index 9b13f14f1..55671cb52 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.c +++ b/linux/drivers/media/dvb/frontends/nxt200x.c @@ -55,7 +55,6 @@ struct nxt200x_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct nxt200x_config* config; struct dvb_frontend frontend; @@ -548,8 +547,8 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, } /* get tuning information */ - if (fe->ops->tuner_ops.calc_regs) { - fe->ops->tuner_ops.calc_regs(fe, p, buf, 5); + if (fe->ops.tuner_ops.calc_regs) { + fe->ops.tuner_ops.calc_regs(fe, p, buf, 5); } /* set additional params */ @@ -1161,7 +1160,6 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops)); state->initialised = 0; /* read card id */ @@ -1200,7 +1198,7 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/nxt6000.c b/linux/drivers/media/dvb/frontends/nxt6000.c index bca83266a..d313d7dcf 100644 --- a/linux/drivers/media/dvb/frontends/nxt6000.c +++ b/linux/drivers/media/dvb/frontends/nxt6000.c @@ -33,7 +33,6 @@ struct nxt6000_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct nxt6000_config* config; struct dvb_frontend frontend; @@ -463,9 +462,9 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par struct nxt6000_state* state = fe->demodulator_priv; int result; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) @@ -552,13 +551,12 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if (nxt6000_readreg(state, OFDM_MSC_REV) != NXT6000ASICDEVICE) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/or51132.c b/linux/drivers/media/dvb/frontends/or51132.c index 19f75e6ed..d20ab30c1 100644 --- a/linux/drivers/media/dvb/frontends/or51132.c +++ b/linux/drivers/media/dvb/frontends/or51132.c @@ -54,7 +54,6 @@ static int debug; struct or51132_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* Configuration settings */ const struct or51132_config* config; @@ -383,9 +382,9 @@ static int or51132_set_parameters(struct dvb_frontend* fe, or51132_setmode(fe); } - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* Set to current mode */ @@ -618,12 +617,11 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, /* Setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &or51132_ops, sizeof(struct dvb_frontend_ops)); state->current_frequency = -1; state->current_modulation = -1; /* Create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &or51132_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; @@ -636,7 +634,7 @@ static struct dvb_frontend_ops or51132_ops = { .info = { .name = "Oren OR51132 VSB/QAM Frontend", - .type = FE_ATSC, + .type = FE_ATSC, .frequency_min = 44000000, .frequency_max = 958000000, .frequency_stepsize = 166666, diff --git a/linux/drivers/media/dvb/frontends/or51211.c b/linux/drivers/media/dvb/frontends/or51211.c index 7c3aed1f5..26bed616f 100644 --- a/linux/drivers/media/dvb/frontends/or51211.c +++ b/linux/drivers/media/dvb/frontends/or51211.c @@ -54,7 +54,6 @@ static u8 cmd_buf[] = {0x04,0x01,0x50,0x80,0x06}; // ATSC struct or51211_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* Configuration settings */ const struct or51211_config* config; @@ -585,12 +584,11 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config, /* Setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &or51211_ops, sizeof(struct dvb_frontend_ops)); state->initialized = 0; state->current_frequency = 0; /* Create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &or51211_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/s5h1420.c b/linux/drivers/media/dvb/frontends/s5h1420.c index 5dee51154..2c2c344c4 100644 --- a/linux/drivers/media/dvb/frontends/s5h1420.c +++ b/linux/drivers/media/dvb/frontends/s5h1420.c @@ -38,7 +38,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. struct s5h1420_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct s5h1420_config* config; struct dvb_frontend frontend; @@ -595,14 +594,14 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, (state->fec_inner == p->u.qpsk.fec_inner) && (state->symbol_rate == p->u.qpsk.symbol_rate)) { - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } - if (fe->ops->tuner_ops.get_frequency) { + if (fe->ops.tuner_ops.get_frequency) { u32 tmp; - fe->ops->tuner_ops.get_frequency(fe, &tmp); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + fe->ops.tuner_ops.get_frequency(fe, &tmp); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, p->frequency - tmp); } else { s5h1420_setfreqoffset(state, 0); @@ -652,9 +651,9 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); /* set tuner PLL */ - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); s5h1420_setfreqoffset(state, 0); } @@ -766,7 +765,6 @@ struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops)); state->postlocked = 0; state->fclk = 88000000; state->tunedfreq = 0; @@ -779,7 +777,7 @@ struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/sp8870.c b/linux/drivers/media/dvb/frontends/sp8870.c index 4d553c0da..44ec5b9a4 100644 --- a/linux/drivers/media/dvb/frontends/sp8870.c +++ b/linux/drivers/media/dvb/frontends/sp8870.c @@ -44,8 +44,6 @@ struct sp8870_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct sp8870_config* config; struct dvb_frontend frontend; @@ -262,9 +260,9 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, sp8870_microcontroller_stop(state); // set tuner parameters - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } // sample rate correction bit [23..17] @@ -566,14 +564,13 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &sp8870_ops, sizeof(struct dvb_frontend_ops)); state->initialised = 0; /* check if the demod is there */ if (sp8870_readreg(state, 0x0200) < 0) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &sp8870_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/sp887x.c b/linux/drivers/media/dvb/frontends/sp887x.c index 543dfa145..b0a2b02f6 100644 --- a/linux/drivers/media/dvb/frontends/sp887x.c +++ b/linux/drivers/media/dvb/frontends/sp887x.c @@ -24,7 +24,6 @@ struct sp887x_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct sp887x_config* config; struct dvb_frontend frontend; @@ -353,13 +352,13 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, sp887x_microcontroller_stop(state); /* setup the PLL */ - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, 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); - 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); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } else { actual_freq = p->frequency; } @@ -564,14 +563,13 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &sp887x_ops, sizeof(struct dvb_frontend_ops)); state->initialised = 0; /* check if the demod is there */ if (sp887x_readreg(state, 0x0200) < 0) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &sp887x_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index 9c5788c2e..b01e56d12 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -32,7 +32,6 @@ struct stv0297_state { struct i2c_adapter *i2c; - struct dvb_frontend_ops ops; const struct stv0297_config *config; struct dvb_frontend frontend; @@ -433,9 +432,9 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par } stv0297_init(fe); - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } /* clear software interrupts */ @@ -649,7 +648,6 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); state->base_freq = 0; /* check if the demod is there */ @@ -657,7 +655,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index e91bb5842..96648a754 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -56,7 +56,6 @@ struct stv0299_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct stv0299_config* config; struct dvb_frontend frontend; @@ -547,9 +546,9 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par if (state->config->invert) invval = (~invval) & 1; 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); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } stv0299_set_FEC (state, p->u.qpsk.fec_inner); @@ -648,7 +647,6 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); state->initialised = 0; state->tuner_frequency = 0; state->symbol_rate = 0; @@ -665,7 +663,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, if (id != 0xa1 && id != 0x80) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/tda10021.c b/linux/drivers/media/dvb/frontends/tda10021.c index 1950c72fd..48b02abd0 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.c +++ b/linux/drivers/media/dvb/frontends/tda10021.c @@ -36,7 +36,6 @@ struct tda10021_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct tda10021_config* config; struct dvb_frontend frontend; @@ -260,9 +259,9 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, //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); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } tda10021_set_symbolrate (state, p->u.qam.symbol_rate); @@ -421,7 +420,6 @@ struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &tda10021_ops, sizeof(struct dvb_frontend_ops)); state->pwm = pwm; state->reg0 = tda10021_inittab[0]; @@ -429,7 +427,7 @@ struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, if ((tda10021_readreg(state, 0x1a) & 0xf0) != 0x70) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &tda10021_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/tda1004x.c b/linux/drivers/media/dvb/frontends/tda1004x.c index 5288b44cf..59a2ed614 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.c +++ b/linux/drivers/media/dvb/frontends/tda1004x.c @@ -47,7 +47,6 @@ enum tda1004x_demod { struct tda1004x_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; const struct tda1004x_config* config; struct dvb_frontend frontend; @@ -695,9 +694,9 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, } // set frequency - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, fe_params); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, fe_params); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } // Hardcoded to use auto as much as possible on the TDA10045 as it @@ -1243,7 +1242,6 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &tda10045_ops, sizeof(struct dvb_frontend_ops)); state->demod_type = TDA1004X_DEMOD_TDA10045; /* check if the demod is there */ @@ -1253,7 +1251,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &tda10045_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; } @@ -1302,7 +1300,6 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); state->demod_type = TDA1004X_DEMOD_TDA10046; /* check if the demod is there */ @@ -1312,7 +1309,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; } diff --git a/linux/drivers/media/dvb/frontends/tda8083.c b/linux/drivers/media/dvb/frontends/tda8083.c index 0aeaec890..3aa45ebba 100644 --- a/linux/drivers/media/dvb/frontends/tda8083.c +++ b/linux/drivers/media/dvb/frontends/tda8083.c @@ -37,7 +37,6 @@ struct tda8083_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct tda8083_config* config; struct dvb_frontend frontend; @@ -293,9 +292,9 @@ static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct tda8083_state* state = fe->demodulator_priv; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } tda8083_set_inversion (state, p->inversion); @@ -397,13 +396,12 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &tda8083_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if ((tda8083_readreg(state, 0x00)) != 0x05) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &tda8083_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/tda80xx.c b/linux/drivers/media/dvb/frontends/tda80xx.c index 7954e8732..996fd4beb 100644 --- a/linux/drivers/media/dvb/frontends/tda80xx.c +++ b/linux/drivers/media/dvb/frontends/tda80xx.c @@ -46,8 +46,6 @@ struct tda80xx_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct tda80xx_config* config; @@ -523,9 +521,9 @@ static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct tda80xx_state* state = fe->demodulator_priv; - if (fe->ops->tuner_ops->set_params) { - fe->ops->tuner_ops->set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } tda80xx_set_parameters(state, p->inversion, p->u.qpsk.symbol_rate, p->u.qpsk.fec_inner); @@ -655,7 +653,6 @@ struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &tda80xx_ops, sizeof(struct dvb_frontend_ops)); state->spectral_inversion = INVERSION_AUTO; state->code_rate = FEC_AUTO; state->status = 0; @@ -690,7 +687,7 @@ struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &tda80xx_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index 9810e2dcb..6bffe85c1 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -35,7 +35,6 @@ struct ves1820_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct ves1820_config* config; struct dvb_frontend frontend; @@ -220,9 +219,9 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p if (real_qam < 0 || real_qam > 4) return -EINVAL; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } ves1820_set_symbolrate(state, p->u.qam.symbol_rate); @@ -381,7 +380,6 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, goto error; /* setup the state */ - memcpy(&state->ops, &ves1820_ops, sizeof(struct dvb_frontend_ops)); state->reg0 = ves1820_inittab[0]; state->config = config; state->i2c = i2c; @@ -394,12 +392,12 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, if (verbose) printk("ves1820: pwm=0x%02x\n", state->pwm); - state->ops.info.symbol_rate_min = (state->config->xin / 2) / 64; /* SACLK/64 == (XIN/2)/64 */ - state->ops.info.symbol_rate_max = (state->config->xin / 2) / 4; /* SACLK/4 */ - /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &ves1820_ops, sizeof(struct dvb_frontend_ops)); + state->frontend.ops.info.symbol_rate_min = (state->config->xin / 2) / 64; /* SACLK/64 == (XIN/2)/64 */ + state->frontend.ops.info.symbol_rate_max = (state->config->xin / 2) / 4; /* SACLK/4 */ state->frontend.demodulator_priv = state; + return &state->frontend; error: diff --git a/linux/drivers/media/dvb/frontends/ves1x93.c b/linux/drivers/media/dvb/frontends/ves1x93.c index 660aa7bb9..54d7b0757 100644 --- a/linux/drivers/media/dvb/frontends/ves1x93.c +++ b/linux/drivers/media/dvb/frontends/ves1x93.c @@ -36,7 +36,6 @@ struct ves1x93_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; /* configuration settings */ const struct ves1x93_config* config; struct dvb_frontend frontend; @@ -389,9 +388,9 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par { struct ves1x93_state* state = fe->demodulator_priv; - if (fe->ops->tuner_ops.set_params) { - fe->ops->tuner_ops.set_params(fe, p); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, p); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } ves1x93_set_inversion (state, p->inversion); ves1x93_set_fec (state, p->u.qpsk.fec_inner); @@ -463,7 +462,6 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops)); state->inversion = INVERSION_OFF; /* check if the demod is there + identify it */ @@ -498,7 +496,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, } /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; diff --git a/linux/drivers/media/dvb/frontends/zl10353.c b/linux/drivers/media/dvb/frontends/zl10353.c index 1018baae0..27001b453 100644 --- a/linux/drivers/media/dvb/frontends/zl10353.c +++ b/linux/drivers/media/dvb/frontends/zl10353.c @@ -34,7 +34,6 @@ struct zl10353_state { struct i2c_adapter *i2c; struct dvb_frontend frontend; - struct dvb_frontend_ops ops; struct zl10353_config config; }; @@ -150,15 +149,15 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, // if there is no attached secondary tuner, we call set_params to program // 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); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.tuner_ops.set_params) { + fe->ops.tuner_ops.set_params(fe, param); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } } // 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); + if (fe->ops.tuner_ops.calc_regs) { + fe->ops.tuner_ops.calc_regs(fe, param, pllbuf+1, 5); pllbuf[1] <<= 1; } else { // fake pllbuf settings @@ -288,14 +287,13 @@ struct dvb_frontend *zl10353_attach(const struct zl10353_config *config, /* setup the state */ state->i2c = i2c; memcpy(&state->config, config, sizeof(struct zl10353_config)); - memcpy(&state->ops, &zl10353_ops, sizeof(struct dvb_frontend_ops)); /* check if the demod is there */ if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353) goto error; /* create dvb_frontend */ - state->frontend.ops = &state->ops; + memcpy(&state->frontend.ops, &zl10353_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; -- cgit v1.2.3 From 7b2b6e9be7a9c4c8ba356cfed999b6283579c7ae Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 16 May 2006 21:22:02 +0100 Subject: Fix Pinnacle 300i From: Andrew de Quincey I had broken the mt352 tuning when a non-directly connected PLL was used - uncommon, but this is what is used on the pinnacle card. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/frontends/mt352.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index ed3bede02..8601a3f43 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -287,30 +287,22 @@ static int mt352_set_parameters(struct dvb_frontend* fe, mt352_calc_nominal_rate(state, op->bandwidth, buf+4); mt352_calc_input_freq(state, buf+6); - // if there is no secondary tuner, call set_params to set up a potential - // tuner attached elsewhere if (state->config.no_tuner) { if (fe->ops->tuner_ops.set_params) { fe->ops->tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops->i2c_gate_ctrl) + fe->ops->i2c_gate_ctrl(fe, 0); } - /* start decoding only */ + mt352_write(fe, buf, 8); mt352_write(fe, fsm_go, 2); - } - - // retrieve the pllbuf - we do this even if there is no - // secondary tuner simply so we have a record of what was sent for - // debugging. - if (fe->ops->tuner_ops.calc_regs) { - fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); - buf[8] <<= 1; - mt352_write(fe, buf, sizeof(buf)); - } - - // send PLL and start tuning and then decoding - if (!state->config.no_tuner) { - mt352_write(fe, tuner_go, 2); + } else { + if (fe->ops->tuner_ops.calc_regs) { + fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); + buf[8] <<= 1; + mt352_write(fe, buf, sizeof(buf)); + mt352_write(fe, tuner_go, 2); + } } return 0; -- cgit v1.2.3 From 4cac5256e71021e5bd26eff40f465a6f41fe4b1a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 May 2006 12:08:47 -0300 Subject: Fix broken DVB drivers caused by a recent merge From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/frontends/mt352.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index abd638349..5de7376c9 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -289,15 +289,15 @@ static int mt352_set_parameters(struct dvb_frontend* fe, if (state->config.no_tuner) { if (fe->ops.tuner_ops.set_params) { fe->ops.tuner_ops.set_params(fe, param); - if (fe->ops->i2c_gate_ctrl) - fe->ops->i2c_gate_ctrl(fe, 0); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); } mt352_write(fe, buf, 8); 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); + if (fe->ops.tuner_ops.calc_regs) { + fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5); buf[8] <<= 1; mt352_write(fe, buf, sizeof(buf)); mt352_write(fe, tuner_go, 2); -- cgit v1.2.3 From f90de21871e817db194b7904ac76ab19a7797fa2 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 20 Jun 2006 08:18:13 -0400 Subject: lgdt330x: fix missing line in VSB snr decoding logic From: Mac Michaels - fix missing line in VSB snr decoding logic for lgdt3303 Signed-off-by: Mac Michaels Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/lgdt330x.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c index 2a28b768c..b48b82b11 100644 --- a/linux/drivers/media/dvb/frontends/lgdt330x.c +++ b/linux/drivers/media/dvb/frontends/lgdt330x.c @@ -685,6 +685,7 @@ static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr) if (state->current_modulation == VSB_8) { + i2c_read_demod_bytes(state, 0x6e, buf, 5); #if 0 /* Equalizer Mean-Square Error Register for VSB */ noise = ((buf[0] & 0x78) << 13) | (buf[1] << 8) | buf[2]; -- cgit v1.2.3 From 48e971d5ca65cc35c8eb0baf2613ee29a57d935b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 29 Jun 2006 19:29:29 -0400 Subject: cx24123: fix set_voltage function according to the specs From: Saqeb Akhter The set_voltage function in cx24123.c was corrected to match how it is described in the CX24123 specs, producing the correct behaviour for cards that require it. Signed-off-by: Saqeb Akhter Acked-by: Andrew de Quincey Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/cx24123.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index ab1bc9a22..cdec0857a 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -681,10 +681,10 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage switch (voltage) { case SEC_VOLTAGE_13: dprintk("%s: setting voltage 13V\n", __FUNCTION__); - return cx24123_writereg(state, 0x29, val | 0x80); + return cx24123_writereg(state, 0x29, val & 0x7f); case SEC_VOLTAGE_18: dprintk("%s: setting voltage 18V\n", __FUNCTION__); - return cx24123_writereg(state, 0x29, val & 0x7f); + return cx24123_writereg(state, 0x29, val | 0x80); default: return -EINVAL; }; -- cgit v1.2.3 From f1346906413662bc5e41ae511e13898e57bf383f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 30 Jun 2006 11:51:11 -0300 Subject: Missing statement in drivers/media/dvb/frontends/cx22700.c From: Eric Sesterhenn Stumbled over this because of coverity (id #492), seems like we are missing a return statement here and fail to do proper bounds checking. If this assumption is false we should at least change the identation to make it clear Signed-off-by: Eric Sesterhenn Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/frontends/cx22700.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/dvb/frontends') diff --git a/linux/drivers/media/dvb/frontends/cx22700.c b/linux/drivers/media/dvb/frontends/cx22700.c index 3c7c09a36..13ad1bfae 100644 --- a/linux/drivers/media/dvb/frontends/cx22700.c +++ b/linux/drivers/media/dvb/frontends/cx22700.c @@ -134,6 +134,7 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet return -EINVAL; if (p->code_rate_LP < FEC_1_2 || p->code_rate_LP > FEC_7_8) + return -EINVAL; if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) return -EINVAL; -- cgit v1.2.3