coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dp_intf.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SOC_MEDIATEK_MT8195_DP_INTF_H
4 #define SOC_MEDIATEK_MT8195_DP_INTF_H
5 
6 #include <edid.h>
7 
8 #define DPINTF_EN 0x00
9 #define EN BIT(0)
10 
11 #define DPINTF_RET 0x04
12 #define RST BIT(0)
13 #define RST_SEL BIT(16)
14 
15 #define DPINTF_INTEN 0x08
16 #define INT_VSYNC_EN BIT(0)
17 #define INT_VDE_EN BIT(1)
18 #define INT_UNDERFLOW_EN BIT(2)
19 #define INT_TARGET_LINE_EN BIT(3)
20 
21 #define DPINTF_INTSTA 0x0C
22 #define INT_VSYNC_STA BIT(0)
23 #define INT_VDE_STA BIT(1)
24 #define INT_UNDERFLOW_STA BIT(2)
25 #define INT_TARGET_LINE_STA BIT(3)
26 
27 #define DPINTF_CON 0x10
28 #define BG_ENABLE BIT(0)
29 #define INTL_EN BIT(2)
30 #define TDFP_EN BIT(3)
31 #define VS_LODD_EN BIT(16)
32 #define VS_LEVEN_EN BIT(17)
33 #define VS_RODD_EN BIT(18)
34 #define VS_REVEN BIT(19)
35 #define FAKE_DE_LODD BIT(20)
36 #define FAKE_DE_LEVEN BIT(21)
37 #define FAKE_DE_RODD BIT(22)
38 #define FAKE_DE_REVEN BIT(23)
39 #define YUV422_EN BIT(24)
40 #define CLPF_EN BIT(25)
41 #define MATRIX_EN BIT(26)
42 #define INTERNAL_CG_EN BIT(27)
43 #define LOWPOWER_EN BIT(28)
44 #define INPUT_2P_EN BIT(29)
45 #define EXT_VSYNC_EN BIT(30)
46 
47 #define DPINTF_OUTPUT_SETTING 0x14
48 #define PIXEL_SWAP BIT(0)
49 #define CH_SWAP BIT(1)
50 #define CH_SWAP_MASK (0x7 << 1)
51 #define SWAP_RGB (0x00 << 1)
52 #define SWAP_GBR (0x01 << 1)
53 #define SWAP_BRG (0x02 << 1)
54 #define SWAP_RBG (0x03 << 1)
55 #define SWAP_GRB (0x04 << 1)
56 #define SWAP_BGR (0x05 << 1)
57 #define B_MASK BIT(4)
58 #define G_MASK BIT(5)
59 #define R_MASK BIT(6)
60 #define DE_MASK BIT(8)
61 #define HS_MASK BIT(9)
62 #define VS_MASK BIT(10)
63 #define HSYNC_POL BIT(13)
64 #define VSYNC_POL BIT(14)
65 #define OUT_BIT BIT(16)
66 #define OUT_BIT_MASK (0x3 << 18)
67 #define OUT_BIT_8 (0x00 << 18)
68 #define OUT_BIT_10 (0x01 << 18)
69 #define OUT_BIT_12 (0x02 << 18)
70 #define OUT_BIT_16 (0x03 << 18)
71 
72 #define DPINTF_SIZE 0x18
73 #define HSIZE 0
74 #define HSIZE_MASK (0xffff << 0)
75 #define VSIZE 16
76 #define VSIZE_MASK (0xffff << 16)
77 
78 #define DPINTF_TGEN_HWIDTH 0x20
79 #define HPW 0
80 #define HPW_MASK (0xffff << 0)
81 
82 #define DPINTF_TGEN_HPORCH 0x24
83 #define HBP 0
84 #define HBP_MASK (0xffff << 0)
85 #define HFP 16
86 #define HFP_MASK (0xffff << 16)
87 
88 #define DPINTF_TGEN_VWIDTH 0x28
89 #define VSYNC_WIDTH_SHIFT 0
90 #define VSYNC_WIDTH_MASK (0xffff << 0)
91 #define VSYNC_HALF_LINE_SHIFT 16
92 #define VSYNC_HALF_LINE_MASK BIT(16)
93 
94 
95 #define DPINTF_TGEN_VPORCH 0x2C
96 #define VSYNC_BACK_PORCH_SHIFT 0
97 #define VSYNC_BACK_PORCH_MASK (0xffff << 0)
98 #define VSYNC_FRONT_PORCH_SHIFT 16
99 #define VSYNC_FRONT_PORCH_MASK (0xffff << 16)
100 
101 #define DPINTF_BG_HCNTL 0x30
102 #define BG_RIGHT (0xffff << 0)
103 #define BG_LEFT (0xffff << 16)
104 
105 #define DPINTF_BG_VCNTL 0x34
106 #define BG_BOT (0xffff << 0)
107 #define BG_TOP (0xffff << 16)
108 
109 #define DPINTF_BG_COLOR 0x38
110 #define BG_B (0x3ff << 0)
111 #define BG_G (0x3ff << 10)
112 #define BG_R (0x3ff << 20)
113 
114 #define DPINTF_FIFO_CTL 0x3C
115 #define FIFO_VALID_SET (0x1F << 0)
116 #define FIFO_RST_SEL BIT(8)
117 #define FIFO_RD_MASK BIT(12)
118 
119 #define DPINTF_STATUS 0x40
120 #define VCOUNTER (0x3ffff << 0)
121 #define DPINTF_BUSY BIT(24)
122 #define FIELD BIT(28)
123 #define TDLR BIT(29)
124 
125 #define DPINTF_TGEN_VWIDTH_LEVEN 0x68
126 #define DPINTF_TGEN_VPORCH_LEVEN 0x6C
127 #define DPINTF_TGEN_VWIDTH_RODD 0x70
128 #define DPINTF_TGEN_VPORCH_RODD 0x74
129 #define DPINTF_TGEN_VWIDTH_REVEN 0x78
130 #define DPINTF_TGEN_VPORCH_REVEN 0x7C
131 
132 #define DPINTF_CLPF_SETTING 0x94
133 #define CLPF_TYPE (0x3 << 0)
134 #define ROUND_EN BIT(4)
135 
136 #define DPINTF_Y_LIMIT 0x98
137 #define Y_LIMINT_BOT 0
138 #define Y_LIMINT_BOT_MASK (0xFFF << 0)
139 #define Y_LIMINT_TOP 16
140 #define Y_LIMINT_TOP_MASK (0xFFF << 16)
141 
142 #define DPINTF_C_LIMIT 0x9C
143 #define C_LIMIT_BOT 0
144 #define C_LIMIT_BOT_MASK (0xFFF << 0)
145 #define C_LIMIT_TOP 16
146 #define C_LIMIT_TOP_MASK (0xFFF << 16)
147 
148 #define DPINTF_YUV422_SETTING 0xA0
149 #define UV_SWAP BIT(0)
150 #define CR_DELSEL BIT(4)
151 #define CB_DELSEL BIT(5)
152 #define Y_DELSEL BIT(6)
153 #define DE_DELSEL BIT(7)
154 
155 #define DPINTF_MATRIX_SET 0xB4
156 #define INT_MATRIX_SEL_MASK 0x1f
157 #define RGB_TO_JPEG 0x00
158 #define RGB_TO_FULL709 0x01
159 #define RGB_TO_BT601 0x02
160 #define RGB_TO_BT709 0x03
161 #define JPEG_TO_RGB 0x04
162 #define FULL709_TO_RGB 0x05
163 #define BT601_TO_RGB 0x06
164 #define BT709_TO_RGB 0x07
165 #define JPEG_TO_BT601 0x08
166 #define JPEG_TO_BT709 0x09
167 #define BT601_TO_JPEG 0xA
168 #define BT709_TO_JPEG 0xB
169 #define BT709_TO_BT601 0xC
170 #define BT601_TO_BT709 0xD
171 #define JPEG_TO_CERGB 0x14
172 #define FULL709_TO_CERGB 0x15
173 #define BT601_TO_CERGB 0x16
174 #define BT709_TO_CERGB 0x17
175 #define RGB_TO_CERGB 0x1C
176 
177 #define MATRIX_BIT_MASK (0x3 << 8)
178 #define EXT_MATRIX_EN BIT(12)
179 
185 };
186 
193 };
194 
202 };
203 
212 };
213 
220 };
221 
222 struct mtk_dpintf {
223  void *regs;
228 };
229 
233 };
234 
240 };
241 
247 };
248 
254 };
255 
256 void dp_intf_config(const struct edid *edid);
257 
258 #endif /* SOC_MEDIATEK_MT8195_DP_INTF_H */
mtk_dpintf_polarity
Definition: dp_intf.h:230
@ MTK_DPINTF_POLARITY_RISING
Definition: dp_intf.h:231
@ MTK_DPINTF_POLARITY_FALLING
Definition: dp_intf.h:232
mtk_dpintf_out_color_format
Definition: dp_intf.h:204
@ MTK_DPINTF_COLOR_FORMAT_YCBCR_444_FULL
Definition: dp_intf.h:210
@ MTK_DPINTF_COLOR_FORMAT_YCBCR_422
Definition: dp_intf.h:208
@ MTK_DPINTF_COLOR_FORMAT_XV_YCC
Definition: dp_intf.h:209
@ MTK_DPINTF_COLOR_FORMAT_RGB
Definition: dp_intf.h:205
@ MTK_DPINTF_COLOR_FORMAT_YCBCR_444
Definition: dp_intf.h:207
@ MTK_DPINTF_COLOR_FORMAT_YCBCR_422_FULL
Definition: dp_intf.h:211
@ MTK_DPINTF_COLOR_FORMAT_RGB_FULL
Definition: dp_intf.h:206
void dp_intf_config(const struct edid *edid)
Definition: dp_intf.c:293
mtk_dpintf_out_channel_swap
Definition: dp_intf.h:195
@ MTK_DPINTF_OUT_CHANNEL_SWAP_GRB
Definition: dp_intf.h:200
@ MTK_DPINTF_OUT_CHANNEL_SWAP_BGR
Definition: dp_intf.h:201
@ MTK_DPINTF_OUT_CHANNEL_SWAP_RBG
Definition: dp_intf.h:199
@ MTK_DPINTF_OUT_CHANNEL_SWAP_GBR
Definition: dp_intf.h:197
@ MTK_DPINTF_OUT_CHANNEL_SWAP_RGB
Definition: dp_intf.h:196
@ MTK_DPINTF_OUT_CHANNEL_SWAP_BRG
Definition: dp_intf.h:198
TVDPLL_CLK
Definition: dp_intf.h:214
@ TVDPLL_D4
Definition: dp_intf.h:217
@ TVDPLL_D2
Definition: dp_intf.h:216
@ TVDPLL_D16
Definition: dp_intf.h:219
@ TVDPLL_PLL
Definition: dp_intf.h:215
@ TVDPLL_D8
Definition: dp_intf.h:218
mtk_dpintf_out_bit_num
Definition: dp_intf.h:180
@ MTK_DPINTF_OUT_BIT_NUM_16BITS
Definition: dp_intf.h:184
@ MTK_DPINTF_OUT_BIT_NUM_12BITS
Definition: dp_intf.h:183
@ MTK_DPINTF_OUT_BIT_NUM_10BITS
Definition: dp_intf.h:182
@ MTK_DPINTF_OUT_BIT_NUM_8BITS
Definition: dp_intf.h:181
mtk_dpintf_out_yc_map
Definition: dp_intf.h:187
@ MTK_DPINTF_OUT_YC_MAP_YCYC
Definition: dp_intf.h:190
@ MTK_DPINTF_OUT_YC_MAP_YC
Definition: dp_intf.h:192
@ MTK_DPINTF_OUT_YC_MAP_CYCY
Definition: dp_intf.h:189
@ MTK_DPINTF_OUT_YC_MAP_CY
Definition: dp_intf.h:191
@ MTK_DPINTF_OUT_YC_MAP_RGB
Definition: dp_intf.h:188
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
Definition: edid.h:49
enum mtk_dpintf_polarity vsync_pol
Definition: dp_intf.h:239
enum mtk_dpintf_polarity de_pol
Definition: dp_intf.h:236
enum mtk_dpintf_polarity ck_pol
Definition: dp_intf.h:237
enum mtk_dpintf_polarity hsync_pol
Definition: dp_intf.h:238
enum mtk_dpintf_out_bit_num bit_num
Definition: dp_intf.h:226
enum mtk_dpintf_out_yc_map yc_map
Definition: dp_intf.h:225
enum mtk_dpintf_out_color_format color_format
Definition: dp_intf.h:224
void * regs
Definition: dp_intf.h:223
enum mtk_dpintf_out_channel_swap channel_swap
Definition: dp_intf.h:227