diff options
Diffstat (limited to 'linux/drivers/media/dvb/frontends/at76c651.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/at76c651.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/frontends/at76c651.c b/linux/drivers/media/dvb/frontends/at76c651.c index ddcb99cc5..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,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 +267,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 +337,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; @@ -379,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; @@ -414,6 +417,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, |