aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/mt312.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-26 11:50:05 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 06:36:16 -0500
commit827b5f3e30296f5ddeedc0c0359b1db77fd499a6 (patch)
treea17f847d3b33cd92b5f9f540360289c9d8f589fd /drivers/media/dvb/frontends/mt312.c
parent16e3d13152797fc2ae66b948cd3229e9551896c3 (diff)
[media] mt312: convert set_fontend to use DVBv5 parameters
Instead of using dvb_frontend_parameters struct, that were designed for a subset of the supported standards, use the DVBv5 cache information. Also, fill the supported delivery systems at dvb_frontend_ops struct. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/mt312.c')
-rw-r--r--drivers/media/dvb/frontends/mt312.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index 8f5d2d20d12..3e4512aea10 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -531,9 +531,9 @@ static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc)
531 return 0; 531 return 0;
532} 532}
533 533
534static int mt312_set_frontend(struct dvb_frontend *fe, 534static int mt312_set_frontend(struct dvb_frontend *fe)
535 struct dvb_frontend_parameters *p)
536{ 535{
536 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
537 struct mt312_state *state = fe->demodulator_priv; 537 struct mt312_state *state = fe->demodulator_priv;
538 int ret; 538 int ret;
539 u8 buf[5], config_val; 539 u8 buf[5], config_val;
@@ -553,16 +553,16 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
553 || (p->inversion > INVERSION_ON)) 553 || (p->inversion > INVERSION_ON))
554 return -EINVAL; 554 return -EINVAL;
555 555
556 if ((p->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min) 556 if ((p->symbol_rate < fe->ops.info.symbol_rate_min)
557 || (p->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max)) 557 || (p->symbol_rate > fe->ops.info.symbol_rate_max))
558 return -EINVAL; 558 return -EINVAL;
559 559
560 if ((p->u.qpsk.fec_inner < FEC_NONE) 560 if ((p->fec_inner < FEC_NONE)
561 || (p->u.qpsk.fec_inner > FEC_AUTO)) 561 || (p->fec_inner > FEC_AUTO))
562 return -EINVAL; 562 return -EINVAL;
563 563
564 if ((p->u.qpsk.fec_inner == FEC_4_5) 564 if ((p->fec_inner == FEC_4_5)
565 || (p->u.qpsk.fec_inner == FEC_8_9)) 565 || (p->fec_inner == FEC_8_9))
566 return -EINVAL; 566 return -EINVAL;
567 567
568 switch (state->id) { 568 switch (state->id) {
@@ -574,7 +574,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
574 ret = mt312_readreg(state, CONFIG, &config_val); 574 ret = mt312_readreg(state, CONFIG, &config_val);
575 if (ret < 0) 575 if (ret < 0)
576 return ret; 576 return ret;
577 if (p->u.qpsk.symbol_rate >= 30000000) { 577 if (p->symbol_rate >= 30000000) {
578 /* Note that 30MS/s should use 90MHz */ 578 /* Note that 30MS/s should use 90MHz */
579 if (state->freq_mult == 6) { 579 if (state->freq_mult == 6) {
580 /* We are running 60MHz */ 580 /* We are running 60MHz */
@@ -609,19 +609,19 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
609 } 609 }
610 610
611 /* sr = (u16)(sr * 256.0 / 1000000.0) */ 611 /* sr = (u16)(sr * 256.0 / 1000000.0) */
612 sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625); 612 sr = mt312_div(p->symbol_rate * 4, 15625);
613 613
614 /* SYM_RATE */ 614 /* SYM_RATE */
615 buf[0] = (sr >> 8) & 0x3f; 615 buf[0] = (sr >> 8) & 0x3f;
616 buf[1] = (sr >> 0) & 0xff; 616 buf[1] = (sr >> 0) & 0xff;
617 617
618 /* VIT_MODE */ 618 /* VIT_MODE */
619 buf[2] = inv_tab[p->inversion] | fec_tab[p->u.qpsk.fec_inner]; 619 buf[2] = inv_tab[p->inversion] | fec_tab[p->fec_inner];
620 620
621 /* QPSK_CTRL */ 621 /* QPSK_CTRL */
622 buf[3] = 0x40; /* swap I and Q before QPSK demodulation */ 622 buf[3] = 0x40; /* swap I and Q before QPSK demodulation */
623 623
624 if (p->u.qpsk.symbol_rate < 10000000) 624 if (p->symbol_rate < 10000000)
625 buf[3] |= 0x04; /* use afc mode */ 625 buf[3] |= 0x04; /* use afc mode */
626 626
627 /* GO */ 627 /* GO */
@@ -637,7 +637,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
637} 637}
638 638
639static int mt312_get_frontend(struct dvb_frontend *fe, 639static int mt312_get_frontend(struct dvb_frontend *fe,
640 struct dvb_frontend_parameters *p) 640 struct dtv_frontend_properties *p)
641{ 641{
642 struct mt312_state *state = fe->demodulator_priv; 642 struct mt312_state *state = fe->demodulator_priv;
643 int ret; 643 int ret;
@@ -646,11 +646,11 @@ static int mt312_get_frontend(struct dvb_frontend *fe,
646 if (ret < 0) 646 if (ret < 0)
647 return ret; 647 return ret;
648 648
649 ret = mt312_get_symbol_rate(state, &p->u.qpsk.symbol_rate); 649 ret = mt312_get_symbol_rate(state, &p->symbol_rate);
650 if (ret < 0) 650 if (ret < 0)
651 return ret; 651 return ret;
652 652
653 ret = mt312_get_code_rate(state, &p->u.qpsk.fec_inner); 653 ret = mt312_get_code_rate(state, &p->fec_inner);
654 if (ret < 0) 654 if (ret < 0)
655 return ret; 655 return ret;
656 656
@@ -738,7 +738,7 @@ static void mt312_release(struct dvb_frontend *fe)
738 738
739#define MT312_SYS_CLK 90000000UL /* 90 MHz */ 739#define MT312_SYS_CLK 90000000UL /* 90 MHz */
740static struct dvb_frontend_ops mt312_ops = { 740static struct dvb_frontend_ops mt312_ops = {
741 741 .delsys = { SYS_DVBS },
742 .info = { 742 .info = {
743 .name = "Zarlink ???? DVB-S", 743 .name = "Zarlink ???? DVB-S",
744 .type = FE_QPSK, 744 .type = FE_QPSK,
@@ -761,8 +761,8 @@ static struct dvb_frontend_ops mt312_ops = {
761 .sleep = mt312_sleep, 761 .sleep = mt312_sleep,
762 .i2c_gate_ctrl = mt312_i2c_gate_ctrl, 762 .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
763 763
764 .set_frontend_legacy = mt312_set_frontend, 764 .set_frontend = mt312_set_frontend,
765 .get_frontend_legacy = mt312_get_frontend, 765 .get_frontend = mt312_get_frontend,
766 .get_tune_settings = mt312_get_tune_settings, 766 .get_tune_settings = mt312_get_tune_settings,
767 767
768 .read_status = mt312_read_status, 768 .read_status = mt312_read_status,