aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dispc.c
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2010-08-24 09:18:43 -0400
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-09-29 03:34:46 -0400
commit66be8f6cec4ffd78e5d59921ec9d5e299c0cfa3c (patch)
treec44943fff9374dea178654ea0e17edb4a1b82fd0 /drivers/video/omap2/dss/dispc.c
parentdd9c8bfbf074c93d45e98bf2a50c1261d0ad1747 (diff)
OMAP: DSS2: make filter coefficient tables human readable
Reorganize scaler FIR filter data as FIR value tables from raw register values. This makes them easier to understand and simplifies register programming code. No functional changes. Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video/omap2/dss/dispc.c')
-rw-r--r--drivers/video/omap2/dss/dispc.c214
1 files changed, 94 insertions, 120 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5ecdc0004094..90eb11083cc7 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -139,6 +139,22 @@ struct omap_dispc_isr_data {
139 u32 mask; 139 u32 mask;
140}; 140};
141 141
142struct dispc_h_coef {
143 s8 hc4;
144 s8 hc3;
145 u8 hc2;
146 s8 hc1;
147 s8 hc0;
148};
149
150struct dispc_v_coef {
151 s8 vc22;
152 s8 vc2;
153 u8 vc1;
154 s8 vc0;
155 s8 vc00;
156};
157
142#define REG_GET(idx, start, end) \ 158#define REG_GET(idx, start, end) \
143 FLD_GET(dispc_read_reg(idx), start, end) 159 FLD_GET(dispc_read_reg(idx), start, end)
144 160
@@ -564,106 +580,77 @@ static void _dispc_set_scale_coef(enum omap_plane plane, int hscaleup,
564 int vscaleup, int five_taps) 580 int vscaleup, int five_taps)
565{ 581{
566 /* Coefficients for horizontal up-sampling */ 582 /* Coefficients for horizontal up-sampling */
567 static const u32 coef_hup[8] = { 583 static const struct dispc_h_coef coef_hup[8] = {
568 0x00800000, 584 { 0, 0, 128, 0, 0 },
569 0x0D7CF800, 585 { -1, 13, 124, -8, 0 },
570 0x1E70F5FF, 586 { -2, 30, 112, -11, -1 },
571 0x335FF5FE, 587 { -5, 51, 95, -11, -2 },
572 0xF74949F7, 588 { 0, -9, 73, 73, -9 },
573 0xF55F33FB, 589 { -2, -11, 95, 51, -5 },
574 0xF5701EFE, 590 { -1, -11, 112, 30, -2 },
575 0xF87C0DFF, 591 { 0, -8, 124, 13, -1 },
576 }; 592 };
577 593
578 /* Coefficients for horizontal down-sampling */ 594 /* Coefficients for vertical up-sampling */
579 static const u32 coef_hdown[8] = { 595 static const struct dispc_v_coef coef_vup_3tap[8] = {
580 0x24382400, 596 { 0, 0, 128, 0, 0 },
581 0x28371FFE, 597 { 0, 3, 123, 2, 0 },
582 0x2C361BFB, 598 { 0, 12, 111, 5, 0 },
583 0x303516F9, 599 { 0, 32, 89, 7, 0 },
584 0x11343311, 600 { 0, 0, 64, 64, 0 },
585 0x1635300C, 601 { 0, 7, 89, 32, 0 },
586 0x1B362C08, 602 { 0, 5, 111, 12, 0 },
587 0x1F372804, 603 { 0, 2, 123, 3, 0 },
588 }; 604 };
589 605
590 /* Coefficients for horizontal and vertical up-sampling */ 606 static const struct dispc_v_coef coef_vup_5tap[8] = {
591 static const u32 coef_hvup[2][8] = { 607 { 0, 0, 128, 0, 0 },
592 { 608 { -1, 13, 124, -8, 0 },
593 0x00800000, 609 { -2, 30, 112, -11, -1 },
594 0x037B02FF, 610 { -5, 51, 95, -11, -2 },
595 0x0C6F05FE, 611 { 0, -9, 73, 73, -9 },
596 0x205907FB, 612 { -2, -11, 95, 51, -5 },
597 0x00404000, 613 { -1, -11, 112, 30, -2 },
598 0x075920FE, 614 { 0, -8, 124, 13, -1 },
599 0x056F0CFF,
600 0x027B0300,
601 },
602 {
603 0x00800000,
604 0x0D7CF8FF,
605 0x1E70F5FE,
606 0x335FF5FB,
607 0xF7404000,
608 0xF55F33FE,
609 0xF5701EFF,
610 0xF87C0D00,
611 },
612 }; 615 };
613 616
614 /* Coefficients for horizontal and vertical down-sampling */ 617 /* Coefficients for horizontal down-sampling */
615 static const u32 coef_hvdown[2][8] = { 618 static const struct dispc_h_coef coef_hdown[8] = {
616 { 619 { 0, 36, 56, 36, 0 },
617 0x24382400, 620 { 4, 40, 55, 31, -2 },
618 0x28391F04, 621 { 8, 44, 54, 27, -5 },
619 0x2D381B08, 622 { 12, 48, 53, 22, -7 },
620 0x3237170C, 623 { -9, 17, 52, 51, 17 },
621 0x123737F7, 624 { -7, 22, 53, 48, 12 },
622 0x173732F9, 625 { -5, 27, 54, 44, 8 },
623 0x1B382DFB, 626 { -2, 31, 55, 40, 4 },
624 0x1F3928FE,
625 },
626 {
627 0x24382400,
628 0x28371F04,
629 0x2C361B08,
630 0x3035160C,
631 0x113433F7,
632 0x163530F9,
633 0x1B362CFB,
634 0x1F3728FE,
635 },
636 }; 627 };
637 628
638 /* Coefficients for vertical up-sampling */ 629 /* Coefficients for vertical down-sampling */
639 static const u32 coef_vup[8] = { 630 static const struct dispc_v_coef coef_vdown_3tap[8] = {
640 0x00000000, 631 { 0, 36, 56, 36, 0 },
641 0x0000FF00, 632 { 0, 40, 57, 31, 0 },
642 0x0000FEFF, 633 { 0, 45, 56, 27, 0 },
643 0x0000FBFE, 634 { 0, 50, 55, 23, 0 },
644 0x000000F7, 635 { 0, 18, 55, 55, 0 },
645 0x0000FEFB, 636 { 0, 23, 55, 50, 0 },
646 0x0000FFFE, 637 { 0, 27, 56, 45, 0 },
647 0x000000FF, 638 { 0, 31, 57, 40, 0 },
648 }; 639 };
649 640
650 641 static const struct dispc_v_coef coef_vdown_5tap[8] = {
651 /* Coefficients for vertical down-sampling */ 642 { 0, 36, 56, 36, 0 },
652 static const u32 coef_vdown[8] = { 643 { 4, 40, 55, 31, -2 },
653 0x00000000, 644 { 8, 44, 54, 27, -5 },
654 0x000004FE, 645 { 12, 48, 53, 22, -7 },
655 0x000008FB, 646 { -9, 17, 52, 51, 17 },
656 0x00000CF9, 647 { -7, 22, 53, 48, 12 },
657 0x0000F711, 648 { -5, 27, 54, 44, 8 },
658 0x0000F90C, 649 { -2, 31, 55, 40, 4 },
659 0x0000FB08,
660 0x0000FE04,
661 }; 650 };
662 651
663 const u32 *h_coef; 652 const struct dispc_h_coef *h_coef;
664 const u32 *hv_coef; 653 const struct dispc_v_coef *v_coef;
665 const u32 *hv_coef_mod;
666 const u32 *v_coef;
667 int i; 654 int i;
668 655
669 if (hscaleup) 656 if (hscaleup)
@@ -671,47 +658,34 @@ static void _dispc_set_scale_coef(enum omap_plane plane, int hscaleup,
671 else 658 else
672 h_coef = coef_hdown; 659 h_coef = coef_hdown;
673 660
674 if (vscaleup) { 661 if (vscaleup)
675 hv_coef = coef_hvup[five_taps]; 662 v_coef = five_taps ? coef_vup_5tap : coef_vup_3tap;
676 v_coef = coef_vup; 663 else
677 664 v_coef = five_taps ? coef_vdown_5tap : coef_vdown_3tap;
678 if (hscaleup)
679 hv_coef_mod = NULL;
680 else
681 hv_coef_mod = coef_hvdown[five_taps];
682 } else {
683 hv_coef = coef_hvdown[five_taps];
684 v_coef = coef_vdown;
685
686 if (hscaleup)
687 hv_coef_mod = coef_hvup[five_taps];
688 else
689 hv_coef_mod = NULL;
690 }
691 665
692 for (i = 0; i < 8; i++) { 666 for (i = 0; i < 8; i++) {
693 u32 h, hv; 667 u32 h, hv;
694 668
695 h = h_coef[i]; 669 h = FLD_VAL(h_coef[i].hc0, 7, 0)
696 670 | FLD_VAL(h_coef[i].hc1, 15, 8)
697 hv = hv_coef[i]; 671 | FLD_VAL(h_coef[i].hc2, 23, 16)
698 672 | FLD_VAL(h_coef[i].hc3, 31, 24);
699 if (hv_coef_mod) { 673 hv = FLD_VAL(h_coef[i].hc4, 7, 0)
700 hv &= 0xffffff00; 674 | FLD_VAL(v_coef[i].vc0, 15, 8)
701 hv |= (hv_coef_mod[i] & 0xff); 675 | FLD_VAL(v_coef[i].vc1, 23, 16)
702 } 676 | FLD_VAL(v_coef[i].vc2, 31, 24);
703 677
704 _dispc_write_firh_reg(plane, i, h); 678 _dispc_write_firh_reg(plane, i, h);
705 _dispc_write_firhv_reg(plane, i, hv); 679 _dispc_write_firhv_reg(plane, i, hv);
706 } 680 }
707 681
708 if (!five_taps) 682 if (five_taps) {
709 return; 683 for (i = 0; i < 8; i++) {
710 684 u32 v;
711 for (i = 0; i < 8; i++) { 685 v = FLD_VAL(v_coef[i].vc00, 7, 0)
712 u32 v; 686 | FLD_VAL(v_coef[i].vc22, 15, 8);
713 v = v_coef[i]; 687 _dispc_write_firv_reg(plane, i, v);
714 _dispc_write_firv_reg(plane, i, v); 688 }
715 } 689 }
716} 690}
717 691