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
7 #define MSM_HDMI_YUV_420_12BPP_FORMAT       2
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
54 #define MSM_HDMI_MODES_XTND		2
55 #define MSM_HDMI_MODES_DVI		4
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 MISC_VFRMT_OFF(x)		(ETIII_VFRMT_END + x)
238 #define HDMI_VFRMT_640x480p59_4_3	MISC_VFRMT_OFF(1)
239 #define MISC_VFRMT_END			HDMI_VFRMT_640x480p59_4_3
240 
241 #define RESERVE_OFF(x)			(MISC_VFRMT_END + x)
242 
243 #define HDMI_VFRMT_RESERVE1		RESERVE_OFF(1)
244 #define HDMI_VFRMT_RESERVE2		RESERVE_OFF(2)
245 #define HDMI_VFRMT_RESERVE3		RESERVE_OFF(3)
246 #define HDMI_VFRMT_RESERVE4		RESERVE_OFF(4)
247 #define HDMI_VFRMT_RESERVE5		RESERVE_OFF(5)
248 #define HDMI_VFRMT_RESERVE6		RESERVE_OFF(6)
249 #define HDMI_VFRMT_RESERVE7		RESERVE_OFF(7)
250 #define HDMI_VFRMT_RESERVE8		RESERVE_OFF(8)
251 #define RESERVE_VFRMT_END		HDMI_VFRMT_RESERVE8
252 
253 #define HDMI_VFRMT_MAX			(RESERVE_VFRMT_END + 1)
254 
255 /* Timing information for supported modes */
256 #define VFRMT_NOT_SUPPORTED(VFRMT) \
257 	{VFRMT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,		\
258 		HDMI_RES_AR_INVALID}
259 
260 #define HDMI_VFRMT_640x480p60_4_3_TIMING				\
261 	{HDMI_VFRMT_640x480p60_4_3, 640, 16, 96, 48, true,		\
262 	 480, 10, 2, 33, true, 25200, 60000, false, true, HDMI_RES_AR_4_3, 0}
263 #define HDMI_VFRMT_720x480p60_4_3_TIMING				\
264 	{HDMI_VFRMT_720x480p60_4_3, 720, 16, 62, 60, true,		\
265 	 480, 9, 6, 30, true, 27027, 60000, false, true, HDMI_RES_AR_4_3, 0}
266 #define HDMI_VFRMT_720x480p60_16_9_TIMING				\
267 	{HDMI_VFRMT_720x480p60_16_9, 720, 16, 62, 60, true,		\
268 	 480, 9, 6, 30, true, 27027, 60000, false, true, HDMI_RES_AR_16_9, 0}
269 #define HDMI_VFRMT_1280x720p60_16_9_TIMING				\
270 	{HDMI_VFRMT_1280x720p60_16_9, 1280, 110, 40, 220, false,	\
271 	 720, 5, 5, 20, false, 74250, 60000, false, true, HDMI_RES_AR_16_9, 0}
272 #define HDMI_VFRMT_1920x1080i60_16_9_TIMING				\
273 	{HDMI_VFRMT_1920x1080i60_16_9, 1920, 88, 44, 148, false,	\
274 	 540, 2, 5, 5, false, 74250, 60000, true, true, HDMI_RES_AR_16_9, 0}
275 #define HDMI_VFRMT_1440x480i60_4_3_TIMING				\
276 	{HDMI_VFRMT_1440x480i60_4_3, 1440, 38, 124, 114, true,		\
277 	 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_4_3, 0}
278 #define HDMI_VFRMT_1440x480i60_16_9_TIMING				\
279 	{HDMI_VFRMT_1440x480i60_16_9, 1440, 38, 124, 114, true,		\
280 	 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_16_9, 0}
281 #define HDMI_VFRMT_1920x1080p60_16_9_TIMING				\
282 	{HDMI_VFRMT_1920x1080p60_16_9, 1920, 88, 44, 148, false,	\
283 	 1080, 4, 5, 36, false, 148500, 60000, false, true, HDMI_RES_AR_16_9, 0}
284 #define HDMI_VFRMT_720x576p50_4_3_TIMING				\
285 	{HDMI_VFRMT_720x576p50_4_3, 720, 12, 64, 68, true,		\
286 	 576,  5, 5, 39, true, 27000, 50000, false, true, HDMI_RES_AR_4_3, 0}
287 #define HDMI_VFRMT_720x576p50_16_9_TIMING				\
288 	{HDMI_VFRMT_720x576p50_16_9, 720, 12, 64, 68, true,		\
289 	 576,  5, 5, 39, true, 27000, 50000, false, true, HDMI_RES_AR_16_9, 0}
290 #define HDMI_VFRMT_1280x720p50_16_9_TIMING				\
291 	{HDMI_VFRMT_1280x720p50_16_9, 1280, 440, 40, 220, false,	\
292 	 720,  5, 5, 20, false, 74250, 50000, false, true, HDMI_RES_AR_16_9, 0}
293 #define HDMI_VFRMT_1440x576i50_4_3_TIMING				\
294 	{HDMI_VFRMT_1440x576i50_4_3, 1440, 24, 126, 138, true,		\
295 	 288,  2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_4_3, 0}
296 #define HDMI_VFRMT_1440x576i50_16_9_TIMING				\
297 	{HDMI_VFRMT_1440x576i50_16_9, 1440, 24, 126, 138, true,		\
298 	 288,  2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_16_9, 0}
299 #define HDMI_VFRMT_1920x1080p50_16_9_TIMING				\
300 	{HDMI_VFRMT_1920x1080p50_16_9, 1920, 528, 44, 148, false,	\
301 	 1080, 4, 5, 36, false, 148500, 50000, false, true, HDMI_RES_AR_16_9, 0}
302 #define HDMI_VFRMT_1920x1080p24_16_9_TIMING				\
303 	{HDMI_VFRMT_1920x1080p24_16_9, 1920, 638, 44, 148, false,	\
304 	 1080, 4, 5, 36, false, 74250, 24000, false, true, HDMI_RES_AR_16_9, 0}
305 #define HDMI_VFRMT_1920x1080p25_16_9_TIMING				\
306 	{HDMI_VFRMT_1920x1080p25_16_9, 1920, 528, 44, 148, false,	\
307 	 1080, 4, 5, 36, false, 74250, 25000, false, true, HDMI_RES_AR_16_9, 0}
308 #define HDMI_VFRMT_1920x1080p30_16_9_TIMING				\
309 	{HDMI_VFRMT_1920x1080p30_16_9, 1920, 88, 44, 148, false,	\
310 	 1080, 4, 5, 36, false, 74250, 30000, false, true, HDMI_RES_AR_16_9, 0}
311 #define HDMI_VFRMT_1024x768p60_4_3_TIMING                               \
312 	{HDMI_VFRMT_1024x768p60_4_3, 1024, 24, 136, 160, false,         \
313 	768, 2, 6, 29, false, 65000, 60000, false, true, HDMI_RES_AR_4_3, 0}
314 #define HDMI_VFRMT_1280x1024p60_5_4_TIMING				\
315 	{HDMI_VFRMT_1280x1024p60_5_4, 1280, 48, 112, 248, false,	\
316 	1024, 1, 3, 38, false, 108000, 60000, false, true, HDMI_RES_AR_5_4, 0}
317 #define HDMI_VFRMT_2560x1600p60_16_9_TIMING				\
318 	{HDMI_VFRMT_2560x1600p60_16_9, 2560, 48, 32, 80, false,		\
319 	 1600, 3, 6, 37, false, 268500, 60000, false, true, HDMI_RES_AR_16_9, 0}
320 #define HDMI_EVFRMT_3840x2160p30_16_9_TIMING				\
321 	{HDMI_EVFRMT_3840x2160p30_16_9, 3840, 176, 88, 296, false,	\
322 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
323 		HDMI_RES_AR_16_9, 0}
324 #define HDMI_EVFRMT_3840x2160p25_16_9_TIMING				\
325 	{HDMI_EVFRMT_3840x2160p25_16_9, 3840, 1056, 88, 296, false,	\
326 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
327 		HDMI_RES_AR_16_9, 0}
328 #define HDMI_EVFRMT_3840x2160p24_16_9_TIMING				\
329 	{HDMI_EVFRMT_3840x2160p24_16_9, 3840, 1276, 88, 296, false,	\
330 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
331 		HDMI_RES_AR_16_9, 0}
332 #define HDMI_EVFRMT_4096x2160p24_16_9_TIMING				\
333 	{HDMI_EVFRMT_4096x2160p24_16_9, 4096, 1020, 88, 296, false,	\
334 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
335 		HDMI_RES_AR_16_9, 0}
336 
337 #define HDMI_VFRMT_800x600p60_4_3_TIMING				\
338 	{HDMI_VFRMT_800x600p60_4_3, 800, 40, 128, 88, false,	\
339 	 600, 1, 4, 23, false, 40000, 60000, false, true, HDMI_RES_AR_4_3, 0}
340 #define HDMI_VFRMT_848x480p60_16_9_TIMING				\
341 	{HDMI_VFRMT_848x480p60_16_9, 848, 16, 112, 112, false,	\
342 	 480, 6, 8, 23, false, 33750, 60000, false, true, HDMI_RES_AR_16_9, 0}
343 #define HDMI_VFRMT_1280x960p60_4_3_TIMING\
344 	{HDMI_VFRMT_1280x960p60_4_3, 1280, 96, 112, 312, false,	\
345 	 960, 1, 3, 36, false, 108000, 60000, false, true, HDMI_RES_AR_4_3, 0}
346 #define HDMI_VFRMT_1360x768p60_16_9_TIMING\
347 	{HDMI_VFRMT_1360x768p60_16_9, 1360, 64, 112, 256, false,	\
348 	 768, 3, 6, 18, false, 85500, 60000, false, true, HDMI_RES_AR_16_9, 0}
349 #define HDMI_VFRMT_1440x900p60_16_10_TIMING\
350 	{HDMI_VFRMT_1440x900p60_16_10, 1440, 48, 32, 80, false,	\
351 	 900, 3, 6, 17, true, 88750, 60000, false, true, HDMI_RES_AR_16_10, 0}
352 #define HDMI_VFRMT_1400x1050p60_4_3_TIMING\
353 	{HDMI_VFRMT_1400x1050p60_4_3, 1400, 48, 32, 80, false,	\
354 	 1050, 3, 4, 23, true, 101000, 60000, false, true, HDMI_RES_AR_4_3, 0}
355 #define HDMI_VFRMT_1680x1050p60_16_10_TIMING\
356 	{HDMI_VFRMT_1680x1050p60_16_10, 1680, 48, 32, 80, false,	\
357 	 1050, 3, 6, 21, true, 119000, 60000, false, true, HDMI_RES_AR_16_10, 0}
358 #define HDMI_VFRMT_1600x1200p60_4_3_TIMING\
359 	{HDMI_VFRMT_1600x1200p60_4_3, 1600, 64, 192, 304, false,	\
360 	 1200, 1, 3, 46, false, 162000, 60000, false, true, HDMI_RES_AR_4_3, 0}
361 #define HDMI_VFRMT_1920x1200p60_16_10_TIMING\
362 	{HDMI_VFRMT_1920x1200p60_16_10, 1920, 48, 32, 80, false,\
363 	 1200, 3, 6, 26, true, 154000, 60000, false, true, HDMI_RES_AR_16_10, 0}
364 #define HDMI_VFRMT_1366x768p60_16_10_TIMING\
365 	{HDMI_VFRMT_1366x768p60_16_10, 1366, 70, 143, 213, false,\
366 	 768, 3, 3, 24, false, 85500, 60000, false, true, HDMI_RES_AR_16_10, 0}
367 #define HDMI_VFRMT_1280x800p60_16_10_TIMING\
368 	{HDMI_VFRMT_1280x800p60_16_10, 1280, 72, 128, 200, true,\
369 	 800, 3, 6, 22, false, 83500, 60000, false, true, HDMI_RES_AR_16_10, 0}
370 #define HDMI_VFRMT_3840x2160p24_16_9_TIMING                             \
371 	{HDMI_VFRMT_3840x2160p24_16_9, 3840, 1276, 88, 296, false,      \
372 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
373 		HDMI_RES_AR_16_9, 0}
374 #define HDMI_VFRMT_3840x2160p25_16_9_TIMING                             \
375 	{HDMI_VFRMT_3840x2160p25_16_9, 3840, 1056, 88, 296, false,      \
376 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
377 		HDMI_RES_AR_16_9, 0}
378 #define HDMI_VFRMT_3840x2160p30_16_9_TIMING                             \
379 	{HDMI_VFRMT_3840x2160p30_16_9, 3840, 176, 88, 296, false,       \
380 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
381 		HDMI_RES_AR_16_9, 0}
382 #define HDMI_VFRMT_3840x2160p50_16_9_TIMING                             \
383 	{HDMI_VFRMT_3840x2160p50_16_9, 3840, 1056, 88, 296, false,      \
384 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
385 		HDMI_RES_AR_16_9, 0}
386 #define HDMI_VFRMT_3840x2160p60_16_9_TIMING                             \
387 	{HDMI_VFRMT_3840x2160p60_16_9, 3840, 176, 88, 296, false,       \
388 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
389 		HDMI_RES_AR_16_9, 0}
390 
391 #define HDMI_VFRMT_4096x2160p24_256_135_TIMING                          \
392 	{HDMI_VFRMT_4096x2160p24_256_135, 4096, 1020, 88, 296, false,   \
393 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
394 		HDMI_RES_AR_256_135, 0}
395 #define HDMI_VFRMT_4096x2160p25_256_135_TIMING                          \
396 	{HDMI_VFRMT_4096x2160p25_256_135, 4096, 968, 88, 128, false,    \
397 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
398 		HDMI_RES_AR_256_135, 0}
399 #define HDMI_VFRMT_4096x2160p30_256_135_TIMING                          \
400 	{HDMI_VFRMT_4096x2160p30_256_135, 4096, 88, 88, 128, false,     \
401 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
402 		HDMI_RES_AR_256_135, 0}
403 #define HDMI_VFRMT_4096x2160p50_256_135_TIMING                          \
404 	{HDMI_VFRMT_4096x2160p50_256_135, 4096, 968, 88, 128, false,    \
405 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
406 		HDMI_RES_AR_256_135, 0}
407 #define HDMI_VFRMT_4096x2160p60_256_135_TIMING                          \
408 	{HDMI_VFRMT_4096x2160p60_256_135, 4096, 88, 88, 128, false,     \
409 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
410 		HDMI_RES_AR_256_135, 0}
411 
412 #define HDMI_VFRMT_3840x2160p24_64_27_TIMING                             \
413 	{HDMI_VFRMT_3840x2160p24_64_27, 3840, 1276, 88, 296, false,      \
414 	 2160, 8, 10, 72, false, 297000, 24000, false, true, \
415 		HDMI_RES_AR_64_27, 0}
416 #define HDMI_VFRMT_3840x2160p25_64_27_TIMING                             \
417 	{HDMI_VFRMT_3840x2160p25_64_27, 3840, 1056, 88, 296, false,      \
418 	 2160, 8, 10, 72, false, 297000, 25000, false, true, \
419 		HDMI_RES_AR_64_27, 0}
420 #define HDMI_VFRMT_3840x2160p30_64_27_TIMING                             \
421 	{HDMI_VFRMT_3840x2160p30_64_27, 3840, 176, 88, 296, false,       \
422 	 2160, 8, 10, 72, false, 297000, 30000, false, true, \
423 		HDMI_RES_AR_64_27, 0}
424 #define HDMI_VFRMT_3840x2160p50_64_27_TIMING                             \
425 	{HDMI_VFRMT_3840x2160p50_64_27, 3840, 1056, 88, 296, false,      \
426 	 2160, 8, 10, 72, false, 594000, 50000, false, true, \
427 		HDMI_RES_AR_64_27, 0}
428 #define HDMI_VFRMT_3840x2160p60_64_27_TIMING                             \
429 	{HDMI_VFRMT_3840x2160p60_64_27, 3840, 176, 88, 296, false,       \
430 	 2160, 8, 10, 72, false, 594000, 60000, false, true, \
431 		HDMI_RES_AR_64_27, 0}
432 #define HDMI_VFRMT_640x480p59_4_3_TIMING                             \
433 	{HDMI_VFRMT_640x480p59_4_3, 640, 16, 96, 48, true,       \
434 	 480, 10, 2, 33, true, 25170, 59928, false, true, \
435 		HDMI_RES_AR_4_3, 1}
436 
437 
438 #define MSM_HDMI_MODES_SET_TIMING(LUT, MODE) do {		\
439 	struct msm_hdmi_mode_timing_info mode = MODE##_TIMING;	\
440 	LUT[MODE] = mode;\
441 	} while (0)
442 
443 #define MSM_HDMI_MODES_INIT_TIMINGS(__lut)	\
444 do {	\
445 	unsigned int i;	\
446 	for (i = 0; i < HDMI_VFRMT_MAX; i++) {	\
447 		struct msm_hdmi_mode_timing_info mode =	\
448 			VFRMT_NOT_SUPPORTED(i);	\
449 		(__lut)[i] = mode;	\
450 	}	\
451 } while (0)
452 
453 #define MSM_HDMI_MODES_SET_SUPP_TIMINGS(__lut, __type)	\
454 do {	\
455 	if (__type & MSM_HDMI_MODES_CEA) {	\
456 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
457 			HDMI_VFRMT_640x480p60_4_3);	\
458 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
459 			HDMI_VFRMT_720x480p60_4_3);	\
460 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
461 			HDMI_VFRMT_720x480p60_16_9);	\
462 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
463 			HDMI_VFRMT_1280x720p60_16_9);	\
464 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
465 			HDMI_VFRMT_1920x1080i60_16_9);	\
466 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
467 			HDMI_VFRMT_1440x480i60_4_3);	\
468 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
469 			HDMI_VFRMT_1440x480i60_16_9);	\
470 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
471 			HDMI_VFRMT_1920x1080p60_16_9);	\
472 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
473 			HDMI_VFRMT_720x576p50_4_3);	\
474 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
475 			HDMI_VFRMT_720x576p50_16_9);	\
476 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
477 			HDMI_VFRMT_1280x720p50_16_9);	\
478 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
479 			HDMI_VFRMT_1440x576i50_4_3);	\
480 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
481 			HDMI_VFRMT_1440x576i50_16_9);	\
482 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
483 			HDMI_VFRMT_1920x1080p50_16_9);	\
484 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
485 			HDMI_VFRMT_1920x1080p24_16_9);	\
486 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
487 			HDMI_VFRMT_1920x1080p25_16_9);	\
488 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
489 			HDMI_VFRMT_1920x1080p30_16_9);	\
490 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
491 			HDMI_VFRMT_3840x2160p24_16_9);  \
492 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
493 			HDMI_VFRMT_3840x2160p25_16_9);  \
494 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
495 			HDMI_VFRMT_3840x2160p30_16_9);  \
496 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
497 			HDMI_VFRMT_3840x2160p50_16_9);  \
498 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
499 			HDMI_VFRMT_3840x2160p60_16_9);  \
500 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
501 			HDMI_VFRMT_4096x2160p24_256_135);\
502 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
503 			HDMI_VFRMT_4096x2160p25_256_135);\
504 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
505 			HDMI_VFRMT_4096x2160p30_256_135);\
506 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
507 			HDMI_VFRMT_4096x2160p50_256_135);\
508 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
509 			HDMI_VFRMT_4096x2160p60_256_135);\
510 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
511 			HDMI_VFRMT_3840x2160p24_64_27); \
512 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
513 			HDMI_VFRMT_3840x2160p25_64_27); \
514 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
515 			HDMI_VFRMT_3840x2160p30_64_27); \
516 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
517 			HDMI_VFRMT_3840x2160p50_64_27); \
518 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
519 			HDMI_VFRMT_3840x2160p60_64_27); \
520 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
521 			HDMI_VFRMT_640x480p59_4_3); \
522 	}	\
523 	if (__type & MSM_HDMI_MODES_XTND) {	\
524 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
525 			HDMI_EVFRMT_3840x2160p30_16_9);	\
526 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
527 			HDMI_EVFRMT_3840x2160p25_16_9);	\
528 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
529 			HDMI_EVFRMT_3840x2160p24_16_9);	\
530 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
531 			HDMI_EVFRMT_4096x2160p24_16_9);	\
532 	}	\
533 	if (__type & MSM_HDMI_MODES_DVI) {	\
534 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
535 			HDMI_VFRMT_1024x768p60_4_3);	\
536 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
537 			HDMI_VFRMT_1280x1024p60_5_4);	\
538 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
539 			HDMI_VFRMT_2560x1600p60_16_9);	\
540 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
541 			HDMI_VFRMT_800x600p60_4_3);	\
542 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
543 			HDMI_VFRMT_848x480p60_16_9);	\
544 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
545 			HDMI_VFRMT_1280x960p60_4_3);	\
546 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
547 			HDMI_VFRMT_1360x768p60_16_9);	\
548 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
549 			HDMI_VFRMT_1440x900p60_16_10);	\
550 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
551 			HDMI_VFRMT_1400x1050p60_4_3);	\
552 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
553 			HDMI_VFRMT_1680x1050p60_16_10);	\
554 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
555 			HDMI_VFRMT_1600x1200p60_4_3);	\
556 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
557 			HDMI_VFRMT_1920x1200p60_16_10);	\
558 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
559 			HDMI_VFRMT_1366x768p60_16_10);	\
560 		MSM_HDMI_MODES_SET_TIMING(__lut,	\
561 			HDMI_VFRMT_1280x800p60_16_10);	\
562 	}	\
563 } while (0)
564 
565 #define MSM_HDMI_MODES_GET_DETAILS(mode, MODE) do {		\
566 	struct msm_hdmi_mode_timing_info info = MODE##_TIMING;	\
567 	*mode = info;						\
568 	} while (0)
569 
570 #endif /* _MSM_HDMI_MODES_H__ */
571