diff options
author | Antti Palosaari <crope@iki.fi> | 2012-04-05 20:14:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-04-09 13:55:46 -0400 |
commit | de7f14fcad50ccf66514498fd3bfaac015b071a5 (patch) | |
tree | 4b2dd63b63594e4c91f205524758db0095c3e519 /drivers/media/dvb | |
parent | 0a4df239af50650fdcf6bd4911a2f18156c2c9f0 (diff) |
[media] af9033: do some minor changes for .get_frontend()
Minor functionality and style changes.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/frontends/af9033.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/drivers/media/dvb/frontends/af9033.c b/drivers/media/dvb/frontends/af9033.c index da91155b8a26..2cb1f8d6955e 100644 --- a/drivers/media/dvb/frontends/af9033.c +++ b/drivers/media/dvb/frontends/af9033.c | |||
@@ -26,7 +26,6 @@ struct af9033_state { | |||
26 | struct dvb_frontend fe; | 26 | struct dvb_frontend fe; |
27 | struct af9033_config cfg; | 27 | struct af9033_config cfg; |
28 | 28 | ||
29 | u32 frequency; | ||
30 | u32 bandwidth_hz; | 29 | u32 bandwidth_hz; |
31 | bool ts_mode_parallel; | 30 | bool ts_mode_parallel; |
32 | bool ts_mode_serial; | 31 | bool ts_mode_serial; |
@@ -407,8 +406,6 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
407 | pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, | 406 | pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, |
408 | c->bandwidth_hz); | 407 | c->bandwidth_hz); |
409 | 408 | ||
410 | state->frequency = c->frequency; | ||
411 | |||
412 | /* check bandwidth */ | 409 | /* check bandwidth */ |
413 | switch (c->bandwidth_hz) { | 410 | switch (c->bandwidth_hz) { |
414 | case 6000000: | 411 | case 6000000: |
@@ -528,8 +525,8 @@ err: | |||
528 | 525 | ||
529 | static int af9033_get_frontend(struct dvb_frontend *fe) | 526 | static int af9033_get_frontend(struct dvb_frontend *fe) |
530 | { | 527 | { |
531 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; | ||
532 | struct af9033_state *state = fe->demodulator_priv; | 528 | struct af9033_state *state = fe->demodulator_priv; |
529 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
533 | int ret; | 530 | int ret; |
534 | u8 buf[8]; | 531 | u8 buf[8]; |
535 | 532 | ||
@@ -537,120 +534,118 @@ static int af9033_get_frontend(struct dvb_frontend *fe) | |||
537 | 534 | ||
538 | /* read all needed registers */ | 535 | /* read all needed registers */ |
539 | ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf)); | 536 | ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf)); |
540 | if (ret) | 537 | if (ret < 0) |
541 | goto error; | 538 | goto err; |
542 | 539 | ||
543 | switch ((buf[0] >> 0) & 3) { | 540 | switch ((buf[0] >> 0) & 3) { |
544 | case 0: | 541 | case 0: |
545 | p->transmission_mode = TRANSMISSION_MODE_2K; | 542 | c->transmission_mode = TRANSMISSION_MODE_2K; |
546 | break; | 543 | break; |
547 | case 1: | 544 | case 1: |
548 | p->transmission_mode = TRANSMISSION_MODE_8K; | 545 | c->transmission_mode = TRANSMISSION_MODE_8K; |
549 | break; | 546 | break; |
550 | } | 547 | } |
551 | 548 | ||
552 | switch ((buf[1] >> 0) & 3) { | 549 | switch ((buf[1] >> 0) & 3) { |
553 | case 0: | 550 | case 0: |
554 | p->guard_interval = GUARD_INTERVAL_1_32; | 551 | c->guard_interval = GUARD_INTERVAL_1_32; |
555 | break; | 552 | break; |
556 | case 1: | 553 | case 1: |
557 | p->guard_interval = GUARD_INTERVAL_1_16; | 554 | c->guard_interval = GUARD_INTERVAL_1_16; |
558 | break; | 555 | break; |
559 | case 2: | 556 | case 2: |
560 | p->guard_interval = GUARD_INTERVAL_1_8; | 557 | c->guard_interval = GUARD_INTERVAL_1_8; |
561 | break; | 558 | break; |
562 | case 3: | 559 | case 3: |
563 | p->guard_interval = GUARD_INTERVAL_1_4; | 560 | c->guard_interval = GUARD_INTERVAL_1_4; |
564 | break; | 561 | break; |
565 | } | 562 | } |
566 | 563 | ||
567 | switch ((buf[2] >> 0) & 7) { | 564 | switch ((buf[2] >> 0) & 7) { |
568 | case 0: | 565 | case 0: |
569 | p->hierarchy = HIERARCHY_NONE; | 566 | c->hierarchy = HIERARCHY_NONE; |
570 | break; | 567 | break; |
571 | case 1: | 568 | case 1: |
572 | p->hierarchy = HIERARCHY_1; | 569 | c->hierarchy = HIERARCHY_1; |
573 | break; | 570 | break; |
574 | case 2: | 571 | case 2: |
575 | p->hierarchy = HIERARCHY_2; | 572 | c->hierarchy = HIERARCHY_2; |
576 | break; | 573 | break; |
577 | case 3: | 574 | case 3: |
578 | p->hierarchy = HIERARCHY_4; | 575 | c->hierarchy = HIERARCHY_4; |
579 | break; | 576 | break; |
580 | } | 577 | } |
581 | 578 | ||
582 | switch ((buf[3] >> 0) & 3) { | 579 | switch ((buf[3] >> 0) & 3) { |
583 | case 0: | 580 | case 0: |
584 | p->modulation = QPSK; | 581 | c->modulation = QPSK; |
585 | break; | 582 | break; |
586 | case 1: | 583 | case 1: |
587 | p->modulation = QAM_16; | 584 | c->modulation = QAM_16; |
588 | break; | 585 | break; |
589 | case 2: | 586 | case 2: |
590 | p->modulation = QAM_64; | 587 | c->modulation = QAM_64; |
591 | break; | 588 | break; |
592 | } | 589 | } |
593 | 590 | ||
594 | switch ((buf[4] >> 0) & 3) { | 591 | switch ((buf[4] >> 0) & 3) { |
595 | case 0: | 592 | case 0: |
596 | p->bandwidth_hz = 6000000; | 593 | c->bandwidth_hz = 6000000; |
597 | break; | 594 | break; |
598 | case 1: | 595 | case 1: |
599 | p->bandwidth_hz = 7000000; | 596 | c->bandwidth_hz = 7000000; |
600 | break; | 597 | break; |
601 | case 2: | 598 | case 2: |
602 | p->bandwidth_hz = 8000000; | 599 | c->bandwidth_hz = 8000000; |
603 | break; | 600 | break; |
604 | } | 601 | } |
605 | 602 | ||
606 | switch ((buf[6] >> 0) & 7) { | 603 | switch ((buf[6] >> 0) & 7) { |
607 | case 0: | 604 | case 0: |
608 | p->code_rate_HP = FEC_1_2; | 605 | c->code_rate_HP = FEC_1_2; |
609 | break; | 606 | break; |
610 | case 1: | 607 | case 1: |
611 | p->code_rate_HP = FEC_2_3; | 608 | c->code_rate_HP = FEC_2_3; |
612 | break; | 609 | break; |
613 | case 2: | 610 | case 2: |
614 | p->code_rate_HP = FEC_3_4; | 611 | c->code_rate_HP = FEC_3_4; |
615 | break; | 612 | break; |
616 | case 3: | 613 | case 3: |
617 | p->code_rate_HP = FEC_5_6; | 614 | c->code_rate_HP = FEC_5_6; |
618 | break; | 615 | break; |
619 | case 4: | 616 | case 4: |
620 | p->code_rate_HP = FEC_7_8; | 617 | c->code_rate_HP = FEC_7_8; |
621 | break; | 618 | break; |
622 | case 5: | 619 | case 5: |
623 | p->code_rate_HP = FEC_NONE; | 620 | c->code_rate_HP = FEC_NONE; |
624 | break; | 621 | break; |
625 | } | 622 | } |
626 | 623 | ||
627 | switch ((buf[7] >> 0) & 7) { | 624 | switch ((buf[7] >> 0) & 7) { |
628 | case 0: | 625 | case 0: |
629 | p->code_rate_LP = FEC_1_2; | 626 | c->code_rate_LP = FEC_1_2; |
630 | break; | 627 | break; |
631 | case 1: | 628 | case 1: |
632 | p->code_rate_LP = FEC_2_3; | 629 | c->code_rate_LP = FEC_2_3; |
633 | break; | 630 | break; |
634 | case 2: | 631 | case 2: |
635 | p->code_rate_LP = FEC_3_4; | 632 | c->code_rate_LP = FEC_3_4; |
636 | break; | 633 | break; |
637 | case 3: | 634 | case 3: |
638 | p->code_rate_LP = FEC_5_6; | 635 | c->code_rate_LP = FEC_5_6; |
639 | break; | 636 | break; |
640 | case 4: | 637 | case 4: |
641 | p->code_rate_LP = FEC_7_8; | 638 | c->code_rate_LP = FEC_7_8; |
642 | break; | 639 | break; |
643 | case 5: | 640 | case 5: |
644 | p->code_rate_LP = FEC_NONE; | 641 | c->code_rate_LP = FEC_NONE; |
645 | break; | 642 | break; |
646 | } | 643 | } |
647 | 644 | ||
648 | p->inversion = INVERSION_AUTO; | 645 | return 0; |
649 | p->frequency = state->frequency; | ||
650 | 646 | ||
651 | error: | 647 | err: |
652 | if (ret) | 648 | pr_debug("%s: failed=%d\n", __func__, ret); |
653 | pr_debug("%s: failed:%d\n", __func__, ret); | ||
654 | 649 | ||
655 | return ret; | 650 | return ret; |
656 | } | 651 | } |