diff options
Diffstat (limited to 'drivers/media/dvb/frontends/mt352.c')
-rw-r--r-- | drivers/media/dvb/frontends/mt352.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index 50326c7248fa..d32dc4de9e7f 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -46,7 +46,7 @@ struct mt352_state { | |||
46 | struct dvb_frontend_ops ops; | 46 | struct dvb_frontend_ops ops; |
47 | 47 | ||
48 | /* configuration settings */ | 48 | /* configuration settings */ |
49 | const struct mt352_config* config; | 49 | struct mt352_config config; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int debug; | 52 | static int debug; |
@@ -59,7 +59,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val) | |||
59 | { | 59 | { |
60 | struct mt352_state* state = fe->demodulator_priv; | 60 | struct mt352_state* state = fe->demodulator_priv; |
61 | u8 buf[2] = { reg, val }; | 61 | u8 buf[2] = { reg, val }; |
62 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, | 62 | struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0, |
63 | .buf = buf, .len = 2 }; | 63 | .buf = buf, .len = 2 }; |
64 | int err = i2c_transfer(state->i2c, &msg, 1); | 64 | int err = i2c_transfer(state->i2c, &msg, 1); |
65 | if (err != 1) { | 65 | if (err != 1) { |
@@ -84,10 +84,10 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) | |||
84 | int ret; | 84 | int ret; |
85 | u8 b0 [] = { reg }; | 85 | u8 b0 [] = { reg }; |
86 | u8 b1 [] = { 0 }; | 86 | u8 b1 [] = { 0 }; |
87 | struct i2c_msg msg [] = { { .addr = state->config->demod_address, | 87 | struct i2c_msg msg [] = { { .addr = state->config.demod_address, |
88 | .flags = 0, | 88 | .flags = 0, |
89 | .buf = b0, .len = 1 }, | 89 | .buf = b0, .len = 1 }, |
90 | { .addr = state->config->demod_address, | 90 | { .addr = state->config.demod_address, |
91 | .flags = I2C_M_RD, | 91 | .flags = I2C_M_RD, |
92 | .buf = b1, .len = 1 } }; | 92 | .buf = b1, .len = 1 } }; |
93 | 93 | ||
@@ -102,11 +102,6 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) | |||
102 | return b1[0]; | 102 | return b1[0]; |
103 | } | 103 | } |
104 | 104 | ||
105 | int mt352_read(struct dvb_frontend *fe, u8 reg) | ||
106 | { | ||
107 | return mt352_read_register(fe->demodulator_priv,reg); | ||
108 | } | ||
109 | |||
110 | static int mt352_sleep(struct dvb_frontend* fe) | 105 | static int mt352_sleep(struct dvb_frontend* fe) |
111 | { | 106 | { |
112 | static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; | 107 | static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; |
@@ -134,8 +129,8 @@ static void mt352_calc_nominal_rate(struct mt352_state* state, | |||
134 | bw = 8; | 129 | bw = 8; |
135 | break; | 130 | break; |
136 | } | 131 | } |
137 | if (state->config->adc_clock) | 132 | if (state->config.adc_clock) |
138 | adc_clock = state->config->adc_clock; | 133 | adc_clock = state->config.adc_clock; |
139 | 134 | ||
140 | value = 64 * bw * (1<<16) / (7 * 8); | 135 | value = 64 * bw * (1<<16) / (7 * 8); |
141 | value = value * 1000 / adc_clock; | 136 | value = value * 1000 / adc_clock; |
@@ -152,10 +147,10 @@ static void mt352_calc_input_freq(struct mt352_state* state, | |||
152 | int if2 = 36167; /* 36.166667 MHz */ | 147 | int if2 = 36167; /* 36.166667 MHz */ |
153 | int ife,value; | 148 | int ife,value; |
154 | 149 | ||
155 | if (state->config->adc_clock) | 150 | if (state->config.adc_clock) |
156 | adc_clock = state->config->adc_clock; | 151 | adc_clock = state->config.adc_clock; |
157 | if (state->config->if2) | 152 | if (state->config.if2) |
158 | if2 = state->config->if2; | 153 | if2 = state->config.if2; |
159 | 154 | ||
160 | ife = (2*adc_clock - if2); | 155 | ife = (2*adc_clock - if2); |
161 | value = -16374 * ife / adc_clock; | 156 | value = -16374 * ife / adc_clock; |
@@ -289,10 +284,10 @@ static int mt352_set_parameters(struct dvb_frontend* fe, | |||
289 | 284 | ||
290 | mt352_calc_nominal_rate(state, op->bandwidth, buf+4); | 285 | mt352_calc_nominal_rate(state, op->bandwidth, buf+4); |
291 | mt352_calc_input_freq(state, buf+6); | 286 | mt352_calc_input_freq(state, buf+6); |
292 | state->config->pll_set(fe, param, buf+8); | 287 | state->config.pll_set(fe, param, buf+8); |
293 | 288 | ||
294 | mt352_write(fe, buf, sizeof(buf)); | 289 | mt352_write(fe, buf, sizeof(buf)); |
295 | if (state->config->no_tuner) { | 290 | if (state->config.no_tuner) { |
296 | /* start decoding */ | 291 | /* start decoding */ |
297 | mt352_write(fe, fsm_go, 2); | 292 | mt352_write(fe, fsm_go, 2); |
298 | } else { | 293 | } else { |
@@ -516,7 +511,7 @@ static int mt352_init(struct dvb_frontend* fe) | |||
516 | 511 | ||
517 | /* Do a "hard" reset */ | 512 | /* Do a "hard" reset */ |
518 | mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); | 513 | mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); |
519 | return state->config->demod_init(fe); | 514 | return state->config.demod_init(fe); |
520 | } | 515 | } |
521 | 516 | ||
522 | return 0; | 517 | return 0; |
@@ -541,8 +536,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, | |||
541 | memset(state,0,sizeof(*state)); | 536 | memset(state,0,sizeof(*state)); |
542 | 537 | ||
543 | /* setup the state */ | 538 | /* setup the state */ |
544 | state->config = config; | ||
545 | state->i2c = i2c; | 539 | state->i2c = i2c; |
540 | memcpy(&state->config,config,sizeof(struct mt352_config)); | ||
546 | memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); | 541 | memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops)); |
547 | 542 | ||
548 | /* check if the demod is there */ | 543 | /* check if the demod is there */ |
@@ -601,10 +596,3 @@ MODULE_LICENSE("GPL"); | |||
601 | 596 | ||
602 | EXPORT_SYMBOL(mt352_attach); | 597 | EXPORT_SYMBOL(mt352_attach); |
603 | EXPORT_SYMBOL(mt352_write); | 598 | EXPORT_SYMBOL(mt352_write); |
604 | EXPORT_SYMBOL(mt352_read); | ||
605 | /* | ||
606 | * Local variables: | ||
607 | * c-basic-offset: 8 | ||
608 | * compile-command: "make DVB=1" | ||
609 | * End: | ||
610 | */ | ||