diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.c | 42 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.h | 7 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 2 |
3 files changed, 35 insertions, 16 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 78114fc2672..b0785d542f0 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -488,7 +488,8 @@ static int dvb_pll_sleep(struct dvb_frontend *fe) | |||
488 | struct dvb_pll_priv *priv = fe->tuner_priv; | 488 | struct dvb_pll_priv *priv = fe->tuner_priv; |
489 | u8 buf[4]; | 489 | u8 buf[4]; |
490 | struct i2c_msg msg = | 490 | struct i2c_msg msg = |
491 | { .addr = priv->pll_i2c_address, .flags = 0, .buf = buf, .len = sizeof(buf) }; | 491 | { .addr = priv->pll_i2c_address, .flags = 0, |
492 | .buf = buf, .len = sizeof(buf) }; | ||
492 | int i; | 493 | int i; |
493 | int result; | 494 | int result; |
494 | 495 | ||
@@ -516,12 +517,14 @@ static int dvb_pll_sleep(struct dvb_frontend *fe) | |||
516 | return 0; | 517 | return 0; |
517 | } | 518 | } |
518 | 519 | ||
519 | static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 520 | static int dvb_pll_set_params(struct dvb_frontend *fe, |
521 | struct dvb_frontend_parameters *params) | ||
520 | { | 522 | { |
521 | struct dvb_pll_priv *priv = fe->tuner_priv; | 523 | struct dvb_pll_priv *priv = fe->tuner_priv; |
522 | u8 buf[4]; | 524 | u8 buf[4]; |
523 | struct i2c_msg msg = | 525 | struct i2c_msg msg = |
524 | { .addr = priv->pll_i2c_address, .flags = 0, .buf = buf, .len = sizeof(buf) }; | 526 | { .addr = priv->pll_i2c_address, .flags = 0, |
527 | .buf = buf, .len = sizeof(buf) }; | ||
525 | int result; | 528 | int result; |
526 | u32 div; | 529 | u32 div; |
527 | int i; | 530 | int i; |
@@ -535,7 +538,8 @@ static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
535 | bandwidth = params->u.ofdm.bandwidth; | 538 | bandwidth = params->u.ofdm.bandwidth; |
536 | } | 539 | } |
537 | 540 | ||
538 | if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, bandwidth)) != 0) | 541 | if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, |
542 | bandwidth)) != 0) | ||
539 | return result; | 543 | return result; |
540 | 544 | ||
541 | if (fe->ops.i2c_gate_ctrl) | 545 | if (fe->ops.i2c_gate_ctrl) |
@@ -550,14 +554,18 @@ static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
550 | continue; | 554 | continue; |
551 | break; | 555 | break; |
552 | } | 556 | } |
553 | div = (params->frequency + priv->pll_desc->entries[i].offset) / priv->pll_desc->entries[i].stepsize; | 557 | div = (params->frequency + priv->pll_desc->entries[i].offset) / |
554 | priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - priv->pll_desc->entries[i].offset; | 558 | priv->pll_desc->entries[i].stepsize; |
559 | priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - | ||
560 | priv->pll_desc->entries[i].offset; | ||
555 | priv->bandwidth = bandwidth; | 561 | priv->bandwidth = bandwidth; |
556 | 562 | ||
557 | return 0; | 563 | return 0; |
558 | } | 564 | } |
559 | 565 | ||
560 | static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8 *buf, int buf_len) | 566 | static int dvb_pll_calc_regs(struct dvb_frontend *fe, |
567 | struct dvb_frontend_parameters *params, | ||
568 | u8 *buf, int buf_len) | ||
561 | { | 569 | { |
562 | struct dvb_pll_priv *priv = fe->tuner_priv; | 570 | struct dvb_pll_priv *priv = fe->tuner_priv; |
563 | int result; | 571 | int result; |
@@ -573,7 +581,8 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
573 | bandwidth = params->u.ofdm.bandwidth; | 581 | bandwidth = params->u.ofdm.bandwidth; |
574 | } | 582 | } |
575 | 583 | ||
576 | if ((result = dvb_pll_configure(priv->pll_desc, buf+1, params->frequency, bandwidth)) != 0) | 584 | if ((result = dvb_pll_configure(priv->pll_desc, buf+1, |
585 | params->frequency, bandwidth)) != 0) | ||
577 | return result; | 586 | return result; |
578 | buf[0] = priv->pll_i2c_address; | 587 | buf[0] = priv->pll_i2c_address; |
579 | 588 | ||
@@ -583,8 +592,10 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
583 | continue; | 592 | continue; |
584 | break; | 593 | break; |
585 | } | 594 | } |
586 | div = (params->frequency + priv->pll_desc->entries[i].offset) / priv->pll_desc->entries[i].stepsize; | 595 | div = (params->frequency + priv->pll_desc->entries[i].offset) / |
587 | priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - priv->pll_desc->entries[i].offset; | 596 | priv->pll_desc->entries[i].stepsize; |
597 | priv->frequency = (div * priv->pll_desc->entries[i].stepsize) - | ||
598 | priv->pll_desc->entries[i].offset; | ||
588 | priv->bandwidth = bandwidth; | 599 | priv->bandwidth = bandwidth; |
589 | 600 | ||
590 | return 5; | 601 | return 5; |
@@ -613,10 +624,13 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = { | |||
613 | .get_bandwidth = dvb_pll_get_bandwidth, | 624 | .get_bandwidth = dvb_pll_get_bandwidth, |
614 | }; | 625 | }; |
615 | 626 | ||
616 | struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) | 627 | struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, |
628 | struct i2c_adapter *i2c, | ||
629 | struct dvb_pll_desc *desc) | ||
617 | { | 630 | { |
618 | u8 b1 [] = { 0 }; | 631 | u8 b1 [] = { 0 }; |
619 | struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 }; | 632 | struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, |
633 | .buf = b1, .len = 1 }; | ||
620 | struct dvb_pll_priv *priv = NULL; | 634 | struct dvb_pll_priv *priv = NULL; |
621 | int ret; | 635 | int ret; |
622 | 636 | ||
@@ -639,7 +653,9 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struc | |||
639 | priv->i2c = i2c; | 653 | priv->i2c = i2c; |
640 | priv->pll_desc = desc; | 654 | priv->pll_desc = desc; |
641 | 655 | ||
642 | memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops)); | 656 | memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops, |
657 | sizeof(struct dvb_tuner_ops)); | ||
658 | |||
643 | strncpy(fe->ops.tuner_ops.info.name, desc->name, 128); | 659 | strncpy(fe->ops.tuner_ops.info.name, desc->name, 128); |
644 | fe->ops.tuner_ops.info.frequency_min = desc->min; | 660 | fe->ops.tuner_ops.info.frequency_min = desc->min; |
645 | fe->ops.tuner_ops.info.frequency_min = desc->max; | 661 | fe->ops.tuner_ops.info.frequency_min = desc->max; |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index ed5ac5a361a..681186a5e5e 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -48,7 +48,7 @@ extern struct dvb_pll_desc dvb_pll_philips_td1316; | |||
48 | extern struct dvb_pll_desc dvb_pll_thomson_fe6600; | 48 | extern struct dvb_pll_desc dvb_pll_thomson_fe6600; |
49 | 49 | ||
50 | extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 50 | extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
51 | u32 freq, int bandwidth); | 51 | u32 freq, int bandwidth); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Attach a dvb-pll to the supplied frontend structure. | 54 | * Attach a dvb-pll to the supplied frontend structure. |
@@ -59,6 +59,9 @@ extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | |||
59 | * @param desc dvb_pll_desc to use. | 59 | * @param desc dvb_pll_desc to use. |
60 | * @return Frontend pointer on success, NULL on failure | 60 | * @return Frontend pointer on success, NULL on failure |
61 | */ | 61 | */ |
62 | extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc); | 62 | extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, |
63 | int pll_addr, | ||
64 | struct i2c_adapter *i2c, | ||
65 | struct dvb_pll_desc *desc); | ||
63 | 66 | ||
64 | #endif | 67 | #endif |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 461e8d75b63..8bdc90a70c2 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -835,7 +835,7 @@ static int philips_sd1878_tda8261_tuner_set_params(struct dvb_frontend *fe, | |||
835 | return -EINVAL; | 835 | return -EINVAL; |
836 | 836 | ||
837 | rc=dvb_pll_configure(&dvb_pll_philips_sd1878_tda8261, buf, | 837 | rc=dvb_pll_configure(&dvb_pll_philips_sd1878_tda8261, buf, |
838 | params->frequency, 0); | 838 | params->frequency, 0); |
839 | if(rc < 0) return rc; | 839 | if(rc < 0) return rc; |
840 | 840 | ||
841 | if (fe->ops.i2c_gate_ctrl) | 841 | if (fe->ops.i2c_gate_ctrl) |