1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
4 * Author: Archit Taneja <archit@ti.com>
7 #ifndef __OMAP2_DISPC_REG_H
8 #define __OMAP2_DISPC_REG_H
10 /* DISPC common registers */
11 #define DISPC_REVISION 0x0000
12 #define DISPC_SYSCONFIG 0x0010
13 #define DISPC_SYSSTATUS 0x0014
14 #define DISPC_IRQSTATUS 0x0018
15 #define DISPC_IRQENABLE 0x001C
16 #define DISPC_CONTROL 0x0040
17 #define DISPC_CONFIG 0x0044
18 #define DISPC_CAPABLE 0x0048
19 #define DISPC_LINE_STATUS 0x005C
20 #define DISPC_LINE_NUMBER 0x0060
21 #define DISPC_GLOBAL_ALPHA 0x0074
22 #define DISPC_CONTROL2 0x0238
23 #define DISPC_CONFIG2 0x0620
24 #define DISPC_DIVISOR 0x0804
25 #define DISPC_GLOBAL_BUFFER 0x0800
26 #define DISPC_CONTROL3 0x0848
27 #define DISPC_CONFIG3 0x084C
28 #define DISPC_MSTANDBY_CTRL 0x0858
29 #define DISPC_GLOBAL_MFLAG_ATTRIBUTE 0x085C
31 #define DISPC_GAMMA_TABLE0 0x0630
32 #define DISPC_GAMMA_TABLE1 0x0634
33 #define DISPC_GAMMA_TABLE2 0x0638
34 #define DISPC_GAMMA_TABLE3 0x0850
36 /* DISPC overlay registers */
37 #define DISPC_OVL_BA0(n) (DISPC_OVL_BASE(n) + \
39 #define DISPC_OVL_BA1(n) (DISPC_OVL_BASE(n) + \
41 #define DISPC_OVL_BA0_UV(n) (DISPC_OVL_BASE(n) + \
42 DISPC_BA0_UV_OFFSET(n))
43 #define DISPC_OVL_BA1_UV(n) (DISPC_OVL_BASE(n) + \
44 DISPC_BA1_UV_OFFSET(n))
45 #define DISPC_OVL_POSITION(n) (DISPC_OVL_BASE(n) + \
47 #define DISPC_OVL_SIZE(n) (DISPC_OVL_BASE(n) + \
49 #define DISPC_OVL_ATTRIBUTES(n) (DISPC_OVL_BASE(n) + \
51 #define DISPC_OVL_ATTRIBUTES2(n) (DISPC_OVL_BASE(n) + \
52 DISPC_ATTR2_OFFSET(n))
53 #define DISPC_OVL_FIFO_THRESHOLD(n) (DISPC_OVL_BASE(n) + \
54 DISPC_FIFO_THRESH_OFFSET(n))
55 #define DISPC_OVL_FIFO_SIZE_STATUS(n) (DISPC_OVL_BASE(n) + \
56 DISPC_FIFO_SIZE_STATUS_OFFSET(n))
57 #define DISPC_OVL_ROW_INC(n) (DISPC_OVL_BASE(n) + \
58 DISPC_ROW_INC_OFFSET(n))
59 #define DISPC_OVL_PIXEL_INC(n) (DISPC_OVL_BASE(n) + \
60 DISPC_PIX_INC_OFFSET(n))
61 #define DISPC_OVL_WINDOW_SKIP(n) (DISPC_OVL_BASE(n) + \
62 DISPC_WINDOW_SKIP_OFFSET(n))
63 #define DISPC_OVL_TABLE_BA(n) (DISPC_OVL_BASE(n) + \
64 DISPC_TABLE_BA_OFFSET(n))
65 #define DISPC_OVL_FIR(n) (DISPC_OVL_BASE(n) + \
67 #define DISPC_OVL_FIR2(n) (DISPC_OVL_BASE(n) + \
69 #define DISPC_OVL_PICTURE_SIZE(n) (DISPC_OVL_BASE(n) + \
70 DISPC_PIC_SIZE_OFFSET(n))
71 #define DISPC_OVL_ACCU0(n) (DISPC_OVL_BASE(n) + \
72 DISPC_ACCU0_OFFSET(n))
73 #define DISPC_OVL_ACCU1(n) (DISPC_OVL_BASE(n) + \
74 DISPC_ACCU1_OFFSET(n))
75 #define DISPC_OVL_ACCU2_0(n) (DISPC_OVL_BASE(n) + \
76 DISPC_ACCU2_0_OFFSET(n))
77 #define DISPC_OVL_ACCU2_1(n) (DISPC_OVL_BASE(n) + \
78 DISPC_ACCU2_1_OFFSET(n))
79 #define DISPC_OVL_FIR_COEF_H(n, i) (DISPC_OVL_BASE(n) + \
80 DISPC_FIR_COEF_H_OFFSET(n, i))
81 #define DISPC_OVL_FIR_COEF_HV(n, i) (DISPC_OVL_BASE(n) + \
82 DISPC_FIR_COEF_HV_OFFSET(n, i))
83 #define DISPC_OVL_FIR_COEF_H2(n, i) (DISPC_OVL_BASE(n) + \
84 DISPC_FIR_COEF_H2_OFFSET(n, i))
85 #define DISPC_OVL_FIR_COEF_HV2(n, i) (DISPC_OVL_BASE(n) + \
86 DISPC_FIR_COEF_HV2_OFFSET(n, i))
87 #define DISPC_OVL_CONV_COEF(n, i) (DISPC_OVL_BASE(n) + \
88 DISPC_CONV_COEF_OFFSET(n, i))
89 #define DISPC_OVL_FIR_COEF_V(n, i) (DISPC_OVL_BASE(n) + \
90 DISPC_FIR_COEF_V_OFFSET(n, i))
91 #define DISPC_OVL_FIR_COEF_V2(n, i) (DISPC_OVL_BASE(n) + \
92 DISPC_FIR_COEF_V2_OFFSET(n, i))
93 #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
94 DISPC_PRELOAD_OFFSET(n))
95 #define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n)
97 /* DISPC up/downsampling FIR filter coefficient structure */
106 const struct dispc_coef
*dispc_ovl_get_scale_coef(int inc
, int five_taps
);
108 /* DISPC manager/channel specific registers */
109 static inline u16
DISPC_DEFAULT_COLOR(enum omap_channel channel
)
112 case OMAP_DSS_CHANNEL_LCD
:
114 case OMAP_DSS_CHANNEL_DIGIT
:
116 case OMAP_DSS_CHANNEL_LCD2
:
118 case OMAP_DSS_CHANNEL_LCD3
:
126 static inline u16
DISPC_TRANS_COLOR(enum omap_channel channel
)
129 case OMAP_DSS_CHANNEL_LCD
:
131 case OMAP_DSS_CHANNEL_DIGIT
:
133 case OMAP_DSS_CHANNEL_LCD2
:
135 case OMAP_DSS_CHANNEL_LCD3
:
143 static inline u16
DISPC_TIMING_H(enum omap_channel channel
)
146 case OMAP_DSS_CHANNEL_LCD
:
148 case OMAP_DSS_CHANNEL_DIGIT
:
151 case OMAP_DSS_CHANNEL_LCD2
:
153 case OMAP_DSS_CHANNEL_LCD3
:
161 static inline u16
DISPC_TIMING_V(enum omap_channel channel
)
164 case OMAP_DSS_CHANNEL_LCD
:
166 case OMAP_DSS_CHANNEL_DIGIT
:
169 case OMAP_DSS_CHANNEL_LCD2
:
171 case OMAP_DSS_CHANNEL_LCD3
:
179 static inline u16
DISPC_POL_FREQ(enum omap_channel channel
)
182 case OMAP_DSS_CHANNEL_LCD
:
184 case OMAP_DSS_CHANNEL_DIGIT
:
187 case OMAP_DSS_CHANNEL_LCD2
:
189 case OMAP_DSS_CHANNEL_LCD3
:
197 static inline u16
DISPC_DIVISORo(enum omap_channel channel
)
200 case OMAP_DSS_CHANNEL_LCD
:
202 case OMAP_DSS_CHANNEL_DIGIT
:
205 case OMAP_DSS_CHANNEL_LCD2
:
207 case OMAP_DSS_CHANNEL_LCD3
:
215 /* Named as DISPC_SIZE_LCD, DISPC_SIZE_DIGIT and DISPC_SIZE_LCD2 in TRM */
216 static inline u16
DISPC_SIZE_MGR(enum omap_channel channel
)
219 case OMAP_DSS_CHANNEL_LCD
:
221 case OMAP_DSS_CHANNEL_DIGIT
:
223 case OMAP_DSS_CHANNEL_LCD2
:
225 case OMAP_DSS_CHANNEL_LCD3
:
233 static inline u16
DISPC_DATA_CYCLE1(enum omap_channel channel
)
236 case OMAP_DSS_CHANNEL_LCD
:
238 case OMAP_DSS_CHANNEL_DIGIT
:
241 case OMAP_DSS_CHANNEL_LCD2
:
243 case OMAP_DSS_CHANNEL_LCD3
:
251 static inline u16
DISPC_DATA_CYCLE2(enum omap_channel channel
)
254 case OMAP_DSS_CHANNEL_LCD
:
256 case OMAP_DSS_CHANNEL_DIGIT
:
259 case OMAP_DSS_CHANNEL_LCD2
:
261 case OMAP_DSS_CHANNEL_LCD3
:
269 static inline u16
DISPC_DATA_CYCLE3(enum omap_channel channel
)
272 case OMAP_DSS_CHANNEL_LCD
:
274 case OMAP_DSS_CHANNEL_DIGIT
:
277 case OMAP_DSS_CHANNEL_LCD2
:
279 case OMAP_DSS_CHANNEL_LCD3
:
287 static inline u16
DISPC_CPR_COEF_R(enum omap_channel channel
)
290 case OMAP_DSS_CHANNEL_LCD
:
292 case OMAP_DSS_CHANNEL_DIGIT
:
295 case OMAP_DSS_CHANNEL_LCD2
:
297 case OMAP_DSS_CHANNEL_LCD3
:
305 static inline u16
DISPC_CPR_COEF_G(enum omap_channel channel
)
308 case OMAP_DSS_CHANNEL_LCD
:
310 case OMAP_DSS_CHANNEL_DIGIT
:
313 case OMAP_DSS_CHANNEL_LCD2
:
315 case OMAP_DSS_CHANNEL_LCD3
:
323 static inline u16
DISPC_CPR_COEF_B(enum omap_channel channel
)
326 case OMAP_DSS_CHANNEL_LCD
:
328 case OMAP_DSS_CHANNEL_DIGIT
:
331 case OMAP_DSS_CHANNEL_LCD2
:
333 case OMAP_DSS_CHANNEL_LCD3
:
341 /* DISPC overlay register base addresses */
342 static inline u16
DISPC_OVL_BASE(enum omap_plane_id plane
)
347 case OMAP_DSS_VIDEO1
:
349 case OMAP_DSS_VIDEO2
:
351 case OMAP_DSS_VIDEO3
:
361 /* DISPC overlay register offsets */
362 static inline u16
DISPC_BA0_OFFSET(enum omap_plane_id plane
)
366 case OMAP_DSS_VIDEO1
:
367 case OMAP_DSS_VIDEO2
:
369 case OMAP_DSS_VIDEO3
:
378 static inline u16
DISPC_BA1_OFFSET(enum omap_plane_id plane
)
382 case OMAP_DSS_VIDEO1
:
383 case OMAP_DSS_VIDEO2
:
385 case OMAP_DSS_VIDEO3
:
394 static inline u16
DISPC_BA0_UV_OFFSET(enum omap_plane_id plane
)
400 case OMAP_DSS_VIDEO1
:
402 case OMAP_DSS_VIDEO2
:
404 case OMAP_DSS_VIDEO3
:
414 static inline u16
DISPC_BA1_UV_OFFSET(enum omap_plane_id plane
)
420 case OMAP_DSS_VIDEO1
:
422 case OMAP_DSS_VIDEO2
:
424 case OMAP_DSS_VIDEO3
:
434 static inline u16
DISPC_POS_OFFSET(enum omap_plane_id plane
)
438 case OMAP_DSS_VIDEO1
:
439 case OMAP_DSS_VIDEO2
:
441 case OMAP_DSS_VIDEO3
:
449 static inline u16
DISPC_SIZE_OFFSET(enum omap_plane_id plane
)
453 case OMAP_DSS_VIDEO1
:
454 case OMAP_DSS_VIDEO2
:
456 case OMAP_DSS_VIDEO3
:
465 static inline u16
DISPC_ATTR_OFFSET(enum omap_plane_id plane
)
470 case OMAP_DSS_VIDEO1
:
471 case OMAP_DSS_VIDEO2
:
473 case OMAP_DSS_VIDEO3
:
482 static inline u16
DISPC_ATTR2_OFFSET(enum omap_plane_id plane
)
488 case OMAP_DSS_VIDEO1
:
490 case OMAP_DSS_VIDEO2
:
492 case OMAP_DSS_VIDEO3
:
502 static inline u16
DISPC_FIFO_THRESH_OFFSET(enum omap_plane_id plane
)
507 case OMAP_DSS_VIDEO1
:
508 case OMAP_DSS_VIDEO2
:
510 case OMAP_DSS_VIDEO3
:
519 static inline u16
DISPC_FIFO_SIZE_STATUS_OFFSET(enum omap_plane_id plane
)
524 case OMAP_DSS_VIDEO1
:
525 case OMAP_DSS_VIDEO2
:
527 case OMAP_DSS_VIDEO3
:
536 static inline u16
DISPC_ROW_INC_OFFSET(enum omap_plane_id plane
)
541 case OMAP_DSS_VIDEO1
:
542 case OMAP_DSS_VIDEO2
:
544 case OMAP_DSS_VIDEO3
:
553 static inline u16
DISPC_PIX_INC_OFFSET(enum omap_plane_id plane
)
558 case OMAP_DSS_VIDEO1
:
559 case OMAP_DSS_VIDEO2
:
561 case OMAP_DSS_VIDEO3
:
570 static inline u16
DISPC_WINDOW_SKIP_OFFSET(enum omap_plane_id plane
)
575 case OMAP_DSS_VIDEO1
:
576 case OMAP_DSS_VIDEO2
:
577 case OMAP_DSS_VIDEO3
:
586 static inline u16
DISPC_TABLE_BA_OFFSET(enum omap_plane_id plane
)
591 case OMAP_DSS_VIDEO1
:
592 case OMAP_DSS_VIDEO2
:
593 case OMAP_DSS_VIDEO3
:
602 static inline u16
DISPC_FIR_OFFSET(enum omap_plane_id plane
)
608 case OMAP_DSS_VIDEO1
:
609 case OMAP_DSS_VIDEO2
:
611 case OMAP_DSS_VIDEO3
:
620 static inline u16
DISPC_FIR2_OFFSET(enum omap_plane_id plane
)
626 case OMAP_DSS_VIDEO1
:
628 case OMAP_DSS_VIDEO2
:
630 case OMAP_DSS_VIDEO3
:
640 static inline u16
DISPC_PIC_SIZE_OFFSET(enum omap_plane_id plane
)
646 case OMAP_DSS_VIDEO1
:
647 case OMAP_DSS_VIDEO2
:
649 case OMAP_DSS_VIDEO3
:
659 static inline u16
DISPC_ACCU0_OFFSET(enum omap_plane_id plane
)
665 case OMAP_DSS_VIDEO1
:
666 case OMAP_DSS_VIDEO2
:
668 case OMAP_DSS_VIDEO3
:
677 static inline u16
DISPC_ACCU2_0_OFFSET(enum omap_plane_id plane
)
683 case OMAP_DSS_VIDEO1
:
685 case OMAP_DSS_VIDEO2
:
687 case OMAP_DSS_VIDEO3
:
697 static inline u16
DISPC_ACCU1_OFFSET(enum omap_plane_id plane
)
703 case OMAP_DSS_VIDEO1
:
704 case OMAP_DSS_VIDEO2
:
706 case OMAP_DSS_VIDEO3
:
715 static inline u16
DISPC_ACCU2_1_OFFSET(enum omap_plane_id plane
)
721 case OMAP_DSS_VIDEO1
:
723 case OMAP_DSS_VIDEO2
:
725 case OMAP_DSS_VIDEO3
:
735 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
736 static inline u16
DISPC_FIR_COEF_H_OFFSET(enum omap_plane_id plane
, u16 i
)
742 case OMAP_DSS_VIDEO1
:
743 case OMAP_DSS_VIDEO2
:
744 return 0x0034 + i
* 0x8;
745 case OMAP_DSS_VIDEO3
:
747 return 0x0010 + i
* 0x8;
754 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
755 static inline u16
DISPC_FIR_COEF_H2_OFFSET(enum omap_plane_id plane
, u16 i
)
761 case OMAP_DSS_VIDEO1
:
762 return 0x058C + i
* 0x8;
763 case OMAP_DSS_VIDEO2
:
764 return 0x0568 + i
* 0x8;
765 case OMAP_DSS_VIDEO3
:
766 return 0x0430 + i
* 0x8;
768 return 0x02A0 + i
* 0x8;
775 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
776 static inline u16
DISPC_FIR_COEF_HV_OFFSET(enum omap_plane_id plane
, u16 i
)
782 case OMAP_DSS_VIDEO1
:
783 case OMAP_DSS_VIDEO2
:
784 return 0x0038 + i
* 0x8;
785 case OMAP_DSS_VIDEO3
:
787 return 0x0014 + i
* 0x8;
794 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
795 static inline u16
DISPC_FIR_COEF_HV2_OFFSET(enum omap_plane_id plane
, u16 i
)
801 case OMAP_DSS_VIDEO1
:
802 return 0x0590 + i
* 8;
803 case OMAP_DSS_VIDEO2
:
804 return 0x056C + i
* 0x8;
805 case OMAP_DSS_VIDEO3
:
806 return 0x0434 + i
* 0x8;
808 return 0x02A4 + i
* 0x8;
815 /* coef index i = {0, 1, 2, 3, 4,} */
816 static inline u16
DISPC_CONV_COEF_OFFSET(enum omap_plane_id plane
, u16 i
)
822 case OMAP_DSS_VIDEO1
:
823 case OMAP_DSS_VIDEO2
:
824 case OMAP_DSS_VIDEO3
:
826 return 0x0074 + i
* 0x4;
833 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
834 static inline u16
DISPC_FIR_COEF_V_OFFSET(enum omap_plane_id plane
, u16 i
)
840 case OMAP_DSS_VIDEO1
:
841 return 0x0124 + i
* 0x4;
842 case OMAP_DSS_VIDEO2
:
843 return 0x00B4 + i
* 0x4;
844 case OMAP_DSS_VIDEO3
:
846 return 0x0050 + i
* 0x4;
853 /* coef index i = {0, 1, 2, 3, 4, 5, 6, 7} */
854 static inline u16
DISPC_FIR_COEF_V2_OFFSET(enum omap_plane_id plane
, u16 i
)
860 case OMAP_DSS_VIDEO1
:
861 return 0x05CC + i
* 0x4;
862 case OMAP_DSS_VIDEO2
:
863 return 0x05A8 + i
* 0x4;
864 case OMAP_DSS_VIDEO3
:
865 return 0x0470 + i
* 0x4;
867 return 0x02E0 + i
* 0x4;
874 static inline u16
DISPC_PRELOAD_OFFSET(enum omap_plane_id plane
)
879 case OMAP_DSS_VIDEO1
:
881 case OMAP_DSS_VIDEO2
:
883 case OMAP_DSS_VIDEO3
:
891 static inline u16
DISPC_MFLAG_THRESHOLD_OFFSET(enum omap_plane_id plane
)
896 case OMAP_DSS_VIDEO1
:
898 case OMAP_DSS_VIDEO2
:
900 case OMAP_DSS_VIDEO3
: