hdmi_video.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. #include "drv_types.h"
  2. #include "hdmi_dbg.h"
  3. #include "hdmi_hw.h"
  4. #include "hdmi_notice.h"
  5. #include "hdmi_video.h"
  6. #include "hdmi_xvycc.h"
  7. #include "drv_hdmi_external.h"
  8. #include "../vip/6710/reg_vip_def.h"
  9. #include "../vip/6710/drv_reg_access.h"
  10. #include "hdmi.h"
  11. #include "hdmi_time.h"
  12. //#define HDMI_SHOW_AVI_INFO
  13. static HDMI_TIMING_PARAM_t* pHDMIVideoTimingTable = NULL;
  14. static UINT32 u32HDMIVideoTimingTblSize = 0;
  15. #ifdef CONFIG_SUPPORT_DEBUG_MESSAGE
  16. #ifdef HDMI_SHOW_AVI_INFO
  17. static void print_avi_info(void);
  18. #endif
  19. static void print_video_timing(void);
  20. #endif
  21. static void print_send_to_vip_info(VIP_InterfaceKIC *pstKic);
  22. extern INT32 GetCustomerData(INT8 *pcTableName, INT8 **tablestart, UINT32 *tablesize);
  23. UINT8 gbSupportMaxHz = 85;
  24. UINT8 HScalerDownFlag = FALSE;
  25. UINT16 SupportResolutionMode[][2] =
  26. {
  27. { 640, 350},
  28. { 640, 400},
  29. { 640, 480},
  30. { 720, 240},
  31. { 720, 288},
  32. { 720, 400},
  33. { 720, 480},
  34. { 720, 576},
  35. { 800, 600},
  36. { 832, 624},
  37. { 848, 480},
  38. {1024, 768},
  39. {1152, 864},
  40. {1152, 870},
  41. {1280, 720},
  42. {1280, 768},
  43. {1280, 800},
  44. {1280, 960},
  45. {1280,1024},
  46. {1360, 768},
  47. {1366, 768},
  48. {1400,1050},
  49. {1440, 240},
  50. {1440, 288},
  51. {1440, 480},
  52. {1440, 576},
  53. {1440, 900},
  54. {1600, 900},
  55. {1600,1200},
  56. {1680,1050},
  57. {1920, 540},
  58. {1920,1080},
  59. {1920,1200},
  60. {2560,1080},
  61. {2560,1440},
  62. {2880, 240},
  63. {2880, 288},
  64. {2880, 480},
  65. {2880, 576},
  66. {3840,2160}
  67. };
  68. #if 0
  69. static void dump(const UINT8 *ptr, INT32 size)
  70. {
  71. INT32 i = 0, n = 0;
  72. INT8 str[3 * 0x10 + 8];
  73. for (i = 0; i < size ; i++)
  74. {
  75. if (n >= 0)
  76. {
  77. n += sprintf(&str[n], "%02x ", ptr[i]);
  78. }
  79. if (n >= 3 * 0x10 || i + 1 == size)
  80. {
  81. n = 0;
  82. hdmidbg("%s\n", str);
  83. }
  84. }
  85. }
  86. #endif
  87. static UINT8 get_colorimetry(UINT32 vertical)
  88. {
  89. UINT8 outColorimetry;
  90. outColorimetry = HDMI_RegisterRead(HDMIRX_R_AVI_C);
  91. /* Patch? */
  92. if (outColorimetry == AVI_C_NODATA)
  93. {
  94. outColorimetry = (vertical > 576) ? AVI_C_ITU709 : AVI_C_ITU601;
  95. }
  96. return outColorimetry;
  97. }
  98. static UINT8 get_pixel_fmt(void)
  99. {
  100. UINT8 outPixelFmt;
  101. HDMI_RegisterWrite(HDMIRX_R_DnSAMPLING_EN, 0);
  102. switch (HDMI_RegisterRead(HDMIRX_R_AVI_Y))
  103. {
  104. case AVI_Y_YCC422:
  105. outPixelFmt = YUV_422;
  106. break;
  107. case AVI_Y_YCC444:
  108. outPixelFmt = YUV_444;
  109. break;
  110. case AVI_Y_RGB:
  111. outPixelFmt = RGB;
  112. break;
  113. default:
  114. outPixelFmt = YUV_444;
  115. break;
  116. }
  117. return outPixelFmt;
  118. }
  119. static UINT8 get_ratio(void)
  120. {
  121. UINT8 outRatio;
  122. outRatio = (HDMI_RegisterRead(HDMIRX_R_AVI_M)<<4) | HDMI_RegisterRead(HDMIRX_R_AVI_R) ;
  123. return outRatio;
  124. }
  125. static DRV_HDMI3DStructure_e get_3d_fmt(void)
  126. {
  127. DRV_HDMI3DStructure_e fmt;
  128. DRV_HDMIVSITYPE_e vsi_hdmi_video_fmt;
  129. fmt = NONE_3D;
  130. vsi_hdmi_video_fmt = HDMI_RegisterRead(HDMIRX_R_VSI_PB_7_0_) >> 5;
  131. if (vsi_hdmi_video_fmt == DRV_HDMI_VSI_TYEP_3D)
  132. {
  133. fmt = HDMI_RegisterRead(HDMIRX_R_VSI_PB_15_8_) >> 4;
  134. switch (fmt)
  135. {
  136. case DRV_HDMI_3D_STRUCT_FP:
  137. case DRV_HDMI_3D_STRUCT_FA:
  138. case DRV_HDMI_3D_STRUCT_LA:
  139. case DRV_HDMI_3D_STRUCT_SS_F:
  140. case DRV_HDMI_3D_STRUCT_L_D:
  141. case DRV_HDMI_3D_STRUCT_L_D_G:
  142. case DRV_HDMI_3D_STRUCT_TB:
  143. case DRV_HDMI_3D_STRUCT_SS_H:
  144. break;
  145. default:
  146. fmt = NONE_3D;
  147. break;
  148. }
  149. }
  150. hdmidbg("%s: %d\n", __FUNCTION__, fmt);
  151. return fmt;
  152. }
  153. #ifdef SUPPORT_XVYCC
  154. static UINT8 get_xvYCC(void)
  155. {
  156. UINT8 fmt;
  157. fmt = XV_YCC_NONE;
  158. if (HDMI_RegisterRead(HDMIRX_R_GBD_exist))
  159. {
  160. fmt = (HDMI_RegisterRead(HDMIRX_AVI_EC) == 0) ? XV_YCC_601 :
  161. (HDMI_RegisterRead(HDMIRX_AVI_EC) == 1) ? XV_YCC_709 : XV_YCC_UNKNOWN_METRY;
  162. }
  163. return fmt;
  164. }
  165. #endif
  166. UINT32 get_pixel_clock(void)
  167. {
  168. UINT32 uiPixelClock = 0;
  169. if (HDMI_RegisterRead(HDMIRX_R_system_clk_cnt))
  170. {
  171. //8506 CRYSTAL_USE_24MHZ
  172. uiPixelClock = (24000000 / HDMI_RegisterRead(HDMIRX_R_system_clk_cnt)) * HDMI_RegisterRead(HDMIRX_R_pixel_rate_cnt); //8506 VIP pixel clock limitation = 162MHz
  173. switch (HDMI_RegisterRead(HDMIRX_dcm)) //0xbe0e00dc[1:0]
  174. {
  175. case 0: // DCM Factor =1
  176. break;
  177. case 1: // DCM Factor =1.25
  178. uiPixelClock = (uiPixelClock << 2) / 5; // divide 1.25=*4/5
  179. break;
  180. case 2: // DCM Factor =1.5
  181. uiPixelClock = (uiPixelClock << 1) / 3; // devide 1.5=*2/3
  182. break;
  183. case 3: // DCM Factor =2
  184. uiPixelClock = uiPixelClock >> 1;
  185. break;
  186. default : // DCM Factor =1
  187. break;
  188. }
  189. hdmidbg("pixel_clk>> %d, sys_clk_cnt: 0x%x R_pixel_rate_cnt: 0x%x, DCM Factor = %d\n", uiPixelClock, HDMI_RegisterRead(HDMIRX_R_system_clk_cnt), HDMI_RegisterRead(HDMIRX_R_pixel_rate_cnt),HDMI_RegisterRead(HDMIRX_dcm));
  190. }
  191. return uiPixelClock;
  192. }
  193. static PLF_VideoID_t get_VideoID(VIP_InterfaceKIC *pstKic)
  194. {
  195. PLF_VideoID_t eVideoID = PLF_VIDEO_TIMING_ID_NON_VIDEO_TIMING;
  196. UINT8 i;
  197. for(i = 0;i < u32HDMIVideoTimingTblSize;i++)
  198. {
  199. if(pHDMIVideoTimingTable[i].fInterlace != pstKic->bInterlace)
  200. continue;
  201. else if(pHDMIVideoTimingTable[i].wVFreq != pstKic->uiVfreq)
  202. continue;
  203. else if(abs(pHDMIVideoTimingTable[i].wHActive - pstKic->uiHactive) > (pHDMIVideoTimingTable[i].wHActive * HDMI_HVAILD_TOLERANCE_PERMILE / 1000))
  204. continue;
  205. else if(abs(pHDMIVideoTimingTable[i].wVActive - pstKic->uiVactive) > (pHDMIVideoTimingTable[i].wVActive * HDMI_VVAILD_TOLERANCE_PERMILE / 1000))
  206. continue;
  207. else
  208. {
  209. eVideoID = pHDMIVideoTimingTable[i].eVideoID;
  210. hdmidbg("[%s]ID[0x%x]: HAct:%d VAct:%d VHz:%d Inter:%d\n", __FUNCTION__, pHDMIVideoTimingTable[i].eVideoID, pHDMIVideoTimingTable[i].wHActive, pHDMIVideoTimingTable[i].wVActive, pHDMIVideoTimingTable[i].wVFreq, pHDMIVideoTimingTable[i].fInterlace);
  211. break;
  212. }
  213. }
  214. return eVideoID;
  215. }
  216. UINT8 HDMI_CheckSupportResolutionMode(VIP_InterfaceKIC *pstKic)
  217. {
  218. UINT16 i;
  219. UINT32 size;
  220. UINT8 SupportFlag = false;
  221. size = sizeof(SupportResolutionMode) / (2 * sizeof(UINT16));
  222. for(i=0;i<size;i++)
  223. {
  224. if((abs(pstKic->uiHactive - SupportResolutionMode[i][0]) <= 2) && (pstKic->uiVactive == SupportResolutionMode[i][1]))
  225. {
  226. hdmidbg("Support Resolution mode!!\n");
  227. SupportFlag = true;
  228. break;
  229. }
  230. }
  231. return SupportFlag;
  232. }
  233. #if 0
  234. static BOOL HDMI_VideoNotSupport(VIP_InterfaceKIC *pstKic)
  235. {
  236. BOOL NotSupport = false;
  237. ULONG pixel_clk_freq = 0;
  238. pixel_clk_freq = get_pixel_clock();
  239. // hdmidbg("pixel clk:0x%x HDMI=%d\n",HDMI_RegisterRead(HDMIRX_R_pixel_rate_cnt) , HDMI_RegisterRead(HDMIRX_R_HDMI_en));
  240. // if((HDMI_RegisterRead(HDMIRX_R_pixel_rate_cnt) > 0x6e0) && (pstKic->uiHactive <= 2560)) //8506 VIP pixel clock limitation = 162MHz
  241. // {
  242. // NotSupport = true;
  243. // }
  244. if((pixel_clk_freq >= 165000000) && (pstKic->uiHactive <= 2560))
  245. {
  246. NotSupport = true;
  247. }
  248. return NotSupport;
  249. }
  250. #endif
  251. void HDMI_GetVideoTimingTable(void)
  252. {
  253. GetCustomerData("gHDMI_VideoTimingTable", (void *)&pHDMIVideoTimingTable, &u32HDMIVideoTimingTblSize);
  254. //Calc Table Size
  255. u32HDMIVideoTimingTblSize = u32HDMIVideoTimingTblSize/sizeof(HDMI_TIMING_PARAM_t);
  256. }
  257. UINT8 HDMI_GetInputInformation(VIP_InterfaceKIC *pstKic) // return value: 0 - Not Support, 1 - Support, 2 - No signale
  258. {
  259. UINT8 ucModeSupport = 1; //Support
  260. UINT32 Vactive_o, Vactive_e;
  261. ULONG pixel_clk_freq = 0, vfreq = 0;
  262. INT32 iWait= 500;
  263. UINT8 hdmi_frmcnt = 0;
  264. UINT8 hdmi_frmcnt_debounce = 50;
  265. UINT8 hdmi_frmcnt_check=0;
  266. UINT32 Vtotal;
  267. UINT16 usHSyncCnt = 0;
  268. HScalerDownFlag = FALSE;
  269. pstKic->ucInputSource = HDMI;
  270. usHSyncCnt = VIP_RegisterRead(VIP_sta_hdmi_hs_lcnt);
  271. if(usHSyncCnt)
  272. pstKic->uiHfreq =(SYSTEM_CLK/10)/usHSyncCnt;
  273. else
  274. pstKic->uiHfreq =0;
  275. pstKic->ucFrameRate = -1;
  276. if(HDMI_RegisterRead(HDMIRX_R_HT)==0)
  277. {
  278. iWait= 500;
  279. printk("%s:HDMIRX_R_HT == 0!!!!!!\n", __FUNCTION__);
  280. while (iWait>0)
  281. {
  282. if((VIP_RegisterRead(VIP_sta_hdmi_hs_active)==TRUE)&&
  283. (VIP_RegisterRead(VIP_sta_hdmi_vs_active)==TRUE))
  284. {
  285. break;
  286. }
  287. HDMI_DelayMs(1);
  288. iWait--;
  289. }
  290. if(iWait == 0)
  291. {
  292. printk("%s:Reach Wait Limit 500Ms!!\n", __FUNCTION__);
  293. }
  294. else
  295. {
  296. iWait= 1000;
  297. hdmi_frmcnt_check=0;
  298. printk("%s:HDMIRX_R_HT == 0!!!!!!\n", __FUNCTION__);
  299. while ((iWait>0) && (hdmi_frmcnt_check < hdmi_frmcnt_debounce))
  300. {
  301. if(1 < abs(hdmi_frmcnt-VIP_RegisterRead(VIP_sta_hdmi_frmcnt)))
  302. {
  303. hdmi_frmcnt=VIP_RegisterRead(VIP_sta_hdmi_frmcnt);
  304. hdmi_frmcnt_check=0;
  305. }
  306. else
  307. {
  308. hdmi_frmcnt_check++;
  309. }
  310. HDMI_DelayMs(1);
  311. iWait--;
  312. }
  313. if(iWait == 0)
  314. {
  315. printk("%s:Reach Wait Limit 1000Ms!!\n", __FUNCTION__);
  316. }
  317. vfreq = 6000 /(hdmi_frmcnt+1);
  318. }
  319. }
  320. /* Interlace */
  321. pstKic->bInterlace = HDMI_RegisterRead(HDMIRX_R_Interlace);
  322. /* Vertical */
  323. Vactive_o = HDMI_RegisterRead(HDMIRX_top_de_v_width_lock);
  324. Vactive_e = HDMI_RegisterRead(HDMIRX_btn_de_v_width_lock);
  325. //HW issue:workaround for front porch = 0 case, hw VDEE report is wrong -- start --
  326. if(((INT32)(HDMI_RegisterRead(HDMIRX_R_TOP_VDEE) - HDMI_RegisterRead(HDMIRX_R_TOP_VDES))) < 0)
  327. {
  328. Vactive_o = Vactive_o + 1;
  329. }
  330. if(((INT32)(HDMI_RegisterRead(HDMIRX_R_BTM_VDEE) - HDMI_RegisterRead(HDMIRX_R_BTM_VDES))) < 0)
  331. {
  332. Vactive_e = Vactive_e + 1;
  333. }
  334. //HW issue:workaround for front porch = 0 case, hw VDEE report is wrong -- end --
  335. if (Vactive_o != 0)
  336. {
  337. pstKic->uiVactive = Vactive_o;
  338. pstKic->uiVtotal = HDMI_RegisterRead(HDMIRX_R_TOP_VT);
  339. pstKic->uiVstart = HDMI_RegisterRead(HDMIRX_R_TOP_VDES);
  340. }
  341. else
  342. {
  343. pstKic->uiVactive = Vactive_e;
  344. pstKic->uiVtotal = HDMI_RegisterRead(HDMIRX_R_BTM_VT);
  345. pstKic->uiVstart = HDMI_RegisterRead(HDMIRX_R_BTM_VDES);
  346. }
  347. //for 487i, top Vactive = 244, bottom Vactive = 243, if send 244 to VIP, the last line will be garbage
  348. if(pstKic->bInterlace == 1)
  349. {
  350. if(Vactive_o == (Vactive_e + 1))
  351. pstKic->uiVactive = Vactive_e;
  352. else
  353. pstKic->uiVactive = Vactive_o;
  354. }
  355. pstKic->uiVend = pstKic->uiVstart + pstKic->uiVactive ;
  356. /* Horizontal */
  357. pstKic->uiHactive = HDMI_RegisterRead(HDMIRX_de_h_width_lock) / (HDMI_RegisterRead(HDMIRX_R_AVI_PR) + 1);
  358. /* Patch: hactive should be a even number in DVI mode */
  359. if (HDMI_RegisterRead(HDMIRX_R_HDMI_en) == 0)
  360. {
  361. pstKic->uiHactive &= 0xfffffffe;
  362. }
  363. pstKic->uiHtotal = HDMI_RegisterRead(HDMIRX_R_HT) + 1;
  364. pstKic->uiHstart = HDMI_RegisterRead(HDMIRX_R_HDES) + 1;
  365. pstKic->uiHend = pstKic->uiHstart + pstKic->uiHactive;
  366. /* Other */
  367. pstKic->ucVpol = HDMI_RegisterRead(HDMIRX_R_Vsync_Polarity);
  368. pstKic->ucHpol = HDMI_RegisterRead(HDMIRX_R_Hsync_Polarity);
  369. pstKic->bDviEnable = HDMI_RegisterRead(HDMIRX_R_HDMI_en) ? 0 : 1;
  370. /* Color format */
  371. pstKic->ucDataFormat = get_pixel_fmt();
  372. /* Patch: In order to improve picture quality, transform YCC444 to YCC422 for SD resolution */
  373. if (HDMI_RegisterRead(HDMIRX_R_AVI_Y) == AVI_Y_YCC444 && HDMI_RegisterRead(HDMIRX_R_HDMI_en) &&
  374. ((pstKic->uiHactive == 720) &&
  375. (pstKic->uiVactive == 480 || pstKic->uiVactive == 240 || pstKic->uiVactive == 576 || pstKic->uiVactive == 288)))
  376. {
  377. hdmidbg("YC444toYC422 for SD\n");
  378. HDMI_RegisterWrite(HDMIRX_R_DnSAMPLING_EN, 1);
  379. pstKic->ucDataFormat = YUV_422;
  380. }
  381. pstKic->ucR_AVI_S = HDMI_RegisterRead(HDMIRX_R_AVI_S);
  382. pstKic->ucITC = HDMI_RegisterRead(HDMIRX_AVI_ITC);
  383. pstKic->ucColorimetry = get_colorimetry((pstKic->uiVactive * (pstKic->bInterlace + 1)));
  384. pstKic->ucAspectRatio = get_ratio();
  385. //pstKic->ucxvYCC = get_xvYCC();
  386. if(pstKic->bDviEnable == 1) //DVI mode, RGB range is full range
  387. pstKic->ucRGBRange = 2;
  388. else
  389. {
  390. pstKic->ucRGBRange = HDMI_RegisterRead(HDMIRX_AVI_Q);
  391. if(pstKic->ucRGBRange == 0) //in CEA-861-D spec.: if RGB Range = default, RGB pixel data values should be assumed to have the limited range when receiving a CE video format, and the full range when receiving an IT format.
  392. {
  393. if(HDMI_RegisterRead(HDMIRX_AVI_ITC) == 1) //IT format
  394. pstKic->ucRGBRange = 2; //full range
  395. else
  396. pstKic->ucRGBRange = 0; //Default
  397. }
  398. }
  399. pstKic->uc3DStructure = get_3d_fmt();
  400. /* Patch: Sel field pol for 1080i */
  401. if (HDMI_RegisterRead(HDMIRX_R_Interlace) == 1 && pstKic->uiVactive == 540 &&
  402. (HDMI_RegisterRead(HDMIRX_R_TOP_VDES) + 1) != HDMI_RegisterRead(HDMIRX_R_BTM_VDES))
  403. {
  404. HDMI_RegisterWrite(HDMIRX_R_FIELD_POL, 1);
  405. }
  406. else
  407. {
  408. HDMI_RegisterWrite(HDMIRX_R_FIELD_POL, 0);
  409. }
  410. pixel_clk_freq = get_pixel_clock();
  411. if (HDMI_RegisterRead(HDMIRX_R_Interlace) == 1)
  412. {
  413. Vtotal = HDMI_RegisterRead(HDMIRX_R_BTM_VT);
  414. }
  415. else
  416. {
  417. Vtotal = pstKic->uiVtotal ;
  418. }
  419. /* get vfreq */
  420. if ((pstKic->uiHtotal > 1) && Vtotal) //H total = HDMIRX_R_HT + 1
  421. {
  422. vfreq = (pixel_clk_freq + ((pstKic->uiHtotal * Vtotal) >> 1)) / (pstKic->uiHtotal * Vtotal);
  423. }
  424. /*
  425. else
  426. {
  427. vfreq = 0;
  428. }
  429. */
  430. /*
  431. switch (HDMI_RegisterRead(HDMIRX_dcm)) //0xbe0e00dc[1:0]
  432. {
  433. case 0: // DCM Factor =1
  434. //hdmidbg("%s>> VFreq = %ld Hz = (((0x%lx+((0x%x*0x%x)>>1))/(0x%x*0x%x)))/1\n", __FUNCTION__, vfreq, pixel_clk_freq, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHtotal, pstKic->uiVtotal);
  435. break;
  436. case 1: // DCM Factor =1.25
  437. vfreq = (vfreq << 2) / 5; // divide 1.25=*4/5
  438. //hdmidbg("%s>> VFreq = %ld Hz = (((0x%lx+((0x%x*0x%x)>>1))/(0x%x*0x%x)))/1.25\n", __FUNCTION__, vfreq, pixel_clk_freq, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHtotal, pstKic->uiVtotal);
  439. break;
  440. case 2: // DCM Factor =1.5
  441. vfreq = (vfreq << 1) / 3; // devide 1.5=*2/3
  442. //hdmidbg("%s>> VFreq = %ld Hz = (((0x%lx+((0x%x*0x%x)>>1))/(0x%x*0x%x)))/1.5\n", __FUNCTION__, vfreq, pixel_clk_freq, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHtotal, pstKic->uiVtotal);
  443. break;
  444. case 3: // DCM Factor =2
  445. vfreq = vfreq >> 1;
  446. //hdmidbg("%s>> VFreq = %ld Hz = (((0x%lx+((0x%x*0x%x)>>1))/(0x%x*0x%x)))/2\n", __FUNCTION__, vfreq, pixel_clk_freq, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHtotal, pstKic->uiVtotal);
  447. break;
  448. default : // DCM Factor =1
  449. //hdmidbg("%s>> (Default) VFreq = %ld Hz = (((0x%lx+((0x%x*0x%x)>>1))/(0x%x*0x%x)))/1\n", __FUNCTION__, vfreq, pixel_clk_freq, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHtotal, pstKic->uiVtotal);
  450. break;
  451. }
  452. */
  453. if((pixel_clk_freq >= 165000000) && (pstKic->uiHactive < 2560))
  454. {
  455. ucModeSupport = 0; // Not Support
  456. }
  457. else if ((pstKic->uiHtotal != 0) && pstKic->uiVtotal != 0)
  458. {
  459. if (vfreq == 73)
  460. {
  461. vfreq = 72; // the experience from VIP
  462. }
  463. else if (vfreq == 59 || vfreq == 61)
  464. {
  465. vfreq = 60; // the experience from VIP
  466. }
  467. else if (vfreq == 74)
  468. {
  469. vfreq = 75; // the experience from VIP
  470. }
  471. else if (vfreq == 49)
  472. {
  473. vfreq = 50; // the experience from VIP
  474. }
  475. else if (vfreq == 57)
  476. {
  477. vfreq = 56;
  478. }
  479. else if (vfreq == 86)
  480. {
  481. vfreq = 85;
  482. }
  483. else if (vfreq == 76)
  484. {
  485. vfreq = 75;
  486. }
  487. else if (vfreq == 71)
  488. {
  489. vfreq = 70;
  490. }
  491. else if (vfreq == 23)
  492. {
  493. vfreq = 24;
  494. }
  495. }
  496. else
  497. {
  498. hdmidbg("else:Htotal %d Vtotal %d\n",pstKic->uiHtotal, pstKic->uiVtotal);
  499. }
  500. pstKic->uiVfreq = vfreq;
  501. printk("[H] VHz:%d \n",pstKic->uiVfreq);
  502. if(vfreq > gbSupportMaxHz)
  503. {
  504. hdmidbg("VHz not support, Max is %d \n", gbSupportMaxHz);
  505. ucModeSupport = 0;
  506. }
  507. if(ucModeSupport == 1)
  508. {
  509. ucModeSupport = HDMI_CheckSupportResolutionMode(pstKic);
  510. }
  511. #ifndef CONFIG_SUPPORT_4K_2K_30
  512. if((pstKic->uiHactive > 2000)||(pstKic->uiVactive > 1500))// 4kx2K not support
  513. {
  514. hdmidbg("not support 4kx2K\n");
  515. ucModeSupport = 0;
  516. }
  517. #endif
  518. pstKic->uiTimingIndex = get_VideoID(pstKic);
  519. #ifdef CONFIG_SUPPORT_DEBUG_MESSAGE
  520. print_video_timing();
  521. #ifdef HDMI_SHOW_AVI_INFO
  522. print_avi_info();
  523. #endif
  524. #endif
  525. print_send_to_vip_info(pstKic);
  526. if (pstKic->uiHactive == 0 && pstKic->uiVactive == 0)
  527. {
  528. hdmidbg("HAct=0 & VAct=0. \n");
  529. ucModeSupport = 2; // Regard it as "No Signal". SW Workaround
  530. }
  531. #ifdef CONFIG_SUPPORT_4K_2K_30
  532. pstKic->ucEnlargeWidthRate = 0;
  533. if (pstKic->uiHactive == 3840)
  534. {
  535. hdmidbg("......4K x 2K.....\n");
  536. pstKic->uiHactive = (pstKic->uiHactive)/2;
  537. pstKic->uiHtotal = (pstKic->uiHtotal)/2;
  538. pstKic->uiHstart = (pstKic->uiHstart)/2 ;
  539. pstKic->uiHend = (pstKic->uiHend)/2;
  540. *((u8 *)0xbe000257) = 0x18 ;
  541. pstKic->ucEnlargeWidthRate = 1;
  542. HScalerDownFlag = TRUE;
  543. }
  544. else if (pstKic->uiHactive >= 2560)
  545. {
  546. hdmidbg("......H Scale Down.....\n");
  547. pstKic->uiHactive = (pstKic->uiHactive)/2;
  548. pstKic->uiHtotal = (pstKic->uiHtotal)/2;
  549. pstKic->uiHstart = (pstKic->uiHstart)/2 ;
  550. pstKic->uiHend = (pstKic->uiHend)/2;
  551. *((u8 *)0xbe000257) = 0x18 ;
  552. pstKic->ucEnlargeWidthRate = 1;
  553. HScalerDownFlag = TRUE;
  554. }
  555. else
  556. {
  557. *((u8 *)0xbe000257) = 0x01 ;//Bit0: 1 => Bypass mode
  558. }
  559. #endif
  560. /*
  561. if((1 == ucModeSupport) && (pstKic->bDviEnable == FALSE))
  562. {
  563. if((pstKic->bDviEnable == FALSE) && (0x00000000 == (HDMI_RegisterRead(HDMIRX_0134_DW_0134))))
  564. {
  565. printk(KERN_EMERG"Hdmi have no avi info data!!\n");
  566. ucModeSupport = 2;
  567. }
  568. }
  569. */
  570. return ucModeSupport;
  571. }
  572. void HDMI_VSI_handler(void)
  573. {
  574. hdmidbg("Get VSI PB\n");
  575. // HDMIRX_R_VSI_PB_7_0_ bit 7 ~ bit 5(HDMI_Video_Format):
  576. // 000 - No additional HDMI video format
  577. // 001 - 1 byte of parameter value follows
  578. // 010 - 3D format
  579. // HDMIRX_R_VSI_PB__15_8_ bit 7 ~ bit 4(3D_Structure):
  580. // 0000 - Frame packing
  581. // 0110 - Top-and Bottom
  582. // 1000 - Side-by-Side(Half)
  583. // HDMIRX_R_VSI_PB_23_16_ bit 7 ~ bit 4(3D_Ext_Data):
  584. // 00xx - Horizontal sub-sampling
  585. // 0100 - Odd/Left pic Odd/Right pic
  586. // 0101 - Odd/Left pic Even/Right pic
  587. // 0110 - Even/Left pic Odd/Right pic
  588. // 0111 - Even/Left pic Even/Right pic
  589. #if 0
  590. #define VSI_VIDEO_FMT_3D_FMT 0x2
  591. if ((HDMI_RegisterRead(HDMIRX_R_VSI_PB_7_0_) >> 5) == VSI_VIDEO_FMT_3D_FMT)
  592. {
  593. UINT8 uc3D_Struc = (HDMI_RegisterRead(HDMIRX_R_VSI_PB__15_8_) >> 4);
  594. if ((uc3D_Struc & 0xc) || (uc3D_Struc == 0x7))
  595. {
  596. uc3D_Struc = NONE_3D; // unused. Set 2D
  597. }
  598. if (Active_flag)
  599. {
  600. VIP_SourceScreenMode(HDMI, BlackScreen, __LINE__);
  601. ModeSupport_flag = HDMI_SendVipInfo();
  602. VIP_SourceScreenMode(HDMI, NormalScreen, __LINE__);
  603. }
  604. }
  605. #endif
  606. }
  607. BOOL HDMI_IsAviChanged(VIP_InterfaceKIC *pstKic)
  608. {
  609. BOOL ret = false;
  610. UINT32 bCurHactive = HDMI_RegisterRead(HDMIRX_de_h_width_lock) / (HDMI_RegisterRead(HDMIRX_R_AVI_PR) + 1);
  611. UINT8 bCurPixelFormat = get_pixel_fmt();
  612. UINT8 bCurAspectRatio = get_ratio();
  613. UINT8 bCurDviEnable = HDMI_RegisterRead(HDMIRX_R_HDMI_en) ? 0 : 1;
  614. if(bCurHactive == pstKic->uiHactive)
  615. {
  616. if(bCurPixelFormat != pstKic->ucDataFormat)
  617. {
  618. hdmidbg("Pixel Format change %d->%d\n",pstKic->ucDataFormat, bCurPixelFormat);
  619. pstKic->ucDataFormat = bCurPixelFormat;
  620. ret = true;
  621. }
  622. if(bCurAspectRatio != pstKic->ucAspectRatio)
  623. {
  624. hdmidbg("Aspect Ratio change %d->%d\n",pstKic->ucAspectRatio, bCurAspectRatio);
  625. pstKic->ucAspectRatio = bCurAspectRatio;
  626. ret = true;
  627. }
  628. if(bCurDviEnable != pstKic->bDviEnable)
  629. {
  630. hdmidbg("Hdmi/Dvi mode change %d->%d\n",pstKic->bDviEnable, bCurDviEnable);
  631. pstKic->bDviEnable = bCurDviEnable;
  632. ret = true;
  633. }
  634. }
  635. return ret;
  636. }
  637. void HDMI_SetSupportMaxHz(UINT8 bSupportMaxHz)
  638. {
  639. gbSupportMaxHz = bSupportMaxHz;
  640. hdmidbg("Support Max Hz:%d\n", gbSupportMaxHz);
  641. }
  642. #ifdef CONFIG_SUPPORT_DEBUG_MESSAGE
  643. #ifdef HDMI_SHOW_AVI_INFO
  644. /* Note: debug use only */
  645. static void print_avi_info(void)
  646. {
  647. /* Auxiliary Video Information. Check CEA-861-D for more details */
  648. hdmidbg("AVI Info\n");
  649. hdmidbg("version: 0x%x (Must be 0x2)\n", HDMI_RegisterRead(HDMIRX_R_AVI_Ver));
  650. hdmidbg("Pixel color format (Y=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_Y),
  651. HDMI_RegisterRead(HDMIRX_R_AVI_Y) == 0x0 ? "RGB" :
  652. HDMI_RegisterRead(HDMIRX_R_AVI_Y) == 0x1 ? "YCbCr422" :
  653. HDMI_RegisterRead(HDMIRX_R_AVI_Y) == 0x2 ? "YCbCr444" : "Future use"
  654. );
  655. hdmidbg("Bar Info (B=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_B),
  656. HDMI_RegisterRead(HDMIRX_R_AVI_B) == 0x0 ? "Not valid" :
  657. HDMI_RegisterRead(HDMIRX_R_AVI_B) == 0x1 ? "Vertical Bar Info Valid" :
  658. HDMI_RegisterRead(HDMIRX_R_AVI_B) == 0x2 ? "Horizontal Bar Info Valid" :
  659. HDMI_RegisterRead(HDMIRX_R_AVI_B) == 0x3 ? "Horizontal/Vertical Bar Info Valid" : ""
  660. );
  661. hdmidbg("Scan Info (S=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_S),
  662. HDMI_RegisterRead(HDMIRX_R_AVI_S) == 0x0 ? "No Data" :
  663. HDMI_RegisterRead(HDMIRX_R_AVI_S) == 0x1 ? "Overscanned" :
  664. HDMI_RegisterRead(HDMIRX_R_AVI_S) == 0x2 ? "Underscanned" : "Future use"
  665. );
  666. hdmidbg("Colorimetry (C=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_C),
  667. HDMI_RegisterRead(HDMIRX_R_AVI_C) == 0x0 ? "No data" :
  668. HDMI_RegisterRead(HDMIRX_R_AVI_C) == 0x1 ? "ITU601" :
  669. HDMI_RegisterRead(HDMIRX_R_AVI_C) == 0x2 ? "ITU709" :
  670. HDMI_RegisterRead(HDMIRX_R_AVI_C) == 0x3 ? "Extended(Check EC)" : ""
  671. );
  672. hdmidbg("Picture Aspect Ratio (M=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_M),
  673. HDMI_RegisterRead(HDMIRX_R_AVI_M) == 0x0 ? "No data" :
  674. HDMI_RegisterRead(HDMIRX_R_AVI_M) == 0x1 ? "4:3" :
  675. HDMI_RegisterRead(HDMIRX_R_AVI_M) == 0x2 ? "16:9" : "Future use"
  676. );
  677. hdmidbg("Active Format Aspect Ratio (R=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_R),
  678. HDMI_RegisterRead(HDMIRX_R_AVI_R) == 0x8 ? "Same as picutre aspect ratio" :
  679. HDMI_RegisterRead(HDMIRX_R_AVI_R) == 0x9 ? "4:3(Center)" :
  680. HDMI_RegisterRead(HDMIRX_R_AVI_R) == 0xA ? "16:9(Center)" :
  681. HDMI_RegisterRead(HDMIRX_R_AVI_R) == 0xB ? "14:9(Center)" : "Per DVB AFD active_format field"
  682. );
  683. hdmidbg("IT Content(ITC=%d): %s\n", HDMI_RegisterRead(HDMIRX_AVI_ITC),
  684. HDMI_RegisterRead(HDMIRX_AVI_ITC) == 0x0 ? "No data" : "IT Content"
  685. );
  686. hdmidbg("Gamut Metadata packet %d\n", HDMI_RegisterRead(HDMIRX_R_GBD_exist));
  687. // if( HDMI_RegisterRead(HDMIRX_R_GBD_exist) )
  688. // {
  689. hdmidbg("Extended Colorimetry (EC=%d): %s\n", HDMI_RegisterRead(HDMIRX_AVI_EC),
  690. HDMI_RegisterRead(HDMIRX_AVI_EC) == 0x0 ? "xvYCC601" :
  691. HDMI_RegisterRead(HDMIRX_AVI_EC) == 0x1 ? "xvYCC709" : "Reserved"
  692. );
  693. // }
  694. hdmidbg("RGB Quantizatio n Range (Q=%d): %s\n", HDMI_RegisterRead(HDMIRX_AVI_Q),
  695. HDMI_RegisterRead(HDMIRX_AVI_Q) == 0x0 ? "Default" :
  696. HDMI_RegisterRead(HDMIRX_AVI_Q) == 0x1 ? "Limited Range" :
  697. HDMI_RegisterRead(HDMIRX_AVI_Q) == 0x2 ? "Full Range" : "Reserved"
  698. );
  699. hdmidbg("Non-Uniform Picture Scaling (SC=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_SC),
  700. HDMI_RegisterRead(HDMIRX_R_AVI_SC) == 0x0 ? "No known non-uniform scaling" :
  701. HDMI_RegisterRead(HDMIRX_R_AVI_SC) == 0x1 ? "Scaled horizontally" :
  702. HDMI_RegisterRead(HDMIRX_R_AVI_SC) == 0x2 ? "Scaled vertically" :
  703. HDMI_RegisterRead(HDMIRX_R_AVI_SC) == 0x3 ? "Scaled horizontally and vertically" : ""
  704. );
  705. hdmidbg("Pixel Repetition Factor (PR): %d\n", HDMI_RegisterRead(HDMIRX_R_AVI_PR));
  706. hdmidbg("Video Codes (VIC=%d): %s\n", HDMI_RegisterRead(HDMIRX_R_AVI_VIC),
  707. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 1) ? "640x480p @ 59.94/60Hz" :
  708. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 2 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 3) ? "720x480p @ 59.94/60Hz" :
  709. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 4) ? "1280x720p @ 59.94/60Hz" :
  710. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 5) ? "1920x1080i @ 59.94/60Hz" :
  711. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 6 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 7) ? "720(1440)x480i @ 59.94/60Hz" :
  712. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 8 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 9) ? "720(1440)x240p @ 59.94/60Hz" :
  713. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 10 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 11) ? "2880x480i @ 59.94/60Hz" :
  714. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 12 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 13) ? "2880x240p @ 59.94/60Hz" :
  715. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 14 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 15) ? "1440x480p @ 59.94/60Hz" :
  716. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 16) ? "1920x1080p @ 59.94/60Hz" :
  717. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 17 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 18) ? "720x576p @ 50Hz" :
  718. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 19) ? "1280x720p @ 50Hz" :
  719. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 20) ? "1920x1080i @ 50Hz" :
  720. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 21 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 22) ? "720(1440)x576i @ 50Hz" :
  721. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 23 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 24) ? "720(1440)x288p @ 50Hz" :
  722. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 25 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 26) ? "2880x576i @ 50Hz" :
  723. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 27 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 28) ? "2880x288p @ 50Hz" :
  724. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 29 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 30) ? "1440x576p @ 50Hz" :
  725. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 31) ? "1920x1080p @ 50Hz" :
  726. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 32) ? "1920x1080p @ 23.98/24Hz" :
  727. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 33) ? "1920x1080p @ 25Hz" :
  728. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 34) ? "1920x1080p @ 29.98/30Hz" :
  729. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 35 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 36) ? "2880x480p @ 59.94/60Hz" :
  730. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 37 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 38) ? "2880x576p @ 50Hz" :
  731. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 39) ? "1920x1080i(1250) @ 50Hz" :
  732. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 40) ? "1920x1080i @ 100Hz" :
  733. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 41) ? "1280x720p @ 100Hz" :
  734. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 42 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 43) ? "720x576p @ 100Hz" :
  735. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 44 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 45) ? "720(1440)x576i @ 100Hz" :
  736. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 46) ? "1920x1080i @ 119.88/120Hz" :
  737. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 47) ? "1920x720p @ 119.88/120Hz" :
  738. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 48 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 49) ? "720x480p @ 119.88/120Hz" :
  739. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 50 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 51) ? "720(1440)x480i @ 119.88/120Hz" :
  740. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 52 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 53) ? "720x576p @ 200Hz" :
  741. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 54 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 55) ? "720(1440)x576i @ 200Hz" :
  742. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 56 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 57) ? "720x480p @ 239.76/240Hz" :
  743. (HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 58 || HDMI_RegisterRead(HDMIRX_R_AVI_VIC) == 59) ? "720(1440)x480i @ 239.76/240Hz" : "Can't supported"
  744. );
  745. hdmidbg("Start line number : %d\n", HDMI_RegisterRead(HDMIRX_R_AVI_SLN));
  746. hdmidbg("End line number : %d\n", HDMI_RegisterRead(HDMIRX_R_AVI_ELN));
  747. hdmidbg("Start pixel number: %d\n", HDMI_RegisterRead(HDMIRX_R_AVI_SPN));
  748. hdmidbg("End pixel number : %d\n", HDMI_RegisterRead(HDMIRX_R_AVI_EPN));
  749. }
  750. #endif
  751. static void print_video_timing(void)
  752. {
  753. hdmidbg("Print Video Timing info:\n");
  754. hdmidbg("V Top:\n\tTotal:%d\n\tDE Start:%d, End: %d, sw_Valid:%d\n\thw_Valid:%d\n", HDMI_RegisterRead(HDMIRX_R_TOP_VT), HDMI_RegisterRead(HDMIRX_R_TOP_VDES), HDMI_RegisterRead(HDMIRX_R_TOP_VDEE), HDMI_RegisterRead(HDMIRX_R_TOP_VDEE) - HDMI_RegisterRead(HDMIRX_R_TOP_VDES), HDMI_RegisterRead(HDMIRX_top_de_v_width_lock));
  755. hdmidbg("V Bottom:\n\tTotal:%d\n\tDE Start:%d, End: %d, sw_Valid:%d\n\thw_Valid:%d\n", HDMI_RegisterRead(HDMIRX_R_BTM_VT), HDMI_RegisterRead(HDMIRX_R_BTM_VDES), HDMI_RegisterRead(HDMIRX_R_BTM_VDEE), HDMI_RegisterRead(HDMIRX_R_BTM_VDEE) - HDMI_RegisterRead(HDMIRX_R_BTM_VDES), HDMI_RegisterRead(HDMIRX_btn_de_v_width_lock));
  756. hdmidbg("H:\n\tTotal:%d\n\tDE Start:%d, End:%d, sw_valid:%d\n\thw_Valid:%d\n", HDMI_RegisterRead(HDMIRX_R_HT) + 1, HDMI_RegisterRead(HDMIRX_R_HDES) + 1, HDMI_RegisterRead(HDMIRX_R_HDEE) + 1, HDMI_RegisterRead(HDMIRX_R_HDEE) - HDMI_RegisterRead(HDMIRX_R_HDES), HDMI_RegisterRead(HDMIRX_de_h_width_lock));
  757. hdmidbg("Other:\n");
  758. hdmidbg("\tV Sync Polarity:%d\n", HDMI_RegisterRead(HDMIRX_R_Vsync_Polarity));
  759. hdmidbg("\tH Sync Polarity:%d\n", HDMI_RegisterRead(HDMIRX_R_Hsync_Polarity));
  760. hdmidbg("\tInterlace:%d\n", HDMI_RegisterRead(HDMIRX_R_Interlace));
  761. hdmidbg("\tHDMI mode:%d\n", HDMI_RegisterRead(HDMIRX_R_HDMI_en));
  762. hdmidbg("\tpixel repitition:%d\n", HDMI_RegisterRead(HDMIRX_R_PR_EN));
  763. hdmidbg("\tdeep color:%d\n", HDMI_RegisterRead(HDMIRX_dcm));
  764. }
  765. #endif
  766. static void print_send_to_vip_info(VIP_InterfaceKIC *pstKic)
  767. {
  768. printk("[H]Print Send to VIP info:\n");
  769. printk("[H]\tID:0x%x HT:%d VT:%d HA:%d VA:%d\n\tHStart:%d HEnd:%d VStart:%d VEnd:%d VHz:%d Inter:%d\n", pstKic->uiTimingIndex, pstKic->uiHtotal, pstKic->uiVtotal, pstKic->uiHactive , pstKic->uiVactive,
  770. pstKic->uiHstart, pstKic->uiHend, pstKic->uiVstart, pstKic->uiVend, pstKic->uiVfreq,
  771. pstKic->bInterlace);
  772. printk("[H]\tdata format:%d range:%d AR:0x%x ITC:%d\n", pstKic->ucDataFormat, pstKic->ucRGBRange, pstKic->ucAspectRatio, pstKic->ucITC);
  773. }