diff options
Diffstat (limited to 'drivers/media/dvb/frontends/nxt6000.c')
-rw-r--r-- | drivers/media/dvb/frontends/nxt6000.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index a16eeba0020..d313d7dcf38 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | struct nxt6000_state { | 34 | struct nxt6000_state { |
35 | struct i2c_adapter* i2c; | 35 | struct i2c_adapter* i2c; |
36 | struct dvb_frontend_ops ops; | ||
37 | /* configuration settings */ | 36 | /* configuration settings */ |
38 | const struct nxt6000_config* config; | 37 | const struct nxt6000_config* config; |
39 | struct dvb_frontend frontend; | 38 | struct dvb_frontend frontend; |
@@ -207,12 +206,6 @@ static void nxt6000_setup(struct dvb_frontend* fe) | |||
207 | nxt6000_writereg(state, SUB_DIAG_MODE_SEL, 0); | 206 | nxt6000_writereg(state, SUB_DIAG_MODE_SEL, 0); |
208 | 207 | ||
209 | nxt6000_writereg(state, TS_FORMAT, 0); | 208 | nxt6000_writereg(state, TS_FORMAT, 0); |
210 | |||
211 | if (state->config->pll_init) { | ||
212 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ | ||
213 | state->config->pll_init(fe); | ||
214 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); /* close i2c bus switch */ | ||
215 | } | ||
216 | } | 209 | } |
217 | 210 | ||
218 | static void nxt6000_dump_status(struct nxt6000_state *state) | 211 | static void nxt6000_dump_status(struct nxt6000_state *state) |
@@ -469,9 +462,10 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
469 | struct nxt6000_state* state = fe->demodulator_priv; | 462 | struct nxt6000_state* state = fe->demodulator_priv; |
470 | int result; | 463 | int result; |
471 | 464 | ||
472 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); /* open i2c bus switch */ | 465 | if (fe->ops.tuner_ops.set_params) { |
473 | state->config->pll_set(fe, param); | 466 | fe->ops.tuner_ops.set_params(fe, param); |
474 | nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); /* close i2c bus switch */ | 467 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
468 | } | ||
475 | 469 | ||
476 | if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) | 470 | if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) |
477 | return result; | 471 | return result; |
@@ -532,6 +526,17 @@ static int nxt6000_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_fron | |||
532 | return 0; | 526 | return 0; |
533 | } | 527 | } |
534 | 528 | ||
529 | static int nxt6000_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
530 | { | ||
531 | struct nxt6000_state* state = fe->demodulator_priv; | ||
532 | |||
533 | if (enable) { | ||
534 | return nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x01); | ||
535 | } else { | ||
536 | return nxt6000_writereg(state, ENABLE_TUNER_IIC, 0x00); | ||
537 | } | ||
538 | } | ||
539 | |||
535 | static struct dvb_frontend_ops nxt6000_ops; | 540 | static struct dvb_frontend_ops nxt6000_ops; |
536 | 541 | ||
537 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | 542 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, |
@@ -546,13 +551,12 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
546 | /* setup the state */ | 551 | /* setup the state */ |
547 | state->config = config; | 552 | state->config = config; |
548 | state->i2c = i2c; | 553 | state->i2c = i2c; |
549 | memcpy(&state->ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); | ||
550 | 554 | ||
551 | /* check if the demod is there */ | 555 | /* check if the demod is there */ |
552 | if (nxt6000_readreg(state, OFDM_MSC_REV) != NXT6000ASICDEVICE) goto error; | 556 | if (nxt6000_readreg(state, OFDM_MSC_REV) != NXT6000ASICDEVICE) goto error; |
553 | 557 | ||
554 | /* create dvb_frontend */ | 558 | /* create dvb_frontend */ |
555 | state->frontend.ops = &state->ops; | 559 | memcpy(&state->frontend.ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); |
556 | state->frontend.demodulator_priv = state; | 560 | state->frontend.demodulator_priv = state; |
557 | return &state->frontend; | 561 | return &state->frontend; |
558 | 562 | ||
@@ -584,6 +588,7 @@ static struct dvb_frontend_ops nxt6000_ops = { | |||
584 | .release = nxt6000_release, | 588 | .release = nxt6000_release, |
585 | 589 | ||
586 | .init = nxt6000_init, | 590 | .init = nxt6000_init, |
591 | .i2c_gate_ctrl = nxt6000_i2c_gate_ctrl, | ||
587 | 592 | ||
588 | .get_tune_settings = nxt6000_fe_get_tune_settings, | 593 | .get_tune_settings = nxt6000_fe_get_tune_settings, |
589 | 594 | ||