diff options
Diffstat (limited to 'drivers/media/dvb/frontends/zl10353.c')
-rw-r--r-- | drivers/media/dvb/frontends/zl10353.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index d7d9f59d76d2..2b95e8b6cd39 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c | |||
@@ -34,7 +34,6 @@ | |||
34 | struct zl10353_state { | 34 | struct zl10353_state { |
35 | struct i2c_adapter *i2c; | 35 | struct i2c_adapter *i2c; |
36 | struct dvb_frontend frontend; | 36 | struct dvb_frontend frontend; |
37 | struct dvb_frontend_ops ops; | ||
38 | 37 | ||
39 | struct zl10353_config config; | 38 | struct zl10353_config config; |
40 | }; | 39 | }; |
@@ -126,6 +125,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, | |||
126 | struct dvb_frontend_parameters *param) | 125 | struct dvb_frontend_parameters *param) |
127 | { | 126 | { |
128 | struct zl10353_state *state = fe->demodulator_priv; | 127 | struct zl10353_state *state = fe->demodulator_priv; |
128 | |||
129 | u8 pllbuf[6] = { 0x67 }; | 129 | u8 pllbuf[6] = { 0x67 }; |
130 | 130 | ||
131 | /* These settings set "auto-everything" and start the FSM. */ | 131 | /* These settings set "auto-everything" and start the FSM. */ |
@@ -142,7 +142,30 @@ static int zl10353_set_parameters(struct dvb_frontend *fe, | |||
142 | zl10353_single_write(fe, 0x66, 0xE9); | 142 | zl10353_single_write(fe, 0x66, 0xE9); |
143 | zl10353_single_write(fe, 0x62, 0x0A); | 143 | zl10353_single_write(fe, 0x62, 0x0A); |
144 | 144 | ||
145 | state->config.pll_set(fe, param, pllbuf + 1); | 145 | // if there is no attached secondary tuner, we call set_params to program |
146 | // a potential tuner attached somewhere else | ||
147 | if (state->config.no_tuner) { | ||
148 | if (fe->ops.tuner_ops.set_params) { | ||
149 | fe->ops.tuner_ops.set_params(fe, param); | ||
150 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | // if pllbuf is defined, retrieve the settings | ||
155 | if (fe->ops.tuner_ops.calc_regs) { | ||
156 | fe->ops.tuner_ops.calc_regs(fe, param, pllbuf+1, 5); | ||
157 | pllbuf[1] <<= 1; | ||
158 | } else { | ||
159 | // fake pllbuf settings | ||
160 | pllbuf[1] = 0x61 << 1; | ||
161 | pllbuf[2] = 0; | ||
162 | pllbuf[3] = 0; | ||
163 | pllbuf[3] = 0; | ||
164 | pllbuf[4] = 0; | ||
165 | } | ||
166 | |||
167 | // there is no call to _just_ start decoding, so we send the pllbuf anyway | ||
168 | // even if there isn't a PLL attached to the secondary bus | ||
146 | zl10353_write(fe, pllbuf, sizeof(pllbuf)); | 169 | zl10353_write(fe, pllbuf, sizeof(pllbuf)); |
147 | 170 | ||
148 | zl10353_single_write(fe, 0x70, 0x01); | 171 | zl10353_single_write(fe, 0x70, 0x01); |
@@ -254,14 +277,13 @@ struct dvb_frontend *zl10353_attach(const struct zl10353_config *config, | |||
254 | /* setup the state */ | 277 | /* setup the state */ |
255 | state->i2c = i2c; | 278 | state->i2c = i2c; |
256 | memcpy(&state->config, config, sizeof(struct zl10353_config)); | 279 | memcpy(&state->config, config, sizeof(struct zl10353_config)); |
257 | memcpy(&state->ops, &zl10353_ops, sizeof(struct dvb_frontend_ops)); | ||
258 | 280 | ||
259 | /* check if the demod is there */ | 281 | /* check if the demod is there */ |
260 | if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353) | 282 | if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353) |
261 | goto error; | 283 | goto error; |
262 | 284 | ||
263 | /* create dvb_frontend */ | 285 | /* create dvb_frontend */ |
264 | state->frontend.ops = &state->ops; | 286 | memcpy(&state->frontend.ops, &zl10353_ops, sizeof(struct dvb_frontend_ops)); |
265 | state->frontend.demodulator_priv = state; | 287 | state->frontend.demodulator_priv = state; |
266 | 288 | ||
267 | return &state->frontend; | 289 | return &state->frontend; |