aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/nxt200x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/nxt200x.c')
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 9e3535394509..55671cb5255e 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -55,7 +55,6 @@
55struct nxt200x_state { 55struct nxt200x_state {
56 56
57 struct i2c_adapter* i2c; 57 struct i2c_adapter* i2c;
58 struct dvb_frontend_ops ops;
59 const struct nxt200x_config* config; 58 const struct nxt200x_config* config;
60 struct dvb_frontend frontend; 59 struct dvb_frontend frontend;
61 60
@@ -333,17 +332,17 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
333 332
334 dprintk("%s\n", __FUNCTION__); 333 dprintk("%s\n", __FUNCTION__);
335 334
336 dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]); 335 dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[1], data[2], data[3], data[4]);
337 336
338 /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip. 337 /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip.
339 * direct write is required for Philips TUV1236D and ALPS TDHU2 */ 338 * direct write is required for Philips TUV1236D and ALPS TDHU2 */
340 switch (state->demod_chip) { 339 switch (state->demod_chip) {
341 case NXT2004: 340 case NXT2004:
342 if (i2c_writebytes(state, state->config->pll_address, data, 4)) 341 if (i2c_writebytes(state, data[0], data+1, 4))
343 printk(KERN_WARNING "nxt200x: error writing to tuner\n"); 342 printk(KERN_WARNING "nxt200x: error writing to tuner\n");
344 /* wait until we have a lock */ 343 /* wait until we have a lock */
345 while (count < 20) { 344 while (count < 20) {
346 i2c_readbytes(state, state->config->pll_address, &buf, 1); 345 i2c_readbytes(state, data[0], &buf, 1);
347 if (buf & 0x40) 346 if (buf & 0x40)
348 return 0; 347 return 0;
349 msleep(100); 348 msleep(100);
@@ -361,10 +360,10 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
361 nxt200x_writebytes(state, 0x34, &buf, 1); 360 nxt200x_writebytes(state, 0x34, &buf, 1);
362 361
363 /* write actual tuner bytes */ 362 /* write actual tuner bytes */
364 nxt200x_writebytes(state, 0x36, data, 4); 363 nxt200x_writebytes(state, 0x36, data+1, 4);
365 364
366 /* set tuner i2c address */ 365 /* set tuner i2c address */
367 buf = state->config->pll_address; 366 buf = data[0] << 1;
368 nxt200x_writebytes(state, 0x35, &buf, 1); 367 nxt200x_writebytes(state, 0x35, &buf, 1);
369 368
370 /* write UC Opmode to begin transfer */ 369 /* write UC Opmode to begin transfer */
@@ -534,7 +533,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
534 struct dvb_frontend_parameters *p) 533 struct dvb_frontend_parameters *p)
535{ 534{
536 struct nxt200x_state* state = fe->demodulator_priv; 535 struct nxt200x_state* state = fe->demodulator_priv;
537 u8 buf[4]; 536 u8 buf[5];
538 537
539 /* stop the micro first */ 538 /* stop the micro first */
540 nxt200x_microcontroller_stop(state); 539 nxt200x_microcontroller_stop(state);
@@ -548,7 +547,9 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
548 } 547 }
549 548
550 /* get tuning information */ 549 /* get tuning information */
551 dvb_pll_configure(state->config->pll_desc, buf, p->frequency, 0); 550 if (fe->ops.tuner_ops.calc_regs) {
551 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
552 }
552 553
553 /* set additional params */ 554 /* set additional params */
554 switch (p->u.vsb.modulation) { 555 switch (p->u.vsb.modulation) {
@@ -1159,7 +1160,6 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
1159 /* setup the state */ 1160 /* setup the state */
1160 state->config = config; 1161 state->config = config;
1161 state->i2c = i2c; 1162 state->i2c = i2c;
1162 memcpy(&state->ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops));
1163 state->initialised = 0; 1163 state->initialised = 0;
1164 1164
1165 /* read card id */ 1165 /* read card id */
@@ -1198,7 +1198,7 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
1198 } 1198 }
1199 1199
1200 /* create dvb_frontend */ 1200 /* create dvb_frontend */
1201 state->frontend.ops = &state->ops; 1201 memcpy(&state->frontend.ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops));
1202 state->frontend.demodulator_priv = state; 1202 state->frontend.demodulator_priv = state;
1203 return &state->frontend; 1203 return &state->frontend;
1204 1204