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:53 -0400 |
commit | 638a3fba39748b63bdfa391bd65144e487a02e3c (patch) | |
tree | f9c4c5da4736074dff8cce10acc00c21469429a4 | |
parent | 44d92aa7817efa8f9f80f3bde2279221890a4cd2 (diff) |
V4L/DVB (3866): Convert nxt200x to refactored tuner code
Convert to tuner_ops calls.
Remove pll function pointers from structure.
Remove unneeded tuner calls.
Standardise the calls used to retrieve tuner data.
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/nxt200x.c | 16 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/nxt200x.h | 4 |
2 files changed, 9 insertions, 11 deletions
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 9e3535394509..809ffd40fce8 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
@@ -333,17 +333,17 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) | |||
333 | 333 | ||
334 | dprintk("%s\n", __FUNCTION__); | 334 | dprintk("%s\n", __FUNCTION__); |
335 | 335 | ||
336 | dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]); | 336 | dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[1], data[2], data[3], data[4]); |
337 | 337 | ||
338 | /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip. | 338 | /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip. |
339 | * direct write is required for Philips TUV1236D and ALPS TDHU2 */ | 339 | * direct write is required for Philips TUV1236D and ALPS TDHU2 */ |
340 | switch (state->demod_chip) { | 340 | switch (state->demod_chip) { |
341 | case NXT2004: | 341 | case NXT2004: |
342 | if (i2c_writebytes(state, state->config->pll_address, data, 4)) | 342 | if (i2c_writebytes(state, data[0], data+1, 4)) |
343 | printk(KERN_WARNING "nxt200x: error writing to tuner\n"); | 343 | printk(KERN_WARNING "nxt200x: error writing to tuner\n"); |
344 | /* wait until we have a lock */ | 344 | /* wait until we have a lock */ |
345 | while (count < 20) { | 345 | while (count < 20) { |
346 | i2c_readbytes(state, state->config->pll_address, &buf, 1); | 346 | i2c_readbytes(state, data[0], &buf, 1); |
347 | if (buf & 0x40) | 347 | if (buf & 0x40) |
348 | return 0; | 348 | return 0; |
349 | msleep(100); | 349 | msleep(100); |
@@ -361,10 +361,10 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) | |||
361 | nxt200x_writebytes(state, 0x34, &buf, 1); | 361 | nxt200x_writebytes(state, 0x34, &buf, 1); |
362 | 362 | ||
363 | /* write actual tuner bytes */ | 363 | /* write actual tuner bytes */ |
364 | nxt200x_writebytes(state, 0x36, data, 4); | 364 | nxt200x_writebytes(state, 0x36, data+1, 4); |
365 | 365 | ||
366 | /* set tuner i2c address */ | 366 | /* set tuner i2c address */ |
367 | buf = state->config->pll_address; | 367 | buf = data[0] << 1; |
368 | nxt200x_writebytes(state, 0x35, &buf, 1); | 368 | nxt200x_writebytes(state, 0x35, &buf, 1); |
369 | 369 | ||
370 | /* write UC Opmode to begin transfer */ | 370 | /* write UC Opmode to begin transfer */ |
@@ -534,7 +534,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
534 | struct dvb_frontend_parameters *p) | 534 | struct dvb_frontend_parameters *p) |
535 | { | 535 | { |
536 | struct nxt200x_state* state = fe->demodulator_priv; | 536 | struct nxt200x_state* state = fe->demodulator_priv; |
537 | u8 buf[4]; | 537 | u8 buf[5]; |
538 | 538 | ||
539 | /* stop the micro first */ | 539 | /* stop the micro first */ |
540 | nxt200x_microcontroller_stop(state); | 540 | nxt200x_microcontroller_stop(state); |
@@ -548,7 +548,9 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
548 | } | 548 | } |
549 | 549 | ||
550 | /* get tuning information */ | 550 | /* get tuning information */ |
551 | dvb_pll_configure(state->config->pll_desc, buf, p->frequency, 0); | 551 | if (fe->ops->tuner_ops.pllbuf) { |
552 | fe->ops->tuner_ops.pllbuf(fe, p, buf, 5); | ||
553 | } | ||
552 | 554 | ||
553 | /* set additional params */ | 555 | /* set additional params */ |
554 | switch (p->u.vsb.modulation) { | 556 | switch (p->u.vsb.modulation) { |
diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h index 1d9d70bc37ef..34d61735845b 100644 --- a/drivers/media/dvb/frontends/nxt200x.h +++ b/drivers/media/dvb/frontends/nxt200x.h | |||
@@ -38,10 +38,6 @@ struct nxt200x_config | |||
38 | /* the demodulator's i2c address */ | 38 | /* the demodulator's i2c address */ |
39 | u8 demod_address; | 39 | u8 demod_address; |
40 | 40 | ||
41 | /* tuner information */ | ||
42 | u8 pll_address; | ||
43 | struct dvb_pll_desc *pll_desc; | ||
44 | |||
45 | /* used to set pll input */ | 41 | /* used to set pll input */ |
46 | int (*set_pll_input)(u8* buf, int input); | 42 | int (*set_pll_input)(u8* buf, int input); |
47 | 43 | ||