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[] = {
105 .pixclock = OUT_CLK0,
106 .lcdc_aclk = LCD_ACLK,
107 .left_margin = H_BP0,
108 .right_margin = H_FP0,
110 .upper_margin = V_BP0,
111 .lower_margin = V_FP0,
116 .pin_dclk = DCLK_POL,
122 .init = anx7150_init,
123 .standby = anx7150_standby,
124 }, //HDMI_1280x720p_50Hz
130 .pixclock = OUT_CLK1,
131 .lcdc_aclk = LCD_ACLK,
132 .left_margin = H_BP1,
133 .right_margin = H_FP1,
135 .upper_margin = V_BP1,
136 .lower_margin = V_FP1,
141 .pin_dclk = DCLK_POL,
147 .init = anx7150_init,
148 .standby = anx7150_standby,
149 }, //HDMI_1280x720p_60Hz
155 .pixclock = OUT_CLK2,
156 .lcdc_aclk = LCD_ACLK,
157 .left_margin = H_BP2,
158 .right_margin = H_FP2,
160 .upper_margin = V_BP2,
161 .lower_margin = V_FP2,
166 .pin_dclk = DCLK_POL,
172 .init = anx7150_init,
173 .standby = anx7150_standby,
174 }, //HDMI_720x576p_50Hz_4x3
180 .pixclock = OUT_CLK2,
181 .lcdc_aclk = LCD_ACLK,
182 .left_margin = H_BP2,
183 .right_margin = H_FP2,
185 .upper_margin = V_BP2,
186 .lower_margin = V_FP2,
191 .pin_dclk = DCLK_POL,
197 .init = anx7150_init,
198 .standby = anx7150_standby,
199 }, //HDMI_720x576p_50Hz_16x9
205 .pixclock = OUT_CLK3,
206 .lcdc_aclk = LCD_ACLK,
207 .left_margin = H_BP3,
208 .right_margin = H_FP3,
210 .upper_margin = V_BP3,
211 .lower_margin = V_FP3,
216 .pin_dclk = DCLK_POL,
222 .init = anx7150_init,
223 .standby = anx7150_standby,
224 }, //HDMI_720x480p_60Hz_4x3
230 .pixclock = OUT_CLK3,
231 .lcdc_aclk = LCD_ACLK,
232 .left_margin = H_BP3,
233 .right_margin = H_FP3,
235 .upper_margin = V_BP3,
236 .lower_margin = V_FP3,
241 .pin_dclk = DCLK_POL,
247 .init = anx7150_init,
248 .standby = anx7150_standby,
249 }, //HDMI_720x480p_60Hz_16x9
255 .pixclock = OUT_CLK4,
256 .lcdc_aclk = LCD_ACLK,
257 .left_margin = H_BP4,
258 .right_margin = H_FP4,
260 .upper_margin = V_BP4,
261 .lower_margin = V_FP4,
266 .pin_dclk = DCLK_POL,
272 .init = anx7150_init,
273 .standby = anx7150_standby,
274 }, //HDMI_1920x1080p_50Hz
280 .pixclock = OUT_CLK5,
281 .lcdc_aclk = LCD_ACLK,
282 .left_margin = H_BP5,
283 .right_margin = H_FP5,
285 .upper_margin = V_BP5,
286 .lower_margin = V_FP5,
291 .pin_dclk = DCLK_POL,
297 .init = anx7150_init,
298 .standby = anx7150_standby,
299 }, //HDMI_1920x1080p_60Hz
302 int hdmi_switch_fb(struct hdmi *hdmi, int type)
306 switch(hdmi->resolution)
308 case HDMI_1280x720p_50Hz:
309 rc = FB_Switch_Screen(&hdmi_info[0], type);
311 case HDMI_1280x720p_60Hz:
312 rc = FB_Switch_Screen(&hdmi_info[1], type);
314 case HDMI_720x576p_50Hz_4x3:
315 rc = FB_Switch_Screen(&hdmi_info[2], type);
317 case HDMI_720x576p_50Hz_16x9:
318 rc = FB_Switch_Screen(&hdmi_info[3], type);
320 case HDMI_720x480p_60Hz_4x3:
321 rc = FB_Switch_Screen(&hdmi_info[4], type);
323 case HDMI_720x480p_60Hz_16x9:
324 rc = FB_Switch_Screen(&hdmi_info[5], type);
326 case HDMI_1920x1080p_50Hz:
327 rc = FB_Switch_Screen(&hdmi_info[6], type);
329 case HDMI_1920x1080p_60Hz:
330 rc = FB_Switch_Screen(&hdmi_info[7], type);
333 rc = FB_Switch_Screen(&hdmi_info[0], type);
336 if(hdmi->wait == 1) {
337 complete(&hdmi->complete);