aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/lgdt330x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/lgdt330x.c')
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index 4691ac54bc1d..6e8ad176e1a1 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -29,6 +29,7 @@
29 * DViCO FusionHDTV 5 Lite 29 * DViCO FusionHDTV 5 Lite
30 * DViCO FusionHDTV 5 USB Gold 30 * DViCO FusionHDTV 5 USB Gold
31 * Air2PC/AirStar 2 ATSC 3rd generation (HD5000) 31 * Air2PC/AirStar 2 ATSC 3rd generation (HD5000)
32 * pcHDTV HD5500
32 * 33 *
33 * TODO: 34 * TODO:
34 * signal strength always returns 0. 35 * signal strength always returns 0.
@@ -59,7 +60,6 @@ if (debug) printk(KERN_DEBUG "lgdt330x: " args); \
59struct lgdt330x_state 60struct lgdt330x_state
60{ 61{
61 struct i2c_adapter* i2c; 62 struct i2c_adapter* i2c;
62 struct dvb_frontend_ops ops;
63 63
64 /* Configuration settings */ 64 /* Configuration settings */
65 const struct lgdt330x_config* config; 65 const struct lgdt330x_config* config;
@@ -399,8 +399,10 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
399 } 399 }
400 400
401 /* Tune to the specified frequency */ 401 /* Tune to the specified frequency */
402 if (state->config->pll_set) 402 if (fe->ops.tuner_ops.set_params) {
403 state->config->pll_set(fe, param); 403 fe->ops.tuner_ops.set_params(fe, param);
404 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
405 }
404 406
405 /* Keep track of the new frequency */ 407 /* Keep track of the new frequency */
406 /* FIXME this is the wrong way to do this... */ 408 /* FIXME this is the wrong way to do this... */
@@ -672,6 +674,7 @@ static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr)
672 674
673 if (state->current_modulation == VSB_8) { 675 if (state->current_modulation == VSB_8) {
674 676
677 i2c_read_demod_bytes(state, 0x6e, buf, 5);
675 /* Phase Tracker Mean-Square Error Register for VSB */ 678 /* Phase Tracker Mean-Square Error Register for VSB */
676 noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4]; 679 noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4];
677 } else { 680 } else {
@@ -721,16 +724,19 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
721 /* Setup the state */ 724 /* Setup the state */
722 state->config = config; 725 state->config = config;
723 state->i2c = i2c; 726 state->i2c = i2c;
727
728 /* Create dvb_frontend */
724 switch (config->demod_chip) { 729 switch (config->demod_chip) {
725 case LGDT3302: 730 case LGDT3302:
726 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); 731 memcpy(&state->frontend.ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
727 break; 732 break;
728 case LGDT3303: 733 case LGDT3303:
729 memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); 734 memcpy(&state->frontend.ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops));
730 break; 735 break;
731 default: 736 default:
732 goto error; 737 goto error;
733 } 738 }
739 state->frontend.demodulator_priv = state;
734 740
735 /* Verify communication with demod chip */ 741 /* Verify communication with demod chip */
736 if (i2c_read_demod_bytes(state, 2, buf, 1)) 742 if (i2c_read_demod_bytes(state, 2, buf, 1))
@@ -739,9 +745,6 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
739 state->current_frequency = -1; 745 state->current_frequency = -1;
740 state->current_modulation = -1; 746 state->current_modulation = -1;
741 747
742 /* Create dvb_frontend */
743 state->frontend.ops = &state->ops;
744 state->frontend.demodulator_priv = state;
745 return &state->frontend; 748 return &state->frontend;
746 749
747error: 750error: