1 #ifndef _MSM_HDMI_MODES_H__
2 #define _MSM_HDMI_MODES_H__
3 #include <linux/types.h>
4 #include <linux/errno.h>
5 
6 #define MSM_HDMI_RGB_888_24BPP_FORMAT       (1 << 0)
7 #define MSM_HDMI_YUV_420_12BPP_FORMAT       (1 << 1)
8 
9 enum aspect_ratio {
10 	HDMI_RES_AR_INVALID,
11 	HDMI_RES_AR_4_3,
12 	HDMI_RES_AR_5_4,
13 	HDMI_RES_AR_16_9,
14 	HDMI_RES_AR_16_10,
15 	HDMI_RES_AR_64_27,
16 	HDMI_RES_AR_256_135,
17 	HDMI_RES_AR_MAX,
18 };
19 
20 enum msm_hdmi_s3d_mode {
21 	HDMI_S3D_NONE,
22 	HDMI_S3D_SIDE_BY_SIDE,
23 	HDMI_S3D_TOP_AND_BOTTOM,
24 	HDMI_S3D_FRAME_PACKING,
25 	HDMI_S3D_MAX,
26 };
27 
28 struct msm_hdmi_mode_timing_info {
29 	uint32_t	video_format;
30 	uint32_t	active_h;
31 	uint32_t	front_porch_h;
32 	uint32_t	pulse_width_h;
33 	uint32_t	back_porch_h;
34 	uint32_t	active_low_h;
35 	uint32_t	active_v;
36 	uint32_t	front_porch_v;
37 	uint32_t	pulse_width_v;
38 	uint32_t	back_porch_v;
39 	uint32_t	active_low_v;
40 	/* Must divide by 1000 to get the actual frequency in MHZ */
41 	uint32_t	pixel_freq;
42 	/* Must divide by 1000 to get the actual frequency in HZ */
43 	uint32_t	refresh_rate;
44 	uint32_t	interlaced;
45 	uint32_t	supported;
46 	enum aspect_ratio ar;
47 	/* Flags indicating support for specific pixel formats */
48 	uint32_t        pixel_formats;
49 };
50 
51 #define MSM_HDMI_INIT_RES_PAGE          1
52 
53 #define MSM_HDMI_MODES_CEA		(1 << 0)
54 #define MSM_HDMI_MODES_XTND		(1 << 1)
55 #define MSM_HDMI_MODES_DVI		(1 << 2)
56 #define MSM_HDMI_MODES_ALL		(MSM_HDMI_MODES_CEA |\
57 					 MSM_HDMI_MODES_XTND |\
58 					 MSM_HDMI_MODES_DVI)
59 
60 /* all video formats defined by CEA 861D */
61 #define HDMI_VFRMT_UNKNOWN		0
62 #define HDMI_VFRMT_640x480p60_4_3	1
63 #define HDMI_VFRMT_720x480p60_4_3	2
64 #define HDMI_VFRMT_720x480p60_16_9	3
65 #define HDMI_VFRMT_1280x720p60_16_9	4
66 #define HDMI_VFRMT_1920x1080i60_16_9	5
67 #define HDMI_VFRMT_720x480i60_4_3	6
68 #define HDMI_VFRMT_1440x480i60_4_3	HDMI_VFRMT_720x480i60_4_3
69 #define HDMI_VFRMT_720x480i60_16_9	7
70 #define HDMI_VFRMT_1440x480i60_16_9	HDMI_VFRMT_720x480i60_16_9
71 #define HDMI_VFRMT_720x240p60_4_3	8
72 #define HDMI_VFRMT_1440x240p60_4_3	HDMI_VFRMT_720x240p60_4_3
73 #define HDMI_VFRMT_720x240p60_16_9	9
74 #define HDMI_VFRMT_1440x240p60_16_9	HDMI_VFRMT_720x240p60_16_9
75 #define HDMI_VFRMT_2880x480i60_4_3	10
76 #define HDMI_VFRMT_2880x480i60_16_9	11
77 #define HDMI_VFRMT_2880x240p60_4_3	12
78 #define HDMI_VFRMT_2880x240p60_16_9	13
79 #define HDMI_VFRMT_1440x480p60_4_3	14
80 #define HDMI_VFRMT_1440x480p60_16_9	15
81 #define HDMI_VFRMT_1920x1080p60_16_9	16
82 #define HDMI_VFRMT_720x576p50_4_3	17
83 #define HDMI_VFRMT_720x576p50_16_9	18
84 #define HDMI_VFRMT_1280x720p50_16_9	19
85 #define HDMI_VFRMT_1920x1080i50_16_9	20
86 #define HDMI_VFRMT_720x576i50_4_3	21
87 #define HDMI_VFRMT_1440x576i50_4_3	HDMI_VFRMT_720x576i50_4_3
88 #define HDMI_VFRMT_720x576i50_16_9	22
89 #define HDMI_VFRMT_1440x576i50_16_9	HDMI_VFRMT_720x576i50_16_9
90 #define HDMI_VFRMT_720x288p50_4_3	23
91 #define HDMI_VFRMT_1440x288p50_4_3	HDMI_VFRMT_720x288p50_4_3
92 #define HDMI_VFRMT_720x288p50_16_9	24
93 #define HDMI_VFRMT_1440x288p50_16_9	HDMI_VFRMT_720x288p50_16_9
94 #define HDMI_VFRMT_2880x576i50_4_3	25
95 #define HDMI_VFRMT_2880x576i50_16_9	26
96 #define HDMI_VFRMT_2880x288p50_4_3	27
97 #define HDMI_VFRMT_2880x288p50_16_9	28
98 #define HDMI_VFRMT_1440x576p50_4_3	29
99 #define HDMI_VFRMT_1440x576p50_16_9	30
100 #define HDMI_VFRMT_1920x1080p50_16_9	31
101 #define HDMI_VFRMT_1920x1080p24_16_9	32
102 #define HDMI_VFRMT_1920x1080p25_16_9	33
103 #define HDMI_VFRMT_1920x1080p30_16_9	34
104 #define HDMI_VFRMT_2880x480p60_4_3	35
105 #define HDMI_VFRMT_2880x480p60_16_9	36
106 #define HDMI_VFRMT_2880x576p50_4_3	37
107 #define HDMI_VFRMT_2880x576p50_16_9	38
108 #define HDMI_VFRMT_1920x1250i50_16_9	39
109 #define HDMI_VFRMT_1920x1080i100_16_9	40
110 #define HDMI_VFRMT_1280x720p100_16_9	41
111 #define HDMI_VFRMT_720x576p100_4_3	42
112 #define HDMI_VFRMT_720x576p100_16_9	43
113 #define HDMI_VFRMT_720x576i100_4_3	44
114 #define HDMI_VFRMT_1440x576i100_4_3	HDMI_VFRMT_720x576i100_4_3
115 #define HDMI_VFRMT_720x576i100_16_9	45
116 #define HDMI_VFRMT_1440x576i100_16_9	HDMI_VFRMT_720x576i100_16_9
117 #define HDMI_VFRMT_1920x1080i120_16_9	46
118 #define HDMI_VFRMT_1280x720p120_16_9	47
119 #define HDMI_VFRMT_720x480p120_4_3	48
120 #define HDMI_VFRMT_720x480p120_16_9	49
121 #define HDMI_VFRMT_720x480i120_4_3	50
122 #define HDMI_VFRMT_1440x480i120_4_3	HDMI_VFRMT_720x480i120_4_3
123 #define HDMI_VFRMT_720x480i120_16_9	51
124 #define HDMI_VFRMT_1440x480i120_16_9	HDMI_VFRMT_720x480i120_16_9
125 #define HDMI_VFRMT_720x576p200_4_3	52
126 #define HDMI_VFRMT_720x576p200_16_9	53
127 #define HDMI_VFRMT_720x576i200_4_3	54
128 #define HDMI_VFRMT_1440x576i200_4_3	HDMI_VFRMT_720x576i200_4_3
129 #define HDMI_VFRMT_720x576i200_16_9	55
130 #define HDMI_VFRMT_1440x576i200_16_9	HDMI_VFRMT_720x576i200_16_9
131 #define HDMI_VFRMT_720x480p240_4_3	56
132 #define HDMI_VFRMT_720x480p240_16_9	57
133 #define HDMI_VFRMT_720x480i240_4_3	58
134 #define HDMI_VFRMT_1440x480i240_4_3	HDMI_VFRMT_720x480i240_4_3
135 #define HDMI_VFRMT_720x480i240_16_9	59
136 #define HDMI_VFRMT_1440x480i240_16_9	HDMI_VFRMT_720x480i240_16_9
137 #define HDMI_VFRMT_1280x720p24_16_9	60
138 #define HDMI_VFRMT_1280x720p25_16_9	61
139 #define HDMI_VFRMT_1280x720p30_16_9	62
140 #define HDMI_VFRMT_1920x1080p120_16_9	63
141 #define HDMI_VFRMT_1920x1080p100_16_9	64
142 #define HDMI_VFRMT_1280x720p24_64_27    65
143 #define HDMI_VFRMT_1280x720p25_64_27    66
144 #define HDMI_VFRMT_1280x720p30_64_27    67
145 #define HDMI_VFRMT_1280x720p50_64_27    68
146 #define HDMI_VFRMT_1280x720p60_64_27    69
147 #define HDMI_VFRMT_1280x720p100_64_27   70
148 #define HDMI_VFRMT_1280x720p120_64_27   71
149 #define HDMI_VFRMT_1920x1080p24_64_27   72
150 #define HDMI_VFRMT_1920x1080p25_64_27   73
151 #define HDMI_VFRMT_1920x1080p30_64_27   74
152 #define HDMI_VFRMT_1920x1080p50_64_27   75
153 #define HDMI_VFRMT_1920x1080p60_64_27   76
154 #define HDMI_VFRMT_1920x1080p100_64_27  77
155 #define HDMI_VFRMT_1920x1080p120_64_27  78
156 #define HDMI_VFRMT_1680x720p24_64_27    79
157 #define HDMI_VFRMT_1680x720p25_64_27    80
158 #define HDMI_VFRMT_1680x720p30_64_27    81
159 #define HDMI_VFRMT_1680x720p50_64_27    82
160 #define HDMI_VFRMT_1680x720p60_64_27    83
161 #define HDMI_VFRMT_1680x720p100_64_27   84
162 #define HDMI_VFRMT_1680x720p120_64_27   85
163 #define HDMI_VFRMT_2560x1080p24_64_27   86
164 #define HDMI_VFRMT_2560x1080p25_64_27   87
165 #define HDMI_VFRMT_2560x1080p30_64_27   88
166 #define HDMI_VFRMT_2560x1080p50_64_27   89
167 #define HDMI_VFRMT_2560x1080p60_64_27   90
168 #define HDMI_VFRMT_2560x1080p100_64_27  91
169 #define HDMI_VFRMT_2560x1080p120_64_27  92
170 #define HDMI_VFRMT_3840x2160p24_16_9    93
171 #define HDMI_VFRMT_3840x2160p25_16_9    94
172 #define HDMI_VFRMT_3840x2160p30_16_9    95
173 #define HDMI_VFRMT_3840x2160p50_16_9    96
174 #define HDMI_VFRMT_3840x2160p60_16_9    97
175 #define HDMI_VFRMT_4096x2160p24_256_135 98
176 #define HDMI_VFRMT_4096x2160p25_256_135 99
177 #define HDMI_VFRMT_4096x2160p30_256_135 100
178 #define HDMI_VFRMT_4096x2160p50_256_135 101
179 #define HDMI_VFRMT_4096x2160p60_256_135 102
180 #define HDMI_VFRMT_3840x2160p24_64_27   103
181 #define HDMI_VFRMT_3840x2160p25_64_27   104
182 #define HDMI_VFRMT_3840x2160p30_64_27   105
183 #define HDMI_VFRMT_3840x2160p50_64_27   106
184 #define HDMI_VFRMT_3840x2160p60_64_27   107
185 
186 /* Video Identification Codes from 107-127 are reserved for the future */
187 #define HDMI_VFRMT_END			127
188 
189 #define EVFRMT_OFF(x)			(HDMI_VFRMT_END + x)
190 
191 /* extended video formats */
192 #define HDMI_EVFRMT_3840x2160p30_16_9	EVFRMT_OFF(1)
193 #define HDMI_EVFRMT_3840x2160p25_16_9	EVFRMT_OFF(2)
194 #define HDMI_EVFRMT_3840x2160p24_16_9	EVFRMT_OFF(3)
195 #define HDMI_EVFRMT_4096x2160p24_16_9	EVFRMT_OFF(4)
196 #define HDMI_EVFRMT_END			HDMI_EVFRMT_4096x2160p24_16_9
197 
198 #define WQXGA_OFF(x)			(HDMI_EVFRMT_END + x)
199 
200 /* WQXGA */
201 #define HDMI_VFRMT_2560x1600p60_16_9	WQXGA_OFF(1)
202 #define HDMI_WQXGAFRMT_END		HDMI_VFRMT_2560x1600p60_16_9
203 
204 #define WXGA_OFF(x)			(HDMI_WQXGAFRMT_END + x)
205 
206 /* WXGA */
207 #define HDMI_VFRMT_1280x800p60_16_10	WXGA_OFF(1)
208 #define HDMI_VFRMT_1366x768p60_16_10	WXGA_OFF(2)
209 #define HDMI_WXGAFRMT_END		HDMI_VFRMT_1366x768p60_16_10
210 
211 #define ETI_OFF(x)			(HDMI_WXGAFRMT_END + x)
212 
213 /* ESTABLISHED TIMINGS I */
214 #define HDMI_VFRMT_800x600p60_4_3	ETI_OFF(1)
215 #define ETI_VFRMT_END			HDMI_VFRMT_800x600p60_4_3
216 
217 #define ETII_OFF(x)			(ETI_VFRMT_END + x)
218 
219 /* ESTABLISHED TIMINGS II */
220 #define HDMI_VFRMT_1024x768p60_4_3	ETII_OFF(1)
221 #define HDMI_VFRMT_1280x1024p60_5_4	ETII_OFF(2)
222 #define ETII_VFRMT_END			HDMI_VFRMT_1280x1024p60_5_4
223 
224 #define ETIII_OFF(x)			(ETII_VFRMT_END + x)
225 
226 /* ESTABLISHED TIMINGS III */
227 #define HDMI_VFRMT_848x480p60_16_9	ETIII_OFF(1)
228 #define HDMI_VFRMT_1280x960p60_4_3	ETIII_OFF(2)
229 #define HDMI_VFRMT_1360x768p60_16_9	ETIII_OFF(3)
230 #define HDMI_VFRMT_1440x900p60_16_10	ETIII_OFF(4)
231 #define HDMI_VFRMT_1400x1050p60_4_3	ETIII_OFF(5)
232 #define HDMI_VFRMT_1680x1050p60_16_10	ETIII_OFF(6)
233 #define HDMI_VFRMT_1600x1200p60_4_3	ETIII_OFF(7)
234 #define HDMI_VFRMT_1920x1200p60_16_10	ETIII_OFF(8)
235 #define ETIII_VFRMT_END			HDMI_VFRMT_1920x1200p60_16_10
236 
237 #define RESERVE_OFF(x)			(ETIII_VFRMT_END + x)
238 
239 #define HDMI_VFRMT_RESERVE1		RESERVE_OFF(1)
240 #define HDMI_VFRMT_RESERVE2		RESERVE_OFF(2)
241 #define HDMI_VFRMT_RESERVE3		RESERVE_OFF(3)
242 #define HDMI_VFRMT_RESERVE4		RESERVE_OFF(4)
243 #define HDMI_VFRMT_RESERVE5		RESERVE_OFF(5)
244 #define HDMI_VFRMT_RESERVE6		RESERVE_OFF(6)
245 #define HDMI_VFRMT_RESERVE7		RESERVE_OFF(7)
246 #define HDMI_VFRMT_RESERVE8		RESERVE_OFF(8)
247 #define RESERVE_VFRMT_END		HDMI_VFRMT_RESERVE8
248 
249 #define HDMI_VFRMT_MAX			(RESERVE_VFRMT_END + 1)
250 
251 /* Timing information for supported modes */
252 #define VFRMT_NOT_SUPPORTED(VFRMT) \
253 	{VFRMT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,		\
254 		HDMI_RES_AR_INVALID}
255 
256 #define HDMI_VFRMT_640x480p60_4_3_TIMING				\
257 	{HDMI_VFRMT_640x480p60_4_3, 640, 16, 96, 48, true,		\
258 	 480, 10, 2, 33, true, 25200, 60000, false, true, HDMI_RES_AR_4_3, 0}
259 #define HDMI_VFRMT_720x480p60_4_3_TIMING				\
260 	{HDMI_VFRMT_720x480p60_4_3, 720, 16, 62, 60, true,		\
261 	 480, 9, 6, 30, true, 27027, 60000, false, true, HDMI_RES_AR_4_3, 0}
262 #define HDMI_VFRMT_720x480p60_16_9_TIMING				\
263 	{HDMI_VFRMT_720x480p60_16_9, 720, 16, 62, 60, true,		\
264 	 480, 9, 6, 30, true, 27027, 60000, false, true, HDMI_RES_AR_16_9, 0}
265 #define HDMI_VFRMT_1280x720p60_16_9_TIMING				\
266 	{HDMI_VFRMT_1280x720p60_16_9, 1280, 110, 40, 220, false,	\
267 	 720, 5, 5, 20, false, 74250, 60000, false, true, HDMI_RES_AR_16_9, 0}
268 #define HDMI_VFRMT_1920x1080i60_16_9_TIMING				\
269 	{HDMI_VFRMT_1920x1080i60_16_9, 1920, 88, 44, 148, false,	\
270 	 540, 2, 5, 5, false, 74250, 60000, false, true, HDMI_RES_AR_16_9, 0}
271 #define HDMI_VFRMT_1440x480i60_4_3_TIMING				\
272 	{HDMI_VFRMT_1440x480i60_4_3, 1440, 38, 124, 114, true,		\
273 	 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_4_3, 0}
274 #define HDMI_VFRMT_1440x480i60_16_9_TIMING				\
275 	{HDMI_VFRMT_1440x480i60_16_9, 1440, 38, 124, 114, true,		\
276 	 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_16_9, 0}
277 #define HDMI_VFRMT_1920x1080p60_16_9_TIMING				\
278 	{HDMI_VFRMT_1920x1080p60_16_9, 1920, 88, 44, 148, false,	\
279 	 1080, 4, 5, 36, false, 148500, 60000, false, true, HDMI_RES_AR_16_9, 0}
280 #define HDMI_VFRMT_720x576p50_4_3_TIMING				\
281 	{HDMI_VFRMT_720x576p50_4_3, 720, 12, 64, 68, true,		\
282 	 576,  5, 5, 39, true, 27000, 50000, false, true, HDMI_RES_AR_4_3, 0}
283 #define HDMI_VFRMT_720x576p50_16_9_TIMING				\
284 	{HDMI_VFRMT_720x576p50_16_9, 720, 12, 64, 68, true,		\
285 	 576,  5, 5, 39, true, 27000, 50000, false, true, HDMI_RES_AR_16_9, 0}
286 #define HDMI_VFRMT_1280x720p50_16_9_TIMING				\
287 	{HDMI_VFRMT_1280x720p50_16_9, 1280, 440, 40, 220, false,	\
288 	 720,  5, 5, 20, false, 74250, 50000, false, true, HDMI_RES_AR_16_9, 0}
289 #define HDMI_VFRMT_1440x576i50_4_3_TIMING				\
290 	{HDMI_VFRMT_1440x576i50_4_3, 1440, 24, 126, 138, true,		\
291 	 288,  2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_4_3, 0}
292 #define HDMI_VFRMT_1440x576i50_16_9_TIMING				\
293 	{HDMI_VFRMT_1440x576i50_16_9, 1440, 24, 126, 138, true,		\
294 	 288,  2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_16_9, 0}
295 #define HDMI_VFRMT_1920x1080p50_16_9_TIMING				\
296 	{HDMI_VFRMT_1920x1080p50_16_9, 1920, 528, 44, 148, false,	\
297 	 1080, 4, 5, 36, false, 148500, 50000, false, true, HDMI_RES_AR_16_9, 0}
298 #define HDMI_VFRMT_1920x1080p24_16_9_TIMING				\
299 	{HDMI_VFRMT_1920x1080p24_16_9, 1920, 638, 44, 148, false,	\
300 	 1080, 4, 5, 36, false, 74250, 24000, false, true, HDMI_RES_AR_16_9, 0}
301 #define HDMI_VFRMT_1920x1080p25_16_9_TIMING				\
302 	{HDMI_VFRMT_1920x1080p25_16_9, 1920, 528, 44, 148, false,	\
303 	 1080, 4, 5, 36, false, 74250, 25000, false, true, HDMI_RES_AR_16_9, 0}
304 #define HDMI_VFRMT_1920x1080p30_16_9_TIMING				\
305 	{HDMI_VFRMT_1920x1080p30_16_9, 1920, 88, 44, 148, false,	\
306 	 1080, 4, 5, 36, false, 74250, 30000, false, true, HDMI_RES_AR_16_9, 0}
307 #define HDMI_VFRMT_1024x768p60_4_3_TIMING                               \
308 	{HDMI_VFRMT_1024x768p60_4_3, 1024, 24, 136, 160, false,         \
309 	768, 2, 6, 29, false, 65000, 60000, false, true, HDMI_RES_AR_4_3, 0}
310 #define HDMI_VFRMT_1280x1024p60_5_4_TIMING				\
311 	{HDMI_VFRMT_1280x1024p60_5_4, 1280, 48, 112, 248, false,	\
312 	1024, 1, 3, 38, false, 108000, 60000, false, true, HDMI_RES_AR_5_4, 0}
313 #define HDMI_VFRMT_2560x1600p60_16_9_TIMING				\
314 	{HDMI_VFRMT_2560x1600p60_16_9, 2560, 48, 32, 80, false,		\
315 	 1600, 3, 6, 37, false, 268500, 60000, false, true, HDMI_RES_AR_16_9, 0}
316 #define HDMI_EVFRMT_3840x2160p30_16_9_TIMING				\
317 	{HDMI_EVFRMT_3840x2160p30_16_9, 3840, 176, 88, 296, false,	\
318 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
319 		HDMI_RES_AR_16_9, 0}
320 #define HDMI_EVFRMT_3840x2160p25_16_9_TIMING				\
321 	{HDMI_EVFRMT_3840x2160p25_16_9, 3840, 1056, 88, 296, false,	\
322 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
323 		HDMI_RES_AR_16_9, 0}
324 #define HDMI_EVFRMT_3840x2160p24_16_9_TIMING				\
325 	{HDMI_EVFRMT_3840x2160p24_16_9, 3840, 1276, 88, 296, false,	\
326 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
327 		HDMI_RES_AR_16_9, 0}
328 #define HDMI_EVFRMT_4096x2160p24_16_9_TIMING				\
329 	{HDMI_EVFRMT_4096x2160p24_16_9, 4096, 1020, 88, 296, false,	\
330 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
331 		HDMI_RES_AR_16_9, 0}
332 
333 #define HDMI_VFRMT_800x600p60_4_3_TIMING				\
334 	{HDMI_VFRMT_800x600p60_4_3, 800, 40, 128, 88, false,	\
335 	 600, 1, 4, 23, false, 40000, 60000, false, true, HDMI_RES_AR_4_3, 0}
336 #define HDMI_VFRMT_848x480p60_16_9_TIMING				\
337 	{HDMI_VFRMT_848x480p60_16_9, 848, 16, 112, 112, false,	\
338 	 480, 6, 8, 23, false, 33750, 60000, false, true, HDMI_RES_AR_16_9, 0}
339 #define HDMI_VFRMT_1280x960p60_4_3_TIMING\
340 	{HDMI_VFRMT_1280x960p60_4_3, 1280, 96, 112, 312, false,	\
341 	 960, 1, 3, 36, false, 108000, 60000, false, true, HDMI_RES_AR_4_3, 0}
342 #define HDMI_VFRMT_1360x768p60_16_9_TIMING\
343 	{HDMI_VFRMT_1360x768p60_16_9, 1360, 64, 112, 256, false,	\
344 	 768, 3, 6, 18, false, 85500, 60000, false, true, HDMI_RES_AR_16_9, 0}
345 #define HDMI_VFRMT_1440x900p60_16_10_TIMING\
346 	{HDMI_VFRMT_1440x900p60_16_10, 1440, 48, 32, 80, false,	\
347 	 900, 3, 6, 17, true, 88750, 60000, false, true, HDMI_RES_AR_16_10, 0}
348 #define HDMI_VFRMT_1400x1050p60_4_3_TIMING\
349 	{HDMI_VFRMT_1400x1050p60_4_3, 1400, 48, 32, 80, false,	\
350 	 1050, 3, 4, 23, true, 101000, 60000, false, true, HDMI_RES_AR_4_3, 0}
351 #define HDMI_VFRMT_1680x1050p60_16_10_TIMING\
352 	{HDMI_VFRMT_1680x1050p60_16_10, 1680, 48, 32, 80, false,	\
353 	 1050, 3, 6, 21, true, 119000, 60000, false, true, HDMI_RES_AR_16_10, 0}
354 #define HDMI_VFRMT_1600x1200p60_4_3_TIMING\
355 	{HDMI_VFRMT_1600x1200p60_4_3, 1600, 64, 192, 304, false,	\
356 	 1200, 1, 3, 46, false, 162000, 60000, false, true, HDMI_RES_AR_4_3, 0}
357 #define HDMI_VFRMT_1920x1200p60_16_10_TIMING\
358 	{HDMI_VFRMT_1920x1200p60_16_10, 1920, 48, 32, 80, false,\
359 	 1200, 3, 6, 26, true, 154000, 60000, false, true, HDMI_RES_AR_16_10, 0}
360 #define HDMI_VFRMT_1366x768p60_16_10_TIMING\
361 	{HDMI_VFRMT_1366x768p60_16_10, 1366, 70, 143, 213, false,\
362 	 768, 3, 3, 24, false, 85500, 60000, false, true, HDMI_RES_AR_16_10, 0}
363 #define HDMI_VFRMT_1280x800p60_16_10_TIMING\
364 	{HDMI_VFRMT_1280x800p60_16_10, 1280, 72, 128, 200, true,\
365 	 800, 3, 6, 22, false, 83500, 60000, false, true, HDMI_RES_AR_16_10, 0}
366 #define HDMI_VFRMT_3840x2160p24_16_9_TIMING                             \
367 	{HDMI_VFRMT_3840x2160p24_16_9, 3840, 1276, 88, 296, false,      \
368 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
369 		HDMI_RES_AR_16_9, 0}
370 #define HDMI_VFRMT_3840x2160p25_16_9_TIMING                             \
371 	{HDMI_VFRMT_3840x2160p25_16_9, 3840, 1056, 88, 296, false,      \
372 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
373 		HDMI_RES_AR_16_9, 0}
374 #define HDMI_VFRMT_3840x2160p30_16_9_TIMING                             \
375 	{HDMI_VFRMT_3840x2160p30_16_9, 3840, 176, 88, 296, false,       \
376 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
377 		HDMI_RES_AR_16_9, 0}
378 #define HDMI_VFRMT_3840x2160p50_16_9_TIMING                             \
379 	{HDMI_VFRMT_3840x2160p50_16_9, 3840, 1056, 88, 296, false,      \
380 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
381 		HDMI_RES_AR_16_9, 0}
382 #define HDMI_VFRMT_3840x2160p60_16_9_TIMING                             \
383 	{HDMI_VFRMT_3840x2160p60_16_9, 3840, 176, 88, 296, false,       \
384 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
385 		HDMI_RES_AR_16_9, 0}
386 
387 #define HDMI_VFRMT_4096x2160p24_256_135_TIMING                          \
388 	{HDMI_VFRMT_4096x2160p24_256_135, 4096, 1020, 88, 296, false,   \
389 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
390 		HDMI_RES_AR_256_135, 0}
391 #define HDMI_VFRMT_4096x2160p25_256_135_TIMING                          \
392 	{HDMI_VFRMT_4096x2160p25_256_135, 4096, 968, 88, 128, false,    \
393 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
394 		HDMI_RES_AR_256_135, 0}
395 #define HDMI_VFRMT_4096x2160p30_256_135_TIMING                          \
396 	{HDMI_VFRMT_4096x2160p30_256_135, 4096, 88, 88, 128, false,     \
397 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
398 		HDMI_RES_AR_256_135, 0}
399 #define HDMI_VFRMT_4096x2160p50_256_135_TIMING                          \
400 	{HDMI_VFRMT_4096x2160p50_256_135, 4096, 968, 88, 128, false,    \
401 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
402 		HDMI_RES_AR_256_135, 0}
403 #define HDMI_VFRMT_4096x2160p60_256_135_TIMING                          \
404 	{HDMI_VFRMT_4096x2160p60_256_135, 4096, 88, 88, 128, false,     \
405 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
406 		HDMI_RES_AR_256_135, 0}
407 
408 #define HDMI_VFRMT_3840x2160p24_64_27_TIMING                             \
409 	{HDMI_VFRMT_3840x2160p24_64_27, 3840, 1276, 88, 296, false,      \
410 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
411 		HDMI_RES_AR_64_27, 0}
412 #define HDMI_VFRMT_3840x2160p25_64_27_TIMING                             \
413 	{HDMI_VFRMT_3840x2160p25_64_27, 3840, 1056, 88, 296, false,      \
414 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
415 		HDMI_RES_AR_64_27, 0}
416 #define HDMI_VFRMT_3840x2160p30_64_27_TIMING                             \
417 	{HDMI_VFRMT_3840x2160p30_64_27, 3840, 176, 88, 296, false,       \
418 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
419 		HDMI_RES_AR_64_27, 0}
420 #define HDMI_VFRMT_3840x2160p50_64_27_TIMING                             \
421 	{HDMI_VFRMT_3840x2160p50_64_27, 3840, 1056, 88, 296, false,      \
422 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
423 		HDMI_RES_AR_64_27, 0}
424 #define HDMI_VFRMT_3840x2160p60_64_27_TIMING                             \
425 	{HDMI_VFRMT_3840x2160p60_64_27, 3840, 176, 88, 296, false,       \
426 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
427 		HDMI_RES_AR_64_27, 0}
428 
429 #define MSM_HDMI_MODES_SET_TIMING(LUT, MODE) do {		\
430 	struct msm_hdmi_mode_timing_info mode = MODE##_TIMING;	\
431 	LUT[MODE] = mode;\
432 	} while (0)
433 
434 #define MSM_HDMI_MODES_INIT_TIMINGS(__lut)	\
435 do {	\
436 	unsigned int i;	\
437 	for (i = 0; i < HDMI_VFRMT_MAX; i++) {	\
438 		struct msm_hdmi_mode_timing_info mode =	\
439 			VFRMT_NOT_SUPPORTED(i);	\
440 		(__lut)[i] = mode;	\
441 	}	\
442 } while (0)
443 
444 #define MSM_HDMI_MODES_SET_SUPP_TIMINGS(__lut, __type)	\
445 do {	\
446 	if (__type & MSM_HDMI_MODES_CEA) {	\
447 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
448 			HDMI_VFRMT_640x480p60_4_3);	\
449 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
450 			HDMI_VFRMT_720x480p60_4_3);	\
451 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
452 			HDMI_VFRMT_720x480p60_16_9);	\
453 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
454 			HDMI_VFRMT_1280x720p60_16_9);	\
455 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
456 			HDMI_VFRMT_1920x1080i60_16_9);	\
457 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
458 			HDMI_VFRMT_1440x480i60_4_3);	\
459 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
460 			HDMI_VFRMT_1440x480i60_16_9);	\
461 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
462 			HDMI_VFRMT_1920x1080p60_16_9);	\
463 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
464 			HDMI_VFRMT_720x576p50_4_3);	\
465 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
466 			HDMI_VFRMT_720x576p50_16_9);	\
467 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
468 			HDMI_VFRMT_1280x720p50_16_9);	\
469 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
470 			HDMI_VFRMT_1440x576i50_4_3);	\
471 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
472 			HDMI_VFRMT_1440x576i50_16_9);	\
473 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
474 			HDMI_VFRMT_1920x1080p50_16_9);	\
475 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
476 			HDMI_VFRMT_1920x1080p24_16_9);	\
477 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
478 			HDMI_VFRMT_1920x1080p25_16_9);	\
479 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
480 			HDMI_VFRMT_1920x1080p30_16_9);	\
481 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
482 			HDMI_VFRMT_3840x2160p24_16_9);  \
483 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
484 			HDMI_VFRMT_3840x2160p25_16_9);  \
485 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
486 			HDMI_VFRMT_3840x2160p30_16_9);  \
487 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
488 			HDMI_VFRMT_3840x2160p50_16_9);  \
489 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
490 			HDMI_VFRMT_3840x2160p60_16_9);  \
491 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
492 			HDMI_VFRMT_4096x2160p24_256_135);\
493 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
494 			HDMI_VFRMT_4096x2160p25_256_135);\
495 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
496 			HDMI_VFRMT_4096x2160p30_256_135);\
497 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
498 			HDMI_VFRMT_4096x2160p50_256_135);\
499 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
500 			HDMI_VFRMT_4096x2160p60_256_135);\
501 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
502 			HDMI_VFRMT_3840x2160p24_64_27); \
503 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
504 			HDMI_VFRMT_3840x2160p25_64_27); \
505 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
506 			HDMI_VFRMT_3840x2160p30_64_27); \
507 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
508 			HDMI_VFRMT_3840x2160p50_64_27); \
509 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
510 			HDMI_VFRMT_3840x2160p60_64_27); \
511 	}	\
512 	if (__type & MSM_HDMI_MODES_XTND) {	\
513 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
514 			HDMI_EVFRMT_3840x2160p30_16_9);	\
515 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
516 			HDMI_EVFRMT_3840x2160p25_16_9);	\
517 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
518 			HDMI_EVFRMT_3840x2160p24_16_9);	\
519 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
520 			HDMI_EVFRMT_4096x2160p24_16_9);	\
521 	}	\
522 	if (__type & MSM_HDMI_MODES_DVI) {	\
523 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
524 			HDMI_VFRMT_1024x768p60_4_3);	\
525 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
526 			HDMI_VFRMT_1280x1024p60_5_4);	\
527 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
528 			HDMI_VFRMT_2560x1600p60_16_9);	\
529 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
530 			HDMI_VFRMT_800x600p60_4_3);	\
531 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
532 			HDMI_VFRMT_848x480p60_16_9);	\
533 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
534 			HDMI_VFRMT_1280x960p60_4_3);	\
535 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
536 			HDMI_VFRMT_1360x768p60_16_9);	\
537 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
538 			HDMI_VFRMT_1440x900p60_16_10);	\
539 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
540 			HDMI_VFRMT_1400x1050p60_4_3);	\
541 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
542 			HDMI_VFRMT_1680x1050p60_16_10);	\
543 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
544 			HDMI_VFRMT_1600x1200p60_4_3);	\
545 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
546 			HDMI_VFRMT_1920x1200p60_16_10);	\
547 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
548 			HDMI_VFRMT_1366x768p60_16_10);	\
549 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
550 			HDMI_VFRMT_1280x800p60_16_10);	\
551 	}	\
552 } while (0)
553 
554 #define MSM_HDMI_MODES_GET_DETAILS(mode, MODE) do {		\
555 	struct msm_hdmi_mode_timing_info info = MODE##_TIMING;	\
556 	*mode = info;						\
557 	} while (0)
558 
559 #endif /* _MSM_HDMI_MODES_H__ */
560