aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/stv0297.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-26 12:27:06 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 06:37:19 -0500
commit35aa48e74972961c6d6df21da32099f6679ae423 (patch)
treedd690b041594848ff59c0a6b4cd78a31a6add342 /drivers/media/dvb/frontends/stv0297.c
parent5c6b4e2b32d0578c7fad1afd056c92354cf4c85b (diff)
[media] stv0297: 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/stv0297.c')
-rw-r--r--drivers/media/dvb/frontends/stv0297.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 5d7c288c3022..88e8e52e308a 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -404,8 +404,9 @@ static int stv0297_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks)
404 return 0; 404 return 0;
405} 405}
406 406
407static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) 407static int stv0297_set_frontend(struct dvb_frontend *fe)
408{ 408{
409 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
409 struct stv0297_state *state = fe->demodulator_priv; 410 struct stv0297_state *state = fe->demodulator_priv;
410 int u_threshold; 411 int u_threshold;
411 int initial_u; 412 int initial_u;
@@ -417,7 +418,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par
417 unsigned long timeout; 418 unsigned long timeout;
418 fe_spectral_inversion_t inversion; 419 fe_spectral_inversion_t inversion;
419 420
420 switch (p->u.qam.modulation) { 421 switch (p->modulation) {
421 case QAM_16: 422 case QAM_16:
422 case QAM_32: 423 case QAM_32:
423 case QAM_64: 424 case QAM_64:
@@ -519,16 +520,16 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par
519 stv0297_writereg_mask(state, 0x69, 0x0f, 0x00); 520 stv0297_writereg_mask(state, 0x69, 0x0f, 0x00);
520 521
521 /* set parameters */ 522 /* set parameters */
522 stv0297_set_qam(state, p->u.qam.modulation); 523 stv0297_set_qam(state, p->modulation);
523 stv0297_set_symbolrate(state, p->u.qam.symbol_rate / 1000); 524 stv0297_set_symbolrate(state, p->symbol_rate / 1000);
524 stv0297_set_sweeprate(state, sweeprate, p->u.qam.symbol_rate / 1000); 525 stv0297_set_sweeprate(state, sweeprate, p->symbol_rate / 1000);
525 stv0297_set_carrieroffset(state, carrieroffset); 526 stv0297_set_carrieroffset(state, carrieroffset);
526 stv0297_set_inversion(state, inversion); 527 stv0297_set_inversion(state, inversion);
527 528
528 /* kick off lock */ 529 /* kick off lock */
529 /* Disable corner detection for higher QAMs */ 530 /* Disable corner detection for higher QAMs */
530 if (p->u.qam.modulation == QAM_128 || 531 if (p->modulation == QAM_128 ||
531 p->u.qam.modulation == QAM_256) 532 p->modulation == QAM_256)
532 stv0297_writereg_mask(state, 0x88, 0x08, 0x00); 533 stv0297_writereg_mask(state, 0x88, 0x08, 0x00);
533 else 534 else
534 stv0297_writereg_mask(state, 0x88, 0x08, 0x08); 535 stv0297_writereg_mask(state, 0x88, 0x08, 0x08);
@@ -613,7 +614,7 @@ timeout:
613 return 0; 614 return 0;
614} 615}
615 616
616static int stv0297_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) 617static int stv0297_get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties *p)
617{ 618{
618 struct stv0297_state *state = fe->demodulator_priv; 619 struct stv0297_state *state = fe->demodulator_priv;
619 int reg_00, reg_83; 620 int reg_00, reg_83;
@@ -625,24 +626,24 @@ static int stv0297_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_par
625 p->inversion = (reg_83 & 0x08) ? INVERSION_ON : INVERSION_OFF; 626 p->inversion = (reg_83 & 0x08) ? INVERSION_ON : INVERSION_OFF;
626 if (state->config->invert) 627 if (state->config->invert)
627 p->inversion = (p->inversion == INVERSION_ON) ? INVERSION_OFF : INVERSION_ON; 628 p->inversion = (p->inversion == INVERSION_ON) ? INVERSION_OFF : INVERSION_ON;
628 p->u.qam.symbol_rate = stv0297_get_symbolrate(state) * 1000; 629 p->symbol_rate = stv0297_get_symbolrate(state) * 1000;
629 p->u.qam.fec_inner = FEC_NONE; 630 p->fec_inner = FEC_NONE;
630 631
631 switch ((reg_00 >> 4) & 0x7) { 632 switch ((reg_00 >> 4) & 0x7) {
632 case 0: 633 case 0:
633 p->u.qam.modulation = QAM_16; 634 p->modulation = QAM_16;
634 break; 635 break;
635 case 1: 636 case 1:
636 p->u.qam.modulation = QAM_32; 637 p->modulation = QAM_32;
637 break; 638 break;
638 case 2: 639 case 2:
639 p->u.qam.modulation = QAM_128; 640 p->modulation = QAM_128;
640 break; 641 break;
641 case 3: 642 case 3:
642 p->u.qam.modulation = QAM_256; 643 p->modulation = QAM_256;
643 break; 644 break;
644 case 4: 645 case 4:
645 p->u.qam.modulation = QAM_64; 646 p->modulation = QAM_64;
646 break; 647 break;
647 } 648 }
648 649
@@ -706,8 +707,8 @@ static struct dvb_frontend_ops stv0297_ops = {
706 .sleep = stv0297_sleep, 707 .sleep = stv0297_sleep,
707 .i2c_gate_ctrl = stv0297_i2c_gate_ctrl, 708 .i2c_gate_ctrl = stv0297_i2c_gate_ctrl,
708 709
709 .set_frontend_legacy = stv0297_set_frontend, 710 .set_frontend = stv0297_set_frontend,
710 .get_frontend_legacy = stv0297_get_frontend, 711 .get_frontend = stv0297_get_frontend,
711 712
712 .read_status = stv0297_read_status, 713 .read_status = stv0297_read_status,
713 .read_ber = stv0297_read_ber, 714 .read_ber = stv0297_read_ber,