2 * linux/drivers/video/omap2/dss/dispc.h
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Archit Taneja <archit@ti.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published by
10 * the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __OMAP2_DISPC_REG_H
22 #define __OMAP2_DISPC_REG_H
24 /* DISPC common registers */
25 #define DISPC_REVISION 0x0000
26 #define DISPC_SYSCONFIG 0x0010
27 #define DISPC_SYSSTATUS 0x0014
28 #define DISPC_IRQSTATUS 0x0018
29 #define DISPC_IRQENABLE 0x001C
30 #define DISPC_CONTROL 0x0040
31 #define DISPC_CONFIG 0x0044
32 #define DISPC_CAPABLE 0x0048
33 #define DISPC_LINE_STATUS 0x005C
34 #define DISPC_LINE_NUMBER 0x0060
35 #define DISPC_GLOBAL_ALPHA 0x0074
36 #define DISPC_CONTROL2 0x0238
37 #define DISPC_CONFIG2 0x0620
38 #define DISPC_DIVISOR 0x0804
39 #define DISPC_GLOBAL_BUFFER 0x0800
40 #define DISPC_CONTROL3 0x0848
41 #define DISPC_CONFIG3 0x084C
42 #define DISPC_MSTANDBY_CTRL 0x0858
43 #define DISPC_GLOBAL_MFLAG_ATTRIBUTE 0x085C
45 /* DISPC overlay registers */
46 #define DISPC_OVL_BA0(n) (DISPC_OVL_BASE(n) + \
48 #define DISPC_OVL_BA1(n) (DISPC_OVL_BASE(n) + \
50 #define DISPC_OVL_BA0_UV(n) (DISPC_OVL_BASE(n) + \
51 DISPC_BA0_UV_OFFSET(n))
52 #define DISPC_OVL_BA1_UV(n) (DISPC_OVL_BASE(n) + \
53 DISPC_BA1_UV_OFFSET(n))
54 #define DISPC_OVL_POSITION(n) (DISPC_OVL_BASE(n) + \
56 #define DISPC_OVL_SIZE(n) (DISPC_OVL_BASE(n) + \
58 #define DISPC_OVL_ATTRIBUTES(n) (DISPC_OVL_BASE(n) + \
60 #define DISPC_OVL_ATTRIBUTES2(n) (DISPC_OVL_BASE(n) + \
61 DISPC_ATTR2_OFFSET(n))
62 #define DISPC_OVL_FIFO_THRESHOLD(n) (DISPC_OVL_BASE(n) + \
63 DISPC_FIFO_THRESH_OFFSET(n))
64 #define DISPC_OVL_FIFO_SIZE_STATUS(n) (DISPC_OVL_BASE(n) + \
65 DISPC_FIFO_SIZE_STATUS_OFFSET(n))
66 #define DISPC_OVL_ROW_INC(n) (DISPC_OVL_BASE(n) + \
67 DISPC_ROW_INC_OFFSET(n))
68 #define DISPC_OVL_PIXEL_INC(n) (DISPC_OVL_BASE(n) + \
69 DISPC_PIX_INC_OFFSET(n))
70 #define DISPC_OVL_WINDOW_SKIP(n) (DISPC_OVL_BASE(n) + \
71 DISPC_WINDOW_SKIP_OFFSET(n))
72 #define DISPC_OVL_TABLE_BA(n) (DISPC_OVL_BASE(n) + \
73 DISPC_TABLE_BA_OFFSET(n))
74 #define DISPC_OVL_FIR(n) (DISPC_OVL_BASE(n) + \
76 #define DISPC_OVL_FIR2(n) (DISPC_OVL_BASE(n) + \
78 #define DISPC_OVL_PICTURE_SIZE(n) (DISPC_OVL_BASE(n) + \
79 DISPC_PIC_SIZE_OFFSET(n))
80 #define DISPC_OVL_ACCU0(n) (DISPC_OVL_BASE(n) + \
81 DISPC_ACCU0_OFFSET(n))
82 #define DISPC_OVL_ACCU1(n) (DISPC_OVL_BASE(n) + \
83 DISPC_ACCU1_OFFSET(n))
84 #define DISPC_OVL_ACCU2_0(n) (DISPC_OVL_BASE(n) + \
85 DISPC_ACCU2_0_OFFSET(n))
86 #define DISPC_OVL_ACCU2_1(n) (DISPC_OVL_BASE(n) + \
87 DISPC_ACCU2_1_OFFSET(n))
88 #define DISPC_OVL_FIR_COEF_H(n, i) (DISPC_OVL_BASE(n) + \
89 DISPC_FIR_COEF_H_OFFSET(n, i))
90 #define DISPC_OVL_FIR_COEF_HV(n, i) (DISPC_OVL_BASE(n) + \
91 DISPC_FIR_COEF_HV_OFFSET(n, i))
92 #define DISPC_OVL_FIR_COEF_H2(n, i) (DISPC_OVL_BASE(n) + \
93 DISPC_FIR_COEF_H2_OFFSET(n, i))
94 #define DISPC_OVL_FIR_COEF_HV2(n, i) (DISPC_OVL_BASE(n) + \
95 DISPC_FIR_COEF_HV2_OFFSET(n, i))
96 #define DISPC_OVL_CONV_COEF(n, i) (DISPC_OVL_BASE(n) + \
97 DISPC_CONV_COEF_OFFSET(n, i))
98 #define DISPC_OVL_FIR_COEF_V(n, i) (DISPC_OVL_BASE(n) + \
99 DISPC_FIR_COEF_V_OFFSET(n, i))
100 #define DISPC_OVL_FIR_COEF_V2(n, i) (DISPC_OVL_BASE(n) + \
101 DISPC_FIR_COEF_V2_OFFSET(n, i))
102 #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
103 DISPC_PRELOAD_OFFSET(n))
104 #define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n)
106 /* DISPC up/downsampling FIR filter coefficient structure */
115 const struct dispc_coef
*dispc_ovl_get_scale_coef(int inc
, int five_taps
);
117 /* DISPC manager/channel specific registers */
118 static inline u16
DISPC_DEFAULT_COLOR(enum omap_channel channel
)
121 case OMAP_DSS_CHANNEL_LCD
:
123 case OMAP_DSS_CHANNEL_DIGIT
:
125 case OMAP_DSS_CHANNEL_LCD2
:
127 case OMAP_DSS_CHANNEL_LCD3
:
135 static inline u16
DISPC_TRANS_COLOR(enum omap_channel channel
)
138 case OMAP_DSS_CHANNEL_LCD
:
140 case OMAP_DSS_CHANNEL_DIGIT
:
142 case OMAP_DSS_CHANNEL_LCD2
:
144 case OMAP_DSS_CHANNEL_LCD3
:
152 static inline u16
DISPC_TIMING_H(enum omap_channel channel
)
155 case OMAP_DSS_CHANNEL_LCD
:
157 case OMAP_DSS_CHANNEL_DIGIT
:
160 case OMAP_DSS_CHANNEL_LCD2
:
162 case OMAP_DSS_CHANNEL_LCD3
:
170 static inline u16
DISPC_TIMING_V(enum omap_channel channel
)
173 case OMAP_DSS_CHANNEL_LCD
:
175 case OMAP_DSS_CHANNEL_DIGIT
:
178 case OMAP_DSS_CHANNEL_LCD2
:
180 case OMAP_DSS_CHANNEL_LCD3
:
188 static inline u16
DISPC_POL_FREQ(enum omap_channel channel
)
191 case OMAP_DSS_CHANNEL_LCD
:
193 case OMAP_DSS_CHANNEL_DIGIT
:
196 case OMAP_DSS_CHANNEL_LCD2
:
198 case OMAP_DSS_CHANNEL_LCD3
:
206 static inline u16
DISPC_DIVISORo(enum omap_channel channel
)
209 case OMAP_DSS_CHANNEL_LCD
:
211 case OMAP_DSS_CHANNEL_DIGIT
:
214 case OMAP_DSS_CHANNEL_LCD2
:
216 case OMAP_DSS_CHANNEL_LCD3
:
224 /* Named as DISPC_SIZE_LCD, DISPC_SIZE_DIGIT and DISPC_SIZE_LCD2 in TRM */
225 static inline u16
DISPC_SIZE_MGR(enum omap_channel channel
)
228 case OMAP_DSS_CHANNEL_LCD
:
230 case OMAP_DSS_CHANNEL_DIGIT
:
232 case OMAP_DSS_CHANNEL_LCD2
:
234 case OMAP_DSS_CHANNEL_LCD3
:
242 static inline u16
DISPC_DATA_CYCLE1(enum omap_channel channel
)
245 case OMAP_DSS_CHANNEL_LCD
:
247 case OMAP_DSS_CHANNEL_DIGIT
:
250 case OMAP_DSS_CHANNEL_LCD2
:
252 case OMAP_DSS_CHANNEL_LCD3
:
260 static inline u16
DISPC_DATA_CYCLE2(enum omap_channel channel
)
263 case OMAP_DSS_CHANNEL_LCD
:
265 case OMAP_DSS_CHANNEL_DIGIT
:
268 case OMAP_DSS_CHANNEL_LCD2
:
270 case OMAP_DSS_CHANNEL_LCD3
:
278 static inline u16
DISPC_DATA_CYCLE3(enum omap_channel channel
)
281 case OMAP_DSS_CHANNEL_LCD
:
283 case OMAP_DSS_CHANNEL_DIGIT
:
286 case OMAP_DSS_CHANNEL_LCD2
:
288 case OMAP_DSS_CHANNEL_LCD3
:
296 static inline u16
DISPC_CPR_COEF_R(enum omap_channel channel
)
299 case OMAP_DSS_CHANNEL_LCD
:
301 case OMAP_DSS_CHANNEL_DIGIT
:
304 case OMAP_DSS_CHANNEL_LCD2
:
306 case OMAP_DSS_CHANNEL_LCD3
:
314 static inline u16
DISPC_CPR_COEF_G(enum omap_channel channel
)
317 case OMAP_DSS_CHANNEL_LCD
:
319 case OMAP_DSS_CHANNEL_DIGIT
:
322 case OMAP_DSS_CHANNEL_LCD2
:
324 case OMAP_DSS_CHANNEL_LCD3
:
332 static inline u16
DISPC_CPR_COEF_B(enum omap_channel channel
)
335 case OMAP_DSS_CHANNEL_LCD
:
337 case OMAP_DSS_CHANNEL_DIGIT
:
340 case OMAP_DSS_CHANNEL_LCD2
:
342 case OMAP_DSS_CHANNEL_LCD3
:
350 /* DISPC overlay register base addresses */
351 static inline u16
DISPC_OVL_BASE(enum omap_plane plane
)
356 case OMAP_DSS_VIDEO1
:
358 case OMAP_DSS_VIDEO2
:
360 case OMAP_DSS_VIDEO3
:
370 /* DISPC overlay register offsets */
371 static inline u16
DISPC_BA0_OFFSET(enum omap_plane plane
)
375 case OMAP_DSS_VIDEO1
:
376 case OMAP_DSS_VIDEO2
:
378 case OMAP_DSS_VIDEO3
:
387 static inline u16
DISPC_BA1_OFFSET(enum omap_plane plane
)
391 case OMAP_DSS_VIDEO1
:
392 case OMAP_DSS_VIDEO2
:
394 case OMAP_DSS_VIDEO3
:
403 static inline u16
DISPC_BA0_UV_OFFSET(enum omap_plane plane
)
409 case OMAP_DSS_VIDEO1
:
411 case OMAP_DSS_VIDEO2
:
413 case OMAP_DSS_VIDEO3
:
423 static inline u16
DISPC_BA1_UV_OFFSET(enum omap_plane plane
)
429 case OMAP_DSS_VIDEO1
:
431 case OMAP_DSS_VIDEO2
:
433 case OMAP_DSS_VIDEO3
:
443 static inline u16
DISPC_POS_OFFSET(enum omap_plane plane
)
447 case OMAP_DSS_VIDEO1
:
448 case OMAP_DSS_VIDEO2
:
450 case OMAP_DSS_VIDEO3
:
458 static inline u16
DISPC_SIZE_OFFSET(enum omap_plane plane
)
462 case OMAP_DSS_VIDEO1
:
463 case OMAP_DSS_VIDEO2
:
465 case OMAP_DSS_VIDEO3
:
474 static inline u16
DISPC_ATTR_OFFSET(enum omap_plane plane
)
479 case OMAP_DSS_VIDEO1
:
480 case OMAP_DSS_VIDEO2
:
482 case OMAP_DSS_VIDEO3
:
491 static inline u16
DISPC_ATTR2_OFFSET(enum omap_plane plane
)
497 case OMAP_DSS_VIDEO1
:
499 case OMAP_DSS_VIDEO2
:
501 case OMAP_DSS_VIDEO3
:
511 static inline u16
DISPC_FIFO_THRESH_OFFSET(enum omap_plane plane
)
516 case OMAP_DSS_VIDEO1
:
517 case OMAP_DSS_VIDEO2
:
519 case OMAP_DSS_VIDEO3
:
528 static inline u16
DISPC_FIFO_SIZE_STATUS_OFFSET(enum omap_plane plane
)
533 case OMAP_DSS_VIDEO1
:
534 case OMAP_DSS_VIDEO2
:
536 case OMAP_DSS_VIDEO3
:
545 static inline u16
DISPC_ROW_INC_OFFSET(enum omap_plane plane
)
550 case OMAP_DSS_VIDEO1
:
551 case OMAP_DSS_VIDEO2
:
553 case OMAP_DSS_VIDEO3
:
562 static inline u16
DISPC_PIX_INC_OFFSET(enum omap_plane plane
)
567 case OMAP_DSS_VIDEO1
:
568 case OMAP_DSS_VIDEO2
:
570 case OMAP_DSS_VIDEO3
:
579 static inline u16
DISPC_WINDOW_SKIP_OFFSET(enum omap_plane plane
)
584 case OMAP_DSS_VIDEO1
:
585 case OMAP_DSS_VIDEO2
:
586 case OMAP_DSS_VIDEO3
:
595 static inline u16
DISPC_TABLE_BA_OFFSET(enum omap_plane plane
)
600 case OMAP_DSS_VIDEO1
:
601 case OMAP_DSS_VIDEO2
:
602 case OMAP_DSS_VIDEO3
:
611 static inline u16
DISPC_FIR_OFFSET(enum omap_plane plane
)
617 case OMAP_DSS_VIDEO1
:
618 case OMAP_DSS_VIDEO2
:
620 case OMAP_DSS_VIDEO3
:
629 static inline u16
DISPC_FIR2_OFFSET(enum omap_plane plane
)
635 case OMAP_DSS_VIDEO1
:
637 case OMAP_DSS_VIDEO2
:
639 case OMAP_DSS_VIDEO3
:
649 static inline u16
DISPC_PIC_SIZE_OFFSET(enum omap_plane plane
)
655 case OMAP_DSS_VIDEO1
:
656 case OMAP_DSS_VIDEO2
:
658 case OMAP_DSS_VIDEO3
:
668 static inline u16
DISPC_ACCU0_OFFSET(enum omap_plane plane
)
674 case OMAP_DSS_VIDEO1
:
675 case OMAP_DSS_VIDEO2
:
677 case OMAP_DSS_VIDEO3
:
686 static inline u16
DISPC_ACCU2_0_OFFSET(enum omap_plane plane
)
692 case OMAP_DSS_VIDEO1
:
694 case OMAP_DSS_VIDEO2
:
696 case OMAP_DSS_VIDEO3
:
706 static inline u16
DISPC_ACCU1_OFFSET(enum omap_plane plane
)
712 case OMAP_DSS_VIDEO1
:
713 case OMAP_DSS_VIDEO2
:
715 case OMAP_DSS_VIDEO3
:
724 static inline u16
DISPC_ACCU2_1_OFFSET(enum omap_plane plane
)
730 case OMAP_DSS_VIDEO1
:
732 case OMAP_DSS_VIDEO2
:
734 case OMAP_DSS_VIDEO3
:
744 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
745 static inline u16
DISPC_FIR_COEF_H_OFFSET(enum omap_plane plane
, u16 i
)
751 case OMAP_DSS_VIDEO1
:
752 case OMAP_DSS_VIDEO2
:
753 return 0x0034 + i
* 0x8;
754 case OMAP_DSS_VIDEO3
:
756 return 0x0010 + i
* 0x8;
763 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
764 static inline u16
DISPC_FIR_COEF_H2_OFFSET(enum omap_plane plane
, u16 i
)
770 case OMAP_DSS_VIDEO1
:
771 return 0x058C + i
* 0x8;
772 case OMAP_DSS_VIDEO2
:
773 return 0x0568 + i
* 0x8;
774 case OMAP_DSS_VIDEO3
:
775 return 0x0430 + i
* 0x8;
777 return 0x02A0 + i
* 0x8;
784 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
785 static inline u16
DISPC_FIR_COEF_HV_OFFSET(enum omap_plane plane
, u16 i
)
791 case OMAP_DSS_VIDEO1
:
792 case OMAP_DSS_VIDEO2
:
793 return 0x0038 + i
* 0x8;
794 case OMAP_DSS_VIDEO3
:
796 return 0x0014 + i
* 0x8;
803 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
804 static inline u16
DISPC_FIR_COEF_HV2_OFFSET(enum omap_plane plane
, u16 i
)
810 case OMAP_DSS_VIDEO1
:
811 return 0x0590 + i
* 8;
812 case OMAP_DSS_VIDEO2
:
813 return 0x056C + i
* 0x8;
814 case OMAP_DSS_VIDEO3
:
815 return 0x0434 + i
* 0x8;
817 return 0x02A4 + i
* 0x8;
824 /* coef index i = {0, 1, 2, 3, 4,} */
825 static inline u16
DISPC_CONV_COEF_OFFSET(enum omap_plane plane
, u16 i
)
831 case OMAP_DSS_VIDEO1
:
832 case OMAP_DSS_VIDEO2
:
833 case OMAP_DSS_VIDEO3
:
835 return 0x0074 + i
* 0x4;
842 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
843 static inline u16
DISPC_FIR_COEF_V_OFFSET(enum omap_plane plane
, u16 i
)
849 case OMAP_DSS_VIDEO1
:
850 return 0x0124 + i
* 0x4;
851 case OMAP_DSS_VIDEO2
:
852 return 0x00B4 + i
* 0x4;
853 case OMAP_DSS_VIDEO3
:
855 return 0x0050 + i
* 0x4;
862 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
863 static inline u16
DISPC_FIR_COEF_V2_OFFSET(enum omap_plane plane
, u16 i
)
869 case OMAP_DSS_VIDEO1
:
870 return 0x05CC + i
* 0x4;
871 case OMAP_DSS_VIDEO2
:
872 return 0x05A8 + i
* 0x4;
873 case OMAP_DSS_VIDEO3
:
874 return 0x0470 + i
* 0x4;
876 return 0x02E0 + i
* 0x4;
883 static inline u16
DISPC_PRELOAD_OFFSET(enum omap_plane plane
)
888 case OMAP_DSS_VIDEO1
:
890 case OMAP_DSS_VIDEO2
:
892 case OMAP_DSS_VIDEO3
:
900 static inline u16
DISPC_MFLAG_THRESHOLD_OFFSET(enum omap_plane plane
)
905 case OMAP_DSS_VIDEO1
:
907 case OMAP_DSS_VIDEO2
:
909 case OMAP_DSS_VIDEO3
: