aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/mt352.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/mt352.c')
-rw-r--r--drivers/media/dvb/frontends/mt352.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index aaaec909ddf8..5de7376c94ce 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -45,7 +45,6 @@
45struct mt352_state { 45struct mt352_state {
46 struct i2c_adapter* i2c; 46 struct i2c_adapter* i2c;
47 struct dvb_frontend frontend; 47 struct dvb_frontend frontend;
48 struct dvb_frontend_ops ops;
49 48
50 /* configuration settings */ 49 /* configuration settings */
51 struct mt352_config config; 50 struct mt352_config config;
@@ -286,16 +285,25 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
286 285
287 mt352_calc_nominal_rate(state, op->bandwidth, buf+4); 286 mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
288 mt352_calc_input_freq(state, buf+6); 287 mt352_calc_input_freq(state, buf+6);
289 state->config.pll_set(fe, param, buf+8);
290 288
291 mt352_write(fe, buf, sizeof(buf));
292 if (state->config.no_tuner) { 289 if (state->config.no_tuner) {
293 /* start decoding */ 290 if (fe->ops.tuner_ops.set_params) {
291 fe->ops.tuner_ops.set_params(fe, param);
292 if (fe->ops.i2c_gate_ctrl)
293 fe->ops.i2c_gate_ctrl(fe, 0);
294 }
295
296 mt352_write(fe, buf, 8);
294 mt352_write(fe, fsm_go, 2); 297 mt352_write(fe, fsm_go, 2);
295 } else { 298 } else {
296 /* start tuning */ 299 if (fe->ops.tuner_ops.calc_regs) {
297 mt352_write(fe, tuner_go, 2); 300 fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
301 buf[8] <<= 1;
302 mt352_write(fe, buf, sizeof(buf));
303 mt352_write(fe, tuner_go, 2);
304 }
298 } 305 }
306
299 return 0; 307 return 0;
300} 308}
301 309
@@ -541,13 +549,12 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
541 /* setup the state */ 549 /* setup the state */
542 state->i2c = i2c; 550 state->i2c = i2c;
543 memcpy(&state->config,config,sizeof(struct mt352_config)); 551 memcpy(&state->config,config,sizeof(struct mt352_config));
544 memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
545 552
546 /* check if the demod is there */ 553 /* check if the demod is there */
547 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error; 554 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error;
548 555
549 /* create dvb_frontend */ 556 /* create dvb_frontend */
550 state->frontend.ops = &state->ops; 557 memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
551 state->frontend.demodulator_priv = state; 558 state->frontend.demodulator_priv = state;
552 return &state->frontend; 559 return &state->frontend;
553 560