diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:58:41 -0400 |
commit | 085542dc8611d969ef698120c98288e24d5f4f9d (patch) | |
tree | 6bb447fb9bc4e7c6b1f08cd6f4070d164bdf3b0a | |
parent | 53a8ee3e903659482e009481ab51d6a6572e6a57 (diff) |
V4L/DVB (3856): Convert sp887x to refactored tuner code
Convert to tuner_ops calls.
Remove pll function pointers from structure.
Remove unneeded tuner calls.
Add i2c gate control function.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/frontends/sp887x.c | 34 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/sp887x.h | 6 |
2 files changed, 22 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index eb8a602198ca..543dfa145090 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -208,15 +208,6 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware | |||
208 | /* bit 0x010: enable data valid signal */ | 208 | /* bit 0x010: enable data valid signal */ |
209 | sp887x_writereg(state, 0xd00, 0x010); | 209 | sp887x_writereg(state, 0xd00, 0x010); |
210 | sp887x_writereg(state, 0x0d1, 0x000); | 210 | sp887x_writereg(state, 0x0d1, 0x000); |
211 | |||
212 | /* setup the PLL */ | ||
213 | if (state->config->pll_init) { | ||
214 | sp887x_writereg(state, 0x206, 0x001); | ||
215 | state->config->pll_init(fe); | ||
216 | sp887x_writereg(state, 0x206, 0x000); | ||
217 | } | ||
218 | |||
219 | printk ("done.\n"); | ||
220 | return 0; | 211 | return 0; |
221 | }; | 212 | }; |
222 | 213 | ||
@@ -362,9 +353,16 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
362 | sp887x_microcontroller_stop(state); | 353 | sp887x_microcontroller_stop(state); |
363 | 354 | ||
364 | /* setup the PLL */ | 355 | /* setup the PLL */ |
365 | sp887x_writereg(state, 0x206, 0x001); | 356 | if (fe->ops->tuner_ops.set_params) { |
366 | actual_freq = state->config->pll_set(fe, p); | 357 | fe->ops->tuner_ops.set_params(fe, p); |
367 | sp887x_writereg(state, 0x206, 0x000); | 358 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); |
359 | } | ||
360 | if (fe->ops->tuner_ops.get_frequency) { | ||
361 | fe->ops->tuner_ops.get_frequency(fe, &actual_freq); | ||
362 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | ||
363 | } else { | ||
364 | actual_freq = p->frequency; | ||
365 | } | ||
368 | 366 | ||
369 | /* read status reg in order to clear <pending irqs */ | 367 | /* read status reg in order to clear <pending irqs */ |
370 | sp887x_readreg(state, 0x200); | 368 | sp887x_readreg(state, 0x200); |
@@ -486,6 +484,17 @@ static int sp887x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
486 | return 0; | 484 | return 0; |
487 | } | 485 | } |
488 | 486 | ||
487 | static int sp887x_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
488 | { | ||
489 | struct sp887x_state* state = fe->demodulator_priv; | ||
490 | |||
491 | if (enable) { | ||
492 | return sp887x_writereg(state, 0x206, 0x001); | ||
493 | } else { | ||
494 | return sp887x_writereg(state, 0x206, 0x000); | ||
495 | } | ||
496 | } | ||
497 | |||
489 | static int sp887x_sleep(struct dvb_frontend* fe) | 498 | static int sp887x_sleep(struct dvb_frontend* fe) |
490 | { | 499 | { |
491 | struct sp887x_state* state = fe->demodulator_priv; | 500 | struct sp887x_state* state = fe->demodulator_priv; |
@@ -589,6 +598,7 @@ static struct dvb_frontend_ops sp887x_ops = { | |||
589 | 598 | ||
590 | .init = sp887x_init, | 599 | .init = sp887x_init, |
591 | .sleep = sp887x_sleep, | 600 | .sleep = sp887x_sleep, |
601 | .i2c_gate_ctrl = sp887x_i2c_gate_ctrl, | ||
592 | 602 | ||
593 | .set_frontend = sp887x_setup_frontend_parameters, | 603 | .set_frontend = sp887x_setup_frontend_parameters, |
594 | .get_tune_settings = sp887x_get_tune_settings, | 604 | .get_tune_settings = sp887x_get_tune_settings, |
diff --git a/drivers/media/dvb/frontends/sp887x.h b/drivers/media/dvb/frontends/sp887x.h index 6a05d8f8e8cc..c44b0ebdf1e2 100644 --- a/drivers/media/dvb/frontends/sp887x.h +++ b/drivers/media/dvb/frontends/sp887x.h | |||
@@ -13,12 +13,6 @@ struct sp887x_config | |||
13 | /* the demodulator's i2c address */ | 13 | /* the demodulator's i2c address */ |
14 | u8 demod_address; | 14 | u8 demod_address; |
15 | 15 | ||
16 | /* PLL maintenance */ | ||
17 | int (*pll_init)(struct dvb_frontend* fe); | ||
18 | |||
19 | /* this should return the actual frequency tuned to */ | ||
20 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
21 | |||
22 | /* request firmware for device */ | 16 | /* request firmware for device */ |
23 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | 17 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); |
24 | }; | 18 | }; |