1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/drivers/video/omap2/dss/dispc.h
5 * Copyright (C) 2011 Texas Instruments
6 * Author: Archit Taneja <archit@ti.com>
9 #ifndef __OMAP2_DISPC_REG_H
10 #define __OMAP2_DISPC_REG_H
12 /* DISPC common registers */
13 #define DISPC_REVISION 0x0000
14 #define DISPC_SYSCONFIG 0x0010
15 #define DISPC_SYSSTATUS 0x0014
16 #define DISPC_IRQSTATUS 0x0018
17 #define DISPC_IRQENABLE 0x001C
18 #define DISPC_CONTROL 0x0040
19 #define DISPC_CONFIG 0x0044
20 #define DISPC_CAPABLE 0x0048
21 #define DISPC_LINE_STATUS 0x005C
22 #define DISPC_LINE_NUMBER 0x0060
23 #define DISPC_GLOBAL_ALPHA 0x0074
24 #define DISPC_CONTROL2 0x0238
25 #define DISPC_CONFIG2 0x0620
26 #define DISPC_DIVISOR 0x0804
27 #define DISPC_GLOBAL_BUFFER 0x0800
28 #define DISPC_CONTROL3 0x0848
29 #define DISPC_CONFIG3 0x084C
30 #define DISPC_MSTANDBY_CTRL 0x0858
31 #define DISPC_GLOBAL_MFLAG_ATTRIBUTE 0x085C
33 /* DISPC overlay registers */
34 #define DISPC_OVL_BA0(n) (DISPC_OVL_BASE(n) + \
36 #define DISPC_OVL_BA1(n) (DISPC_OVL_BASE(n) + \
38 #define DISPC_OVL_BA0_UV(n) (DISPC_OVL_BASE(n) + \
39 DISPC_BA0_UV_OFFSET(n))
40 #define DISPC_OVL_BA1_UV(n) (DISPC_OVL_BASE(n) + \
41 DISPC_BA1_UV_OFFSET(n))
42 #define DISPC_OVL_POSITION(n) (DISPC_OVL_BASE(n) + \
44 #define DISPC_OVL_SIZE(n) (DISPC_OVL_BASE(n) + \
46 #define DISPC_OVL_ATTRIBUTES(n) (DISPC_OVL_BASE(n) + \
48 #define DISPC_OVL_ATTRIBUTES2(n) (DISPC_OVL_BASE(n) + \
49 DISPC_ATTR2_OFFSET(n))
50 #define DISPC_OVL_FIFO_THRESHOLD(n) (DISPC_OVL_BASE(n) + \
51 DISPC_FIFO_THRESH_OFFSET(n))
52 #define DISPC_OVL_FIFO_SIZE_STATUS(n) (DISPC_OVL_BASE(n) + \
53 DISPC_FIFO_SIZE_STATUS_OFFSET(n))
54 #define DISPC_OVL_ROW_INC(n) (DISPC_OVL_BASE(n) + \
55 DISPC_ROW_INC_OFFSET(n))
56 #define DISPC_OVL_PIXEL_INC(n) (DISPC_OVL_BASE(n) + \
57 DISPC_PIX_INC_OFFSET(n))
58 #define DISPC_OVL_WINDOW_SKIP(n) (DISPC_OVL_BASE(n) + \
59 DISPC_WINDOW_SKIP_OFFSET(n))
60 #define DISPC_OVL_TABLE_BA(n) (DISPC_OVL_BASE(n) + \
61 DISPC_TABLE_BA_OFFSET(n))
62 #define DISPC_OVL_FIR(n) (DISPC_OVL_BASE(n) + \
64 #define DISPC_OVL_FIR2(n) (DISPC_OVL_BASE(n) + \
66 #define DISPC_OVL_PICTURE_SIZE(n) (DISPC_OVL_BASE(n) + \
67 DISPC_PIC_SIZE_OFFSET(n))
68 #define DISPC_OVL_ACCU0(n) (DISPC_OVL_BASE(n) + \
69 DISPC_ACCU0_OFFSET(n))
70 #define DISPC_OVL_ACCU1(n) (DISPC_OVL_BASE(n) + \
71 DISPC_ACCU1_OFFSET(n))
72 #define DISPC_OVL_ACCU2_0(n) (DISPC_OVL_BASE(n) + \
73 DISPC_ACCU2_0_OFFSET(n))
74 #define DISPC_OVL_ACCU2_1(n) (DISPC_OVL_BASE(n) + \
75 DISPC_ACCU2_1_OFFSET(n))
76 #define DISPC_OVL_FIR_COEF_H(n, i) (DISPC_OVL_BASE(n) + \
77 DISPC_FIR_COEF_H_OFFSET(n, i))
78 #define DISPC_OVL_FIR_COEF_HV(n, i) (DISPC_OVL_BASE(n) + \
79 DISPC_FIR_COEF_HV_OFFSET(n, i))
80 #define DISPC_OVL_FIR_COEF_H2(n, i) (DISPC_OVL_BASE(n) + \
81 DISPC_FIR_COEF_H2_OFFSET(n, i))
82 #define DISPC_OVL_FIR_COEF_HV2(n, i) (DISPC_OVL_BASE(n) + \
83 DISPC_FIR_COEF_HV2_OFFSET(n, i))
84 #define DISPC_OVL_CONV_COEF(n, i) (DISPC_OVL_BASE(n) + \
85 DISPC_CONV_COEF_OFFSET(n, i))
86 #define DISPC_OVL_FIR_COEF_V(n, i) (DISPC_OVL_BASE(n) + \
87 DISPC_FIR_COEF_V_OFFSET(n, i))
88 #define DISPC_OVL_FIR_COEF_V2(n, i) (DISPC_OVL_BASE(n) + \
89 DISPC_FIR_COEF_V2_OFFSET(n, i))
90 #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
91 DISPC_PRELOAD_OFFSET(n))
92 #define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n)
94 /* DISPC up/downsampling FIR filter coefficient structure */
103 const struct dispc_coef
*dispc_ovl_get_scale_coef(int inc
, int five_taps
);
105 /* DISPC manager/channel specific registers */
106 static inline u16
DISPC_DEFAULT_COLOR(enum omap_channel channel
)
109 case OMAP_DSS_CHANNEL_LCD
:
111 case OMAP_DSS_CHANNEL_DIGIT
:
113 case OMAP_DSS_CHANNEL_LCD2
:
115 case OMAP_DSS_CHANNEL_LCD3
:
123 static inline u16
DISPC_TRANS_COLOR(enum omap_channel channel
)
126 case OMAP_DSS_CHANNEL_LCD
:
128 case OMAP_DSS_CHANNEL_DIGIT
:
130 case OMAP_DSS_CHANNEL_LCD2
:
132 case OMAP_DSS_CHANNEL_LCD3
:
140 static inline u16
DISPC_TIMING_H(enum omap_channel channel
)
143 case OMAP_DSS_CHANNEL_LCD
:
145 case OMAP_DSS_CHANNEL_DIGIT
:
148 case OMAP_DSS_CHANNEL_LCD2
:
150 case OMAP_DSS_CHANNEL_LCD3
:
158 static inline u16
DISPC_TIMING_V(enum omap_channel channel
)
161 case OMAP_DSS_CHANNEL_LCD
:
163 case OMAP_DSS_CHANNEL_DIGIT
:
166 case OMAP_DSS_CHANNEL_LCD2
:
168 case OMAP_DSS_CHANNEL_LCD3
:
176 static inline u16
DISPC_POL_FREQ(enum omap_channel channel
)
179 case OMAP_DSS_CHANNEL_LCD
:
181 case OMAP_DSS_CHANNEL_DIGIT
:
184 case OMAP_DSS_CHANNEL_LCD2
:
186 case OMAP_DSS_CHANNEL_LCD3
:
194 static inline u16
DISPC_DIVISORo(enum omap_channel channel
)
197 case OMAP_DSS_CHANNEL_LCD
:
199 case OMAP_DSS_CHANNEL_DIGIT
:
202 case OMAP_DSS_CHANNEL_LCD2
:
204 case OMAP_DSS_CHANNEL_LCD3
:
212 /* Named as DISPC_SIZE_LCD, DISPC_SIZE_DIGIT and DISPC_SIZE_LCD2 in TRM */
213 static inline u16
DISPC_SIZE_MGR(enum omap_channel channel
)
216 case OMAP_DSS_CHANNEL_LCD
:
218 case OMAP_DSS_CHANNEL_DIGIT
:
220 case OMAP_DSS_CHANNEL_LCD2
:
222 case OMAP_DSS_CHANNEL_LCD3
:
230 static inline u16
DISPC_DATA_CYCLE1(enum omap_channel channel
)
233 case OMAP_DSS_CHANNEL_LCD
:
235 case OMAP_DSS_CHANNEL_DIGIT
:
238 case OMAP_DSS_CHANNEL_LCD2
:
240 case OMAP_DSS_CHANNEL_LCD3
:
248 static inline u16
DISPC_DATA_CYCLE2(enum omap_channel channel
)
251 case OMAP_DSS_CHANNEL_LCD
:
253 case OMAP_DSS_CHANNEL_DIGIT
:
256 case OMAP_DSS_CHANNEL_LCD2
:
258 case OMAP_DSS_CHANNEL_LCD3
:
266 static inline u16
DISPC_DATA_CYCLE3(enum omap_channel channel
)
269 case OMAP_DSS_CHANNEL_LCD
:
271 case OMAP_DSS_CHANNEL_DIGIT
:
274 case OMAP_DSS_CHANNEL_LCD2
:
276 case OMAP_DSS_CHANNEL_LCD3
:
284 static inline u16
DISPC_CPR_COEF_R(enum omap_channel channel
)
287 case OMAP_DSS_CHANNEL_LCD
:
289 case OMAP_DSS_CHANNEL_DIGIT
:
292 case OMAP_DSS_CHANNEL_LCD2
:
294 case OMAP_DSS_CHANNEL_LCD3
:
302 static inline u16
DISPC_CPR_COEF_G(enum omap_channel channel
)
305 case OMAP_DSS_CHANNEL_LCD
:
307 case OMAP_DSS_CHANNEL_DIGIT
:
310 case OMAP_DSS_CHANNEL_LCD2
:
312 case OMAP_DSS_CHANNEL_LCD3
:
320 static inline u16
DISPC_CPR_COEF_B(enum omap_channel channel
)
323 case OMAP_DSS_CHANNEL_LCD
:
325 case OMAP_DSS_CHANNEL_DIGIT
:
328 case OMAP_DSS_CHANNEL_LCD2
:
330 case OMAP_DSS_CHANNEL_LCD3
:
338 /* DISPC overlay register base addresses */
339 static inline u16
DISPC_OVL_BASE(enum omap_plane plane
)
344 case OMAP_DSS_VIDEO1
:
346 case OMAP_DSS_VIDEO2
:
348 case OMAP_DSS_VIDEO3
:
358 /* DISPC overlay register offsets */
359 static inline u16
DISPC_BA0_OFFSET(enum omap_plane plane
)
363 case OMAP_DSS_VIDEO1
:
364 case OMAP_DSS_VIDEO2
:
366 case OMAP_DSS_VIDEO3
:
375 static inline u16
DISPC_BA1_OFFSET(enum omap_plane plane
)
379 case OMAP_DSS_VIDEO1
:
380 case OMAP_DSS_VIDEO2
:
382 case OMAP_DSS_VIDEO3
:
391 static inline u16
DISPC_BA0_UV_OFFSET(enum omap_plane plane
)
397 case OMAP_DSS_VIDEO1
:
399 case OMAP_DSS_VIDEO2
:
401 case OMAP_DSS_VIDEO3
:
411 static inline u16
DISPC_BA1_UV_OFFSET(enum omap_plane plane
)
417 case OMAP_DSS_VIDEO1
:
419 case OMAP_DSS_VIDEO2
:
421 case OMAP_DSS_VIDEO3
:
431 static inline u16
DISPC_POS_OFFSET(enum omap_plane plane
)
435 case OMAP_DSS_VIDEO1
:
436 case OMAP_DSS_VIDEO2
:
438 case OMAP_DSS_VIDEO3
:
446 static inline u16
DISPC_SIZE_OFFSET(enum omap_plane plane
)
450 case OMAP_DSS_VIDEO1
:
451 case OMAP_DSS_VIDEO2
:
453 case OMAP_DSS_VIDEO3
:
462 static inline u16
DISPC_ATTR_OFFSET(enum omap_plane plane
)
467 case OMAP_DSS_VIDEO1
:
468 case OMAP_DSS_VIDEO2
:
470 case OMAP_DSS_VIDEO3
:
479 static inline u16
DISPC_ATTR2_OFFSET(enum omap_plane plane
)
485 case OMAP_DSS_VIDEO1
:
487 case OMAP_DSS_VIDEO2
:
489 case OMAP_DSS_VIDEO3
:
499 static inline u16
DISPC_FIFO_THRESH_OFFSET(enum omap_plane plane
)
504 case OMAP_DSS_VIDEO1
:
505 case OMAP_DSS_VIDEO2
:
507 case OMAP_DSS_VIDEO3
:
516 static inline u16
DISPC_FIFO_SIZE_STATUS_OFFSET(enum omap_plane plane
)
521 case OMAP_DSS_VIDEO1
:
522 case OMAP_DSS_VIDEO2
:
524 case OMAP_DSS_VIDEO3
:
533 static inline u16
DISPC_ROW_INC_OFFSET(enum omap_plane plane
)
538 case OMAP_DSS_VIDEO1
:
539 case OMAP_DSS_VIDEO2
:
541 case OMAP_DSS_VIDEO3
:
550 static inline u16
DISPC_PIX_INC_OFFSET(enum omap_plane plane
)
555 case OMAP_DSS_VIDEO1
:
556 case OMAP_DSS_VIDEO2
:
558 case OMAP_DSS_VIDEO3
:
567 static inline u16
DISPC_WINDOW_SKIP_OFFSET(enum omap_plane plane
)
572 case OMAP_DSS_VIDEO1
:
573 case OMAP_DSS_VIDEO2
:
574 case OMAP_DSS_VIDEO3
:
583 static inline u16
DISPC_TABLE_BA_OFFSET(enum omap_plane plane
)
588 case OMAP_DSS_VIDEO1
:
589 case OMAP_DSS_VIDEO2
:
590 case OMAP_DSS_VIDEO3
:
599 static inline u16
DISPC_FIR_OFFSET(enum omap_plane plane
)
605 case OMAP_DSS_VIDEO1
:
606 case OMAP_DSS_VIDEO2
:
608 case OMAP_DSS_VIDEO3
:
617 static inline u16
DISPC_FIR2_OFFSET(enum omap_plane plane
)
623 case OMAP_DSS_VIDEO1
:
625 case OMAP_DSS_VIDEO2
:
627 case OMAP_DSS_VIDEO3
:
637 static inline u16
DISPC_PIC_SIZE_OFFSET(enum omap_plane plane
)
643 case OMAP_DSS_VIDEO1
:
644 case OMAP_DSS_VIDEO2
:
646 case OMAP_DSS_VIDEO3
:
656 static inline u16
DISPC_ACCU0_OFFSET(enum omap_plane plane
)
662 case OMAP_DSS_VIDEO1
:
663 case OMAP_DSS_VIDEO2
:
665 case OMAP_DSS_VIDEO3
:
674 static inline u16
DISPC_ACCU2_0_OFFSET(enum omap_plane plane
)
680 case OMAP_DSS_VIDEO1
:
682 case OMAP_DSS_VIDEO2
:
684 case OMAP_DSS_VIDEO3
:
694 static inline u16
DISPC_ACCU1_OFFSET(enum omap_plane plane
)
700 case OMAP_DSS_VIDEO1
:
701 case OMAP_DSS_VIDEO2
:
703 case OMAP_DSS_VIDEO3
:
712 static inline u16
DISPC_ACCU2_1_OFFSET(enum omap_plane plane
)
718 case OMAP_DSS_VIDEO1
:
720 case OMAP_DSS_VIDEO2
:
722 case OMAP_DSS_VIDEO3
:
732 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
733 static inline u16
DISPC_FIR_COEF_H_OFFSET(enum omap_plane plane
, u16 i
)
739 case OMAP_DSS_VIDEO1
:
740 case OMAP_DSS_VIDEO2
:
741 return 0x0034 + i
* 0x8;
742 case OMAP_DSS_VIDEO3
:
744 return 0x0010 + i
* 0x8;
751 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
752 static inline u16
DISPC_FIR_COEF_H2_OFFSET(enum omap_plane plane
, u16 i
)
758 case OMAP_DSS_VIDEO1
:
759 return 0x058C + i
* 0x8;
760 case OMAP_DSS_VIDEO2
:
761 return 0x0568 + i
* 0x8;
762 case OMAP_DSS_VIDEO3
:
763 return 0x0430 + i
* 0x8;
765 return 0x02A0 + i
* 0x8;
772 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
773 static inline u16
DISPC_FIR_COEF_HV_OFFSET(enum omap_plane plane
, u16 i
)
779 case OMAP_DSS_VIDEO1
:
780 case OMAP_DSS_VIDEO2
:
781 return 0x0038 + i
* 0x8;
782 case OMAP_DSS_VIDEO3
:
784 return 0x0014 + i
* 0x8;
791 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
792 static inline u16
DISPC_FIR_COEF_HV2_OFFSET(enum omap_plane plane
, u16 i
)
798 case OMAP_DSS_VIDEO1
:
799 return 0x0590 + i
* 8;
800 case OMAP_DSS_VIDEO2
:
801 return 0x056C + i
* 0x8;
802 case OMAP_DSS_VIDEO3
:
803 return 0x0434 + i
* 0x8;
805 return 0x02A4 + i
* 0x8;
812 /* coef index i = {0, 1, 2, 3, 4,} */
813 static inline u16
DISPC_CONV_COEF_OFFSET(enum omap_plane plane
, u16 i
)
819 case OMAP_DSS_VIDEO1
:
820 case OMAP_DSS_VIDEO2
:
821 case OMAP_DSS_VIDEO3
:
823 return 0x0074 + i
* 0x4;
830 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
831 static inline u16
DISPC_FIR_COEF_V_OFFSET(enum omap_plane plane
, u16 i
)
837 case OMAP_DSS_VIDEO1
:
838 return 0x0124 + i
* 0x4;
839 case OMAP_DSS_VIDEO2
:
840 return 0x00B4 + i
* 0x4;
841 case OMAP_DSS_VIDEO3
:
843 return 0x0050 + i
* 0x4;
850 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
851 static inline u16
DISPC_FIR_COEF_V2_OFFSET(enum omap_plane plane
, u16 i
)
857 case OMAP_DSS_VIDEO1
:
858 return 0x05CC + i
* 0x4;
859 case OMAP_DSS_VIDEO2
:
860 return 0x05A8 + i
* 0x4;
861 case OMAP_DSS_VIDEO3
:
862 return 0x0470 + i
* 0x4;
864 return 0x02E0 + i
* 0x4;
871 static inline u16
DISPC_PRELOAD_OFFSET(enum omap_plane plane
)
876 case OMAP_DSS_VIDEO1
:
878 case OMAP_DSS_VIDEO2
:
880 case OMAP_DSS_VIDEO3
:
888 static inline u16
DISPC_MFLAG_THRESHOLD_OFFSET(enum omap_plane plane
)
893 case OMAP_DSS_VIDEO1
:
895 case OMAP_DSS_VIDEO2
:
897 case OMAP_DSS_VIDEO3
: