1 #include <linux/console.h>
4 #include <linux/completion.h>
5 #include "../display/screen/screen.h"
6 #include <linux/hdmi.h>
7 #include "../rk29_fb.h"
11 #define LCD_ACLK 500000000// 312000000
13 #define OUT_TYPE SCREEN_HDMI
14 #define OUT_FACE OUT_P888
19 /* 720p@50Hz Timing */
20 #define OUT_CLK0 74250000
30 /* 720p@60Hz Timing */
31 #define OUT_CLK1 74250000
41 /* 576p@50Hz Timing */
42 #define OUT_CLK2 27000000
52 /* 720x480p@60Hz Timing */
53 #define OUT_CLK3 27000000
63 /* 1080p@50Hz Timing */
64 #define OUT_CLK5 148500000
74 /* 1080p@60Hz Timing */
75 #define OUT_CLK4 148500000
86 extern int FB_Switch_Screen( struct rk29fb_screen *screen, u32 enable );
88 static int anx7150_init(void)
93 static int anx7150_standby(u8 enable)
99 struct rk29fb_screen hdmi_info[] = {
101 .hdmi_resolution = HDMI_1280x720p_50Hz,
106 .pixclock = OUT_CLK0,
107 .lcdc_aclk = LCD_ACLK,
108 .left_margin = H_BP0,
109 .right_margin = H_FP0,
111 .upper_margin = V_BP0,
112 .lower_margin = V_FP0,
117 .pin_dclk = DCLK_POL,
123 .init = anx7150_init,
124 .standby = anx7150_standby,
125 }, //HDMI_1280x720p_50Hz
127 .hdmi_resolution = HDMI_1280x720p_60Hz,
132 .pixclock = OUT_CLK1,
133 .lcdc_aclk = LCD_ACLK,
134 .left_margin = H_BP1,
135 .right_margin = H_FP1,
137 .upper_margin = V_BP1,
138 .lower_margin = V_FP1,
143 .pin_dclk = DCLK_POL,
149 .init = anx7150_init,
150 .standby = anx7150_standby,
151 }, //HDMI_1280x720p_60Hz
153 .hdmi_resolution = HDMI_720x576p_50Hz_4x3,
158 .pixclock = OUT_CLK2,
159 .lcdc_aclk = LCD_ACLK,
160 .left_margin = H_BP2,
161 .right_margin = H_FP2,
163 .upper_margin = V_BP2,
164 .lower_margin = V_FP2,
169 .pin_dclk = DCLK_POL,
175 .init = anx7150_init,
176 .standby = anx7150_standby,
177 }, //HDMI_720x576p_50Hz_4x3
179 .hdmi_resolution = HDMI_720x576p_50Hz_16x9,
184 .pixclock = OUT_CLK2,
185 .lcdc_aclk = LCD_ACLK,
186 .left_margin = H_BP2,
187 .right_margin = H_FP2,
189 .upper_margin = V_BP2,
190 .lower_margin = V_FP2,
195 .pin_dclk = DCLK_POL,
201 .init = anx7150_init,
202 .standby = anx7150_standby,
203 }, //HDMI_720x576p_50Hz_16x9
205 .hdmi_resolution = HDMI_720x480p_60Hz_4x3,
210 .pixclock = OUT_CLK3,
211 .lcdc_aclk = LCD_ACLK,
212 .left_margin = H_BP3,
213 .right_margin = H_FP3,
215 .upper_margin = V_BP3,
216 .lower_margin = V_FP3,
221 .pin_dclk = DCLK_POL,
227 .init = anx7150_init,
228 .standby = anx7150_standby,
229 }, //HDMI_720x480p_60Hz_4x3
231 .hdmi_resolution = HDMI_720x480p_60Hz_16x9,
236 .pixclock = OUT_CLK3,
237 .lcdc_aclk = LCD_ACLK,
238 .left_margin = H_BP3,
239 .right_margin = H_FP3,
241 .upper_margin = V_BP3,
242 .lower_margin = V_FP3,
247 .pin_dclk = DCLK_POL,
253 .init = anx7150_init,
254 .standby = anx7150_standby,
255 }, //HDMI_720x480p_60Hz_16x9
257 .hdmi_resolution = HDMI_1920x1080p_50Hz,
262 .pixclock = OUT_CLK4,
263 .lcdc_aclk = LCD_ACLK,
264 .left_margin = H_BP4,
265 .right_margin = H_FP4,
267 .upper_margin = V_BP4,
268 .lower_margin = V_FP4,
273 .pin_dclk = DCLK_POL,
279 .init = anx7150_init,
280 .standby = anx7150_standby,
281 }, //HDMI_1920x1080p_50Hz
283 .hdmi_resolution = HDMI_1920x1080p_60Hz,
288 .pixclock = OUT_CLK5,
289 .lcdc_aclk = LCD_ACLK,
290 .left_margin = H_BP5,
291 .right_margin = H_FP5,
293 .upper_margin = V_BP5,
294 .lower_margin = V_FP5,
299 .pin_dclk = DCLK_POL,
305 .init = anx7150_init,
306 .standby = anx7150_standby,
307 }, //HDMI_1920x1080p_60Hz
310 int hdmi_switch_fb(struct hdmi *hdmi, int type)
314 switch(hdmi->resolution)
316 case HDMI_1280x720p_50Hz:
317 rc = FB_Switch_Screen(&hdmi_info[0], type);
319 case HDMI_1280x720p_60Hz:
320 rc = FB_Switch_Screen(&hdmi_info[1], type);
322 case HDMI_720x576p_50Hz_4x3:
323 rc = FB_Switch_Screen(&hdmi_info[2], type);
325 case HDMI_720x576p_50Hz_16x9:
326 rc = FB_Switch_Screen(&hdmi_info[3], type);
328 case HDMI_720x480p_60Hz_4x3:
329 rc = FB_Switch_Screen(&hdmi_info[4], type);
331 case HDMI_720x480p_60Hz_16x9:
332 rc = FB_Switch_Screen(&hdmi_info[5], type);
334 case HDMI_1920x1080p_50Hz:
335 rc = FB_Switch_Screen(&hdmi_info[6], type);
337 case HDMI_1920x1080p_60Hz:
338 rc = FB_Switch_Screen(&hdmi_info[7], type);
341 rc = FB_Switch_Screen(&hdmi_info[0], type);
344 if(hdmi->wait == 1) {
345 complete(&hdmi->complete);