aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-18 16:47:10 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:58:42 -0400
commite9f9c0d87b1d532b82618bc154246e2dba20934b (patch)
tree295476e0cc4dbe0308a2888ddef4a1de85f492cb
parent085542dc8611d969ef698120c98288e24d5f4f9d (diff)
V4L/DVB (3857): Convert sp8870 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/sp8870.c26
-rw-r--r--drivers/media/dvb/frontends/sp8870.h4
2 files changed, 16 insertions, 14 deletions
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c
index 73829e647e50..4d553c0dabb3 100644
--- a/drivers/media/dvb/frontends/sp8870.c
+++ b/drivers/media/dvb/frontends/sp8870.c
@@ -262,9 +262,10 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe,
262 sp8870_microcontroller_stop(state); 262 sp8870_microcontroller_stop(state);
263 263
264 // set tuner parameters 264 // set tuner parameters
265 sp8870_writereg(state, 0x206, 0x001); 265 if (fe->ops->tuner_ops.set_params) {
266 state->config->pll_set(fe, p); 266 fe->ops->tuner_ops.set_params(fe, p);
267 sp8870_writereg(state, 0x206, 0x000); 267 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
268 }
268 269
269 // sample rate correction bit [23..17] 270 // sample rate correction bit [23..17]
270 sp8870_writereg(state, 0x0319, 0x000A); 271 sp8870_writereg(state, 0x0319, 0x000A);
@@ -349,13 +350,6 @@ static int sp8870_init (struct dvb_frontend* fe)
349 sp8870_writereg(state, 0x0D00, 0x010); 350 sp8870_writereg(state, 0x0D00, 0x010);
350 sp8870_writereg(state, 0x0D01, 0x000); 351 sp8870_writereg(state, 0x0D01, 0x000);
351 352
352 /* setup PLL */
353 if (state->config->pll_init) {
354 sp8870_writereg(state, 0x206, 0x001);
355 state->config->pll_init(fe);
356 sp8870_writereg(state, 0x206, 0x000);
357 }
358
359 return 0; 353 return 0;
360} 354}
361 355
@@ -541,6 +535,17 @@ static int sp8870_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend
541 return 0; 535 return 0;
542} 536}
543 537
538static int sp8870_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
539{
540 struct sp8870_state* state = fe->demodulator_priv;
541
542 if (enable) {
543 return sp8870_writereg(state, 0x206, 0x001);
544 } else {
545 return sp8870_writereg(state, 0x206, 0x000);
546 }
547}
548
544static void sp8870_release(struct dvb_frontend* fe) 549static void sp8870_release(struct dvb_frontend* fe)
545{ 550{
546 struct sp8870_state* state = fe->demodulator_priv; 551 struct sp8870_state* state = fe->demodulator_priv;
@@ -597,6 +602,7 @@ static struct dvb_frontend_ops sp8870_ops = {
597 602
598 .init = sp8870_init, 603 .init = sp8870_init,
599 .sleep = sp8870_sleep, 604 .sleep = sp8870_sleep,
605 .i2c_gate_ctrl = sp8870_i2c_gate_ctrl,
600 606
601 .set_frontend = sp8870_set_frontend, 607 .set_frontend = sp8870_set_frontend,
602 .get_tune_settings = sp8870_get_tune_settings, 608 .get_tune_settings = sp8870_get_tune_settings,
diff --git a/drivers/media/dvb/frontends/sp8870.h b/drivers/media/dvb/frontends/sp8870.h
index f3b555dbc960..93afbb969d6b 100644
--- a/drivers/media/dvb/frontends/sp8870.h
+++ b/drivers/media/dvb/frontends/sp8870.h
@@ -31,10 +31,6 @@ struct sp8870_config
31 /* the demodulator's i2c address */ 31 /* the demodulator's i2c address */
32 u8 demod_address; 32 u8 demod_address;
33 33
34 /* PLL maintenance */
35 int (*pll_init)(struct dvb_frontend* fe);
36 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
37
38 /* request firmware for device */ 34 /* request firmware for device */
39 int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); 35 int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
40}; 36};