mt8193edid.c 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754
  1. #ifdef HDMI_MT8193_SUPPORT
  2. #include <linux/interrupt.h>
  3. #include <linux/i2c.h>
  4. #include <linux/slab.h>
  5. #include <linux/irq.h>
  6. #include <linux/miscdevice.h>
  7. #include <asm/uaccess.h>
  8. #include <linux/delay.h>
  9. #include <linux/input.h>
  10. #include <linux/workqueue.h>
  11. #include <linux/kobject.h>
  12. #ifdef CONFIG_HAS_EARLYSUSPEND
  13. #include <linux/earlysuspend.h>
  14. #endif
  15. #include <linux/platform_device.h>
  16. #include <asm/atomic.h>
  17. #include <linux/init.h>
  18. #include <linux/module.h>
  19. #include <linux/sched.h>
  20. #include <linux/kthread.h>
  21. #include <linux/bitops.h>
  22. #include <linux/kernel.h>
  23. #include <linux/byteorder/generic.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/time.h>
  26. #include <linux/rtpm_prio.h>
  27. #include <linux/dma-mapping.h>
  28. #include <linux/syscalls.h>
  29. #include <linux/reboot.h>
  30. #include <linux/vmalloc.h>
  31. #include <linux/fs.h>
  32. #include <linux/string.h>
  33. #include <linux/completion.h>
  34. #include <linux/types.h>
  35. #include <linux/types.h>
  36. #include "mt8193_ctrl.h"
  37. #include "mt8193ddc.h"
  38. #include "mt8193edid.h"
  39. #include "mt8193hdcp.h"
  40. static HDMI_SINK_AV_CAP_T _HdmiSinkAvCap;
  41. static unsigned char _fgHdmiNoEdidCheck = FALSE;
  42. static unsigned int _u4i_3D_VIC;
  43. static unsigned int _ui4First_16_NTSC_VIC;
  44. static unsigned int _ui4First_16_PAL_VIC;
  45. static unsigned int _ui4First_16_VIC[16];
  46. static unsigned char _bEdidData[EDID_SIZE]; /* 4 block 512 Bytes */
  47. static unsigned char aEDIDHeader[EDID_HEADER_LEN] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
  48. static unsigned char aEDIDVSDBHeader[EDID_VSDB_LEN] = { 0x03, 0x0c, 0x00 };
  49. static unsigned char _bEdidData2[256] = {
  50. 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
  51. 0x4d, 0xd9, 0x02, 0xd7, 0x01, 0x01, 0x01, 0x01,
  52. 0x20, 0x16, 0x01, 0x03, 0x80, 0xa0, 0x5a, 0x78,
  53. 0x0a, 0x83, 0xad, 0xa2, 0x56, 0x49, 0x9b, 0x25,
  54. 0x0f, 0x47, 0x4a, 0x20, 0x00, 0x00, 0x01, 0x01,
  55. 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  56. 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1d,
  57. 0x00, 0x72, 0x51, 0xd0, 0x1e, 0x20, 0x6e, 0x28,
  58. 0x55, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e,
  59. 0x01, 0x1d, 0x80, 0x18, 0x71, 0x1c, 0x16, 0x20,
  60. 0x58, 0x2c, 0x25, 0x00, 0x40, 0x84, 0x63, 0x00,
  61. 0x00, 0x9e, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x53,
  62. 0x4f, 0x4e, 0x59, 0x20, 0x54, 0x56, 0x0a, 0x20,
  63. 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd,
  64. 0x00, 0x3a, 0x3e, 0x0f, 0x44, 0x0f, 0x00, 0x0a,
  65. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x6b,
  66. 0x02, 0x03, 0x30, 0xf5, 0x45, 0x10, 0x04, 0x05,
  67. 0x03, 0x20, 0x35, 0x0f, 0x7f, 0x07, 0x15, 0x07,
  68. 0x55, 0x3d, 0x1f, 0xc0, 0x57, 0x07, 0x00, 0x67,
  69. 0x54, 0x00, 0x5f, 0x7e, 0x01, 0x4d, 0x02, 0x00,
  70. 0x83, 0x5f, 0x00, 0x00, 0x68, 0x03, 0x0c, 0x00,
  71. 0x21, 0x00, 0x80, 0x1e, 0x0f, 0xe2, 0x00, 0x7b,
  72. 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40,
  73. 0x58, 0x2c, 0x45, 0x00, 0x40, 0x84, 0x63, 0x00,
  74. 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a, 0x20, 0xe0,
  75. 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00, 0x40, 0x84,
  76. 0x63, 0x00, 0x00, 0x18, 0x8c, 0x0a, 0xd0, 0x8a,
  77. 0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
  78. 0xb0, 0x84, 0x43, 0x00, 0x00, 0x18, 0x00, 0x00,
  79. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  80. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  81. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c
  82. };
  83. static const unsigned char _cFsStr[][7] = { {"32khz "},
  84. {"44khz "},
  85. {"48khz "},
  86. {"88khz "},
  87. {"96khz "},
  88. {"176khz "},
  89. {"192khz "}
  90. };
  91. static unsigned char cDstStr[50];
  92. bool fgIsHdmiNoEDIDCheck(void)
  93. {
  94. MT8193_EDID_FUNC();
  95. return _fgHdmiNoEdidCheck;
  96. }
  97. void vSetNoEdidChkInfo(void)
  98. {
  99. unsigned char bInx;
  100. MT8193_EDID_FUNC();
  101. vSetSharedInfo(SI_EDID_PARSING_RESULT, TRUE);
  102. vSetSharedInfo(SI_EDID_VSDB_EXIST, TRUE);
  103. _HdmiSinkAvCap.b_sink_support_hdmi_mode = TRUE;
  104. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution = 0xffffffff;
  105. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution = 0xffffffff;
  106. _HdmiSinkAvCap.ui4_sink_1st_dtd_ntsc_resolution = 0xffffffff;
  107. _HdmiSinkAvCap.ui4_sink_1st_dtd_pal_resolution = 0xffffffff;
  108. _HdmiSinkAvCap.ui2_sink_colorimetry = 0xffff;
  109. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution = 0xffffffff;
  110. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution = 0xffffffff;
  111. _HdmiSinkAvCap.ui2_sink_aud_dec = 0xffff;
  112. _HdmiSinkAvCap.ui1_sink_dsd_ch_num = 5;
  113. for (bInx = 0; bInx < 7; bInx++) {
  114. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bInx] = 0xff;
  115. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[bInx] = 0xff;
  116. _HdmiSinkAvCap.ui1_sink_dst_ch_sampling[bInx] = 0xff;
  117. }
  118. for (bInx = 0; bInx < 7; bInx++)
  119. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bInx] = 0xff;
  120. _HdmiSinkAvCap.ui1_sink_spk_allocation = 0xff;
  121. _HdmiSinkAvCap.e_sink_rgb_color_bit =
  122. (HDMI_SINK_DEEP_COLOR_10_BIT | HDMI_SINK_DEEP_COLOR_12_BIT |
  123. HDMI_SINK_DEEP_COLOR_16_BIT);
  124. _HdmiSinkAvCap.e_sink_ycbcr_color_bit =
  125. (HDMI_SINK_DEEP_COLOR_10_BIT | HDMI_SINK_DEEP_COLOR_12_BIT |
  126. HDMI_SINK_DEEP_COLOR_16_BIT);
  127. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup = 0;
  128. _HdmiSinkAvCap.ui1_sink_support_ai = 1;
  129. _HdmiSinkAvCap.b_sink_edid_ready = TRUE;
  130. _HdmiSinkAvCap.b_sink_3D_present = TRUE;
  131. _HdmiSinkAvCap.ui4_sink_cea_3D_resolution = 0xFFFFFFFF;
  132. _HdmiSinkAvCap.ui1_sink_max_tmds_clock = 0xFFFF;
  133. }
  134. void vClearEdidInfo(void)
  135. {
  136. unsigned char bInx;
  137. MT8193_EDID_FUNC();
  138. vSetSharedInfo(SI_EDID_PARSING_RESULT, FALSE);
  139. vSetSharedInfo(SI_EDID_VSDB_EXIST, FALSE);
  140. _HdmiSinkAvCap.b_sink_support_hdmi_mode = FALSE;
  141. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution = 0;
  142. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution = 0;
  143. _HdmiSinkAvCap.ui4_sink_1st_dtd_ntsc_resolution = 0;
  144. _HdmiSinkAvCap.ui4_sink_1st_dtd_pal_resolution = 0;
  145. _HdmiSinkAvCap.ui2_sink_colorimetry = 0;
  146. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution = 0;
  147. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution = 0;
  148. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution = 0;
  149. _HdmiSinkAvCap.ui4_sink_native_pal_resolution = 0;
  150. _HdmiSinkAvCap.ui2_sink_vcdb_data = 0;
  151. _HdmiSinkAvCap.ui2_sink_aud_dec = 0;
  152. _HdmiSinkAvCap.ui1_sink_dsd_ch_num = 0;
  153. for (bInx = 0; bInx < 7; bInx++) {
  154. if (bInx == 0)
  155. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bInx] = 0x07;
  156. else
  157. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bInx] = 0;
  158. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[bInx] = 0;
  159. _HdmiSinkAvCap.ui1_sink_dst_ch_sampling[bInx] = 0;
  160. }
  161. for (bInx = 0; bInx < 7; bInx++) {
  162. if (bInx == 0)
  163. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bInx] = 0x07;
  164. else
  165. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bInx] = 0;
  166. }
  167. _HdmiSinkAvCap.ui1_sink_spk_allocation = 0;
  168. _HdmiSinkAvCap.ui1_sink_i_latency_present = 0;
  169. _HdmiSinkAvCap.ui1_sink_p_latency_present = 0; /* kenny add 2010/4/25 */
  170. _HdmiSinkAvCap.ui1_sink_p_audio_latency = 0;
  171. _HdmiSinkAvCap.ui1_sink_p_video_latency = 0;
  172. _HdmiSinkAvCap.ui1_sink_i_audio_latency = 0;
  173. _HdmiSinkAvCap.ui1_sink_i_video_latency = 0;
  174. _HdmiSinkAvCap.e_sink_rgb_color_bit = HDMI_SINK_NO_DEEP_COLOR;
  175. _HdmiSinkAvCap.e_sink_ycbcr_color_bit = HDMI_SINK_NO_DEEP_COLOR;
  176. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup =
  177. (SINK_BASIC_AUDIO_NO_SUP | SINK_SAD_NO_EXIST | SINK_BASE_BLK_CHKSUM_ERR |
  178. SINK_EXT_BLK_CHKSUM_ERR);
  179. _HdmiSinkAvCap.ui2_sink_cec_address = 0xffff;
  180. _HdmiSinkAvCap.b_sink_edid_ready = FALSE;
  181. _HdmiSinkAvCap.ui1_sink_support_ai = 0;
  182. _HdmiSinkAvCap.ui1_Display_Horizontal_Size = 0;
  183. _HdmiSinkAvCap.ui1_Display_Vertical_Size = 0;
  184. _HdmiSinkAvCap.ui1_CNC = 0;
  185. if (fgIsHdmiNoEDIDCheck())
  186. vSetNoEdidChkInfo();
  187. }
  188. void vShowEdidRawData(void)
  189. {
  190. unsigned short bTemp, i, j, k;
  191. MT8193_EDID_FUNC();
  192. for (bTemp = 0; bTemp < 2; bTemp++) {
  193. hdmi_print("===================================================================\n");
  194. hdmi_print(" EDID Block Number=#%d\n", bTemp);
  195. hdmi_print(" | 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n");
  196. hdmi_print("===================================================================\n");
  197. j = bTemp * EDID_BLOCK_LEN;
  198. for (i = 0; i < 8; i++) {
  199. if (((i * 16) + j) < 0x10)
  200. hdmi_print("0%x: ", (i * 16) + j);
  201. else
  202. hdmi_print("%x: ", (i * 16) + j);
  203. for (k = 0; k < 16; k++) {
  204. if (k == 15) {
  205. if ((j + (i * 16 + k)) < EDID_SIZE) {
  206. /* for Buffer overflow error */
  207. if (_bEdidData[j + (i * 16 + k)] > 0x0f)
  208. hdmi_print("%2x\n",
  209. _bEdidData[j + (i * 16 + k)]);
  210. else
  211. hdmi_print("0%x\n",
  212. _bEdidData[j + (i * 16 + k)]);
  213. }
  214. } else {
  215. if ((j + (i * 16 + k)) < EDID_SIZE) {
  216. /* for Buffer overflow error */
  217. if (_bEdidData[j + (i * 16 + k)] > 0x0f)
  218. hdmi_print("%2x ",
  219. _bEdidData[j + (i * 16 + k)]);
  220. else
  221. hdmi_print("0%x ",
  222. _bEdidData[j + (i * 16 + k)]);
  223. }
  224. }
  225. }
  226. }
  227. }
  228. hdmi_print("===================================================================\n");
  229. }
  230. unsigned char mt8193_fgreadedid(unsigned char i1noedid)
  231. {
  232. unsigned char bIdx, bBlockIdx;
  233. unsigned char bExtBlockNo;
  234. unsigned short i;
  235. MT8193_EDID_FUNC();
  236. if (i1noedid == INTERNAL_EDID) {
  237. _fgHdmiNoEdidCheck = FALSE;
  238. vSetSharedInfo(SI_EDID_EXT_BLOCK_NO, 1);
  239. for (i = 0; i < 256; i++)
  240. _bEdidData[i] = _bEdidData2[i];
  241. return 1;
  242. } else if (i1noedid == NO_EDID) {
  243. vSetSharedInfo(SI_EDID_EXT_BLOCK_NO, 1);
  244. _fgHdmiNoEdidCheck = TRUE;
  245. for (i = 0; i < 256; i++)
  246. _bEdidData[i] = 0;
  247. ; return 1;
  248. } else {
  249. _fgHdmiNoEdidCheck = FALSE;
  250. }
  251. /* block 0 : standard EDID block, address 0x00 ~ 0x7F w/ device ID=0xA0 */
  252. bExtBlockNo = 0xff;
  253. for (bBlockIdx = 0; bBlockIdx <= bExtBlockNo; bBlockIdx++) {
  254. for (bIdx = 0; bIdx < 5; bIdx++) {
  255. if ((bBlockIdx * EDID_BLOCK_LEN) < EDID_SIZE) { /* for Buffer overflow error */
  256. if (fgDDCDataRead
  257. (EDID_ID + (bBlockIdx >> 1),
  258. 0x00 + (bBlockIdx & 0x01) * EDID_BLOCK_LEN, EDID_BLOCK_LEN,
  259. &_bEdidData[bBlockIdx * EDID_BLOCK_LEN]) == TRUE) {
  260. break;
  261. }
  262. if (bIdx == 4)
  263. return 0;
  264. }
  265. }
  266. bExtBlockNo = _bEdidData[EDID_ADDR_EXT_BLOCK_FLAG];
  267. vSetSharedInfo(SI_EDID_EXT_BLOCK_NO, bExtBlockNo);
  268. }
  269. return 1;
  270. }
  271. void vAnalyzeDTD(unsigned short ui2Active, unsigned short ui2HBlanking, unsigned char bFormat, unsigned char fgFirstDTD)
  272. {
  273. unsigned int ui4NTSC = _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution;
  274. unsigned int ui4PAL = _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution;
  275. unsigned int ui41stNTSC = _HdmiSinkAvCap.ui4_sink_1st_dtd_ntsc_resolution;
  276. unsigned int ui41stPAL = _HdmiSinkAvCap.ui4_sink_1st_dtd_pal_resolution;
  277. MT8193_EDID_FUNC();
  278. switch (ui2Active) {
  279. case 0x5a0: /* 480i */
  280. if (ui2HBlanking == 0x114) { /* NTSC */
  281. if (bFormat == 0) { /* p-scan */
  282. ui4NTSC |= SINK_480P_1440;
  283. if (fgFirstDTD)
  284. ui41stNTSC |= SINK_480P_1440;
  285. } else {
  286. ui4NTSC |= SINK_480I;
  287. if (fgFirstDTD)
  288. ui41stNTSC |= SINK_480I;
  289. }
  290. } else if (ui2HBlanking == 0x120) { /* PAL */
  291. if (bFormat == 0) { /* p-scan */
  292. ui4PAL |= SINK_576P_1440;
  293. if (fgFirstDTD)
  294. ui41stPAL |= SINK_576P_1440;
  295. } else {
  296. ui4PAL |= SINK_576I;
  297. if (fgFirstDTD)
  298. ui41stPAL |= SINK_576I;
  299. }
  300. }
  301. break;
  302. case 0x2d0: /* 480p */
  303. if ((ui2HBlanking == 0x8a) && (bFormat == 0)) { /* NTSC, p-scan */
  304. ui4NTSC |= SINK_480P;
  305. if (fgFirstDTD)
  306. ui41stNTSC |= SINK_480P;
  307. } else if ((ui2HBlanking == 0x90) && (bFormat == 0)) { /* PAL, p-scan */
  308. ui4PAL |= SINK_576P;
  309. if (fgFirstDTD)
  310. ui41stPAL |= SINK_576P;
  311. }
  312. break;
  313. case 0x500: /* 720p */
  314. if ((ui2HBlanking == 0x172) && (bFormat == 0)) { /* NTSC, p-scan */
  315. ui4NTSC |= SINK_720P60;
  316. if (fgFirstDTD)
  317. ui41stNTSC |= SINK_720P60;
  318. } else if ((ui2HBlanking == 0x2bc) && (bFormat == 0)) { /* PAL, p-scan */
  319. ui4PAL |= SINK_720P50;
  320. if (fgFirstDTD)
  321. ui41stPAL |= SINK_720P50;
  322. }
  323. break;
  324. case 0x780: /* 1080i, 1080P */
  325. if ((ui2HBlanking == 0x118) && (bFormat == 1)) { /* NTSC, interlace */
  326. ui4NTSC |= SINK_1080I60;
  327. if (fgFirstDTD)
  328. ui41stNTSC |= SINK_1080I60;
  329. } else if ((ui2HBlanking == 0x118) && (bFormat == 0)) { /* NTSC, Progressive */
  330. ui4NTSC |= SINK_1080P60;
  331. if (fgFirstDTD)
  332. ui41stNTSC |= SINK_1080P60;
  333. } else if ((ui2HBlanking == 0x2d0) && (bFormat == 1)) { /* PAL, interlace */
  334. ui4PAL |= SINK_1080I50;
  335. if (fgFirstDTD)
  336. ui41stPAL |= SINK_1080I50;
  337. } else if ((ui2HBlanking == 0x2d0) && (bFormat == 0)) { /* PAL, Progressive */
  338. ui4PAL |= SINK_1080P50;
  339. if (fgFirstDTD)
  340. ui41stPAL |= SINK_1080P50;
  341. }
  342. break;
  343. }
  344. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution = ui4NTSC;
  345. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution = ui4PAL;
  346. _HdmiSinkAvCap.ui4_sink_1st_dtd_ntsc_resolution = ui41stNTSC;
  347. _HdmiSinkAvCap.ui4_sink_1st_dtd_pal_resolution = ui41stPAL;
  348. }
  349. unsigned char fgParserEDID(unsigned char *prbData)
  350. {
  351. unsigned char bIdx;
  352. unsigned char bTemp = 0;
  353. unsigned short ui2HActive, ui2HBlanking;
  354. MT8193_EDID_FUNC();
  355. _HdmiSinkAvCap.ui1_Edid_Version = *(prbData + EDID_ADDR_VERSION);
  356. _HdmiSinkAvCap.ui1_Edid_Revision = *(prbData + EDID_ADDR_REVISION);
  357. _HdmiSinkAvCap.ui1_Display_Horizontal_Size = *(prbData + EDID_IMAGE_HORIZONTAL_SIZE);
  358. _HdmiSinkAvCap.ui1_Display_Vertical_Size = *(prbData + EDID_IMAGE_VERTICAL_SIZE);
  359. /* Step 1: check if EDID header pass */
  360. /* ie. EDID[0] ~ EDID[7] = specify header pattern */
  361. for (bIdx = EDID_ADDR_HEADER; bIdx < (EDID_ADDR_HEADER + EDID_HEADER_LEN); bIdx++) {
  362. if (*(prbData + bIdx) != aEDIDHeader[bIdx])
  363. return FALSE;
  364. }
  365. /* Step 2: Check if EDID checksume pass */
  366. /* ie. value of EDID[0] + ... + [0x7F] = 256*n */
  367. for (bIdx = 0; bIdx < EDID_BLOCK_LEN; bIdx++) {
  368. /* add the value into checksum */
  369. bTemp += *(prbData + bIdx);
  370. }
  371. /* check if EDID checksume pass */
  372. if (bTemp)
  373. return FALSE;
  374. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup &= ~SINK_BASE_BLK_CHKSUM_ERR;
  375. /* [3.3] read-back H active line to define EDID resolution */
  376. for (bIdx = 0; bIdx < 2; bIdx++) {
  377. ui2HActive =
  378. (unsigned short) (*(prbData + EDID_ADDR_TIMING_DSPR_1 + 18 * bIdx + OFST_H_ACT_BLA_HI) &
  379. 0xf0) << 4;
  380. ui2HActive |= *(prbData + EDID_ADDR_TIMING_DSPR_1 + 18 * bIdx + OFST_H_ACTIVE_LO);
  381. ui2HBlanking =
  382. (unsigned short) (*(prbData + EDID_ADDR_TIMING_DSPR_1 + 18 * bIdx + OFST_H_ACT_BLA_HI) &
  383. 0x0f) << 8;
  384. ui2HBlanking |=
  385. *(prbData + EDID_ADDR_TIMING_DSPR_1 + 18 * bIdx + OFST_H_BLANKING_LO);
  386. bTemp = (*(prbData + EDID_ADDR_TIMING_DSPR_1 + 18 * bIdx + OFST_FLAGS) & 0x80) >> 7;
  387. if (bIdx == 0)
  388. vAnalyzeDTD(ui2HActive, ui2HBlanking, bTemp, TRUE);
  389. else
  390. vAnalyzeDTD(ui2HActive, ui2HBlanking, bTemp, FALSE);
  391. }
  392. /* if go here, ie. parsing EDID data ok !! */
  393. return TRUE;
  394. }
  395. void vSetEdidChkError(void)
  396. {
  397. unsigned char bInx;
  398. MT8193_EDID_FUNC();
  399. vSetSharedInfo(SI_EDID_PARSING_RESULT, TRUE);
  400. vSetSharedInfo(SI_EDID_VSDB_EXIST, FALSE);
  401. _HdmiSinkAvCap.b_sink_support_hdmi_mode = TRUE;
  402. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution = SINK_480P; /* 0x1fffff; */
  403. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution = SINK_576P; /* 0x1fffff; */
  404. _HdmiSinkAvCap.ui2_sink_colorimetry = 0;
  405. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution = 0;
  406. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution = 0;
  407. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution = 0;
  408. _HdmiSinkAvCap.ui4_sink_native_pal_resolution = 0;
  409. _HdmiSinkAvCap.ui2_sink_vcdb_data = 0;
  410. _HdmiSinkAvCap.ui2_sink_aud_dec = 1; /* PCM only */
  411. _HdmiSinkAvCap.ui1_sink_dsd_ch_num = 0;
  412. for (bInx = 0; bInx < 7; bInx++) {
  413. if (bInx == 0)
  414. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bInx] = 0x07; /* 2ch max 48khz */
  415. else
  416. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bInx] = 0x0;
  417. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[bInx] = 0;
  418. _HdmiSinkAvCap.ui1_sink_dst_ch_sampling[bInx] = 0;
  419. }
  420. for (bInx = 0; bInx < 7; bInx++) {
  421. if (bInx == 0)
  422. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bInx] = 0x07; /* 2ch 24 bits */
  423. else
  424. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bInx] = 0;
  425. }
  426. _HdmiSinkAvCap.ui1_sink_spk_allocation = 0;
  427. _HdmiSinkAvCap.ui1_sink_i_latency_present = 0;
  428. _HdmiSinkAvCap.ui1_sink_p_latency_present = 0; /* kenny add 2010/4/25 */
  429. _HdmiSinkAvCap.ui1_sink_p_audio_latency = 0;
  430. _HdmiSinkAvCap.ui1_sink_p_video_latency = 0;
  431. _HdmiSinkAvCap.ui1_sink_i_audio_latency = 0;
  432. _HdmiSinkAvCap.ui1_sink_i_video_latency = 0;
  433. _HdmiSinkAvCap.e_sink_rgb_color_bit = HDMI_SINK_NO_DEEP_COLOR;
  434. _HdmiSinkAvCap.e_sink_ycbcr_color_bit = HDMI_SINK_NO_DEEP_COLOR;
  435. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup =
  436. (SINK_BASIC_AUDIO_NO_SUP | SINK_SAD_NO_EXIST | SINK_BASE_BLK_CHKSUM_ERR |
  437. SINK_EXT_BLK_CHKSUM_ERR);
  438. _HdmiSinkAvCap.ui2_sink_cec_address = 0xffff;
  439. _HdmiSinkAvCap.b_sink_edid_ready = FALSE;
  440. _HdmiSinkAvCap.ui1_sink_support_ai = 0;
  441. }
  442. void vParserCEADataBlock(unsigned char *prData, unsigned char bLen)
  443. {
  444. unsigned int ui4CEA_NTSC = 0, ui4CEA_PAL = 0, ui4OrgCEA_NTSC = 0, ui4OrgCEA_PAL =
  445. 0, ui4NativeCEA_NTSC = 0, ui4NativeCEA_PAL = 0;
  446. unsigned char bTemp, bIdx;
  447. unsigned char bLengthSum;
  448. unsigned char bType, bNo, bAudCode, bPcmChNum;
  449. unsigned char bTemp13, bTemp8, bLatency_offset = 0;
  450. unsigned char b3D_Multi_present = 0, b3D_Structure_7_0 = 1, b3D_MASK_15_8 = 1, b3D_MASK_7_0 =
  451. 1, b2D_VIC_order_Index = 0;
  452. unsigned char i, bTemp14 = 1, bDataTemp = 1;
  453. unsigned int ui4Temp = 0;
  454. unsigned int u23D_MASK_ALL;
  455. MT8193_EDID_FUNC();
  456. while (bLen) {
  457. if (bLen > 0x80)
  458. break;
  459. /* Step 1: get 1st data block type & total number of this data type */
  460. bTemp = *prData;
  461. bType = bTemp >> 5; /* bit[7:5] */
  462. bNo = bTemp & 0x1F; /* bit[4:0] */
  463. if (bType == 0x02) { /* Video data block */
  464. ui4CEA_NTSC = 0;
  465. ui4CEA_PAL = 0;
  466. for (bIdx = 0; bIdx < bNo; bIdx++) {
  467. if (*(prData + 1 + bIdx) & 0x80) { /* Native bit */
  468. ui4OrgCEA_NTSC = ui4CEA_NTSC;
  469. ui4OrgCEA_PAL = ui4CEA_PAL;
  470. }
  471. switch (*(prData + 1 + bIdx) & 0x7f) {
  472. case 6:
  473. ui4CEA_NTSC |= SINK_480I;
  474. ui4OrgCEA_NTSC |= SINK_480I;
  475. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  476. ui4NativeCEA_NTSC |= SINK_480I;
  477. break;
  478. case 7:
  479. ui4CEA_NTSC |= SINK_480I;
  480. ui4OrgCEA_NTSC |= SINK_480I; /* 16:9 */
  481. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  482. ui4NativeCEA_NTSC |= SINK_480I;
  483. break;
  484. case 2:
  485. ui4CEA_NTSC |= SINK_480P;
  486. ui4OrgCEA_NTSC |= SINK_480P;
  487. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  488. ui4NativeCEA_NTSC |= SINK_480P;
  489. break;
  490. case 3:
  491. ui4CEA_NTSC |= SINK_480P;
  492. ui4OrgCEA_NTSC |= SINK_480P;
  493. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  494. ui4NativeCEA_NTSC |= SINK_480P;
  495. break;
  496. case 14:
  497. case 15:
  498. ui4CEA_NTSC |= SINK_480P_1440;
  499. ui4OrgCEA_NTSC |= SINK_480P_1440;
  500. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  501. ui4NativeCEA_NTSC |= SINK_480P_1440;
  502. break;
  503. case 4:
  504. ui4CEA_NTSC |= SINK_720P60;
  505. ui4OrgCEA_NTSC |= SINK_720P60;
  506. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  507. ui4NativeCEA_NTSC |= SINK_720P60;
  508. break;
  509. case 5:
  510. ui4CEA_NTSC |= SINK_1080I60;
  511. ui4OrgCEA_NTSC |= SINK_1080I60;
  512. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  513. ui4NativeCEA_NTSC |= SINK_1080I60;
  514. break;
  515. case 21:
  516. ui4CEA_PAL |= SINK_576I;
  517. ui4OrgCEA_PAL |= SINK_576I;
  518. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  519. ui4NativeCEA_PAL |= SINK_576I;
  520. break;
  521. case 22:
  522. ui4CEA_PAL |= SINK_576I;
  523. ui4OrgCEA_PAL |= SINK_576I;
  524. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  525. ui4NativeCEA_PAL |= SINK_576I;
  526. break;
  527. case 16:
  528. ui4CEA_NTSC |= SINK_1080P60;
  529. ui4OrgCEA_NTSC |= SINK_1080P60;
  530. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  531. ui4NativeCEA_NTSC |= SINK_1080P60;
  532. break;
  533. case 17:
  534. ui4CEA_PAL |= SINK_576P;
  535. ui4OrgCEA_PAL |= SINK_576P;
  536. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  537. ui4NativeCEA_PAL |= SINK_576P;
  538. break;
  539. case 18:
  540. ui4CEA_PAL |= SINK_576P;
  541. ui4OrgCEA_PAL |= SINK_576P;
  542. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  543. ui4NativeCEA_PAL |= SINK_576P;
  544. break;
  545. case 29:
  546. case 30:
  547. ui4CEA_PAL |= SINK_576P_1440;
  548. ui4OrgCEA_PAL |= SINK_576P_1440;
  549. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  550. ui4NativeCEA_PAL |= SINK_576P_1440;
  551. break;
  552. case 19:
  553. ui4CEA_PAL |= SINK_720P50;
  554. ui4OrgCEA_PAL |= SINK_720P50;
  555. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  556. ui4NativeCEA_PAL |= SINK_720P50;
  557. break;
  558. case 20:
  559. ui4CEA_PAL |= SINK_1080I50;
  560. ui4OrgCEA_PAL |= SINK_1080I50;
  561. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  562. ui4NativeCEA_PAL |= SINK_1080I50;
  563. break;
  564. case 31:
  565. ui4CEA_PAL |= SINK_1080P50;
  566. ui4OrgCEA_PAL |= SINK_1080P50;
  567. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  568. ui4NativeCEA_PAL |= SINK_1080P50;
  569. break;
  570. case 32:
  571. ui4CEA_NTSC |= SINK_1080P24;
  572. ui4CEA_PAL |= SINK_1080P24;
  573. ui4CEA_NTSC |= SINK_1080P23976;
  574. ui4CEA_PAL |= SINK_1080P23976;
  575. ui4OrgCEA_PAL |= SINK_1080P24;
  576. ui4OrgCEA_NTSC |= SINK_1080P23976;
  577. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  578. ui4NativeCEA_PAL |= SINK_1080P24;
  579. break;
  580. case 33:
  581. /* ui4CEA_NTSC |= SINK_1080P25; */
  582. ui4CEA_PAL |= SINK_1080P25;
  583. ui4OrgCEA_PAL |= SINK_1080P25;
  584. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  585. ui4NativeCEA_PAL |= SINK_1080P25;
  586. break;
  587. case 34:
  588. ui4CEA_NTSC |= SINK_1080P30;
  589. ui4CEA_NTSC |= SINK_1080P2997;
  590. ui4CEA_PAL |= SINK_1080P30;
  591. ui4CEA_PAL |= SINK_1080P2997;
  592. ui4OrgCEA_PAL |= SINK_1080P30;
  593. ui4OrgCEA_NTSC |= SINK_1080P2997;
  594. if (*(prData + 1 + bIdx) & 0x80) /* Native bit */
  595. ui4NativeCEA_PAL |= SINK_1080P30;
  596. break;
  597. default:
  598. break;
  599. }
  600. if (bIdx < 0x10) {
  601. switch (*(prData + 1 + bIdx) & 0x7f) {
  602. case 6:
  603. case 7:
  604. ui4Temp = SINK_480I;
  605. break;
  606. case 2:
  607. case 3:
  608. ui4Temp = SINK_480P;
  609. break;
  610. case 14:
  611. case 15:
  612. ui4Temp = SINK_480P_1440;
  613. break;
  614. case 4:
  615. ui4Temp = SINK_720P60;
  616. break;
  617. case 5:
  618. ui4Temp = SINK_1080I60;
  619. break;
  620. case 21:
  621. case 22:
  622. ui4Temp = SINK_576I;
  623. break;
  624. case 16:
  625. ui4Temp = SINK_1080P60;
  626. break;
  627. case 17:
  628. case 18:
  629. ui4Temp = SINK_576P;
  630. break;
  631. case 29:
  632. case 30:
  633. ui4Temp = SINK_576P_1440;
  634. break;
  635. case 19:
  636. ui4Temp = SINK_720P50;
  637. break;
  638. case 20:
  639. ui4Temp = SINK_1080I50;
  640. break;
  641. case 31:
  642. ui4Temp = SINK_1080P50;
  643. break;
  644. case 32:
  645. ui4Temp |= SINK_1080P24;
  646. ui4Temp |= SINK_1080P23976;
  647. break;
  648. case 33:
  649. /* ui4CEA_NTSC |= SINK_1080P25; */
  650. ui4Temp = SINK_1080P25;
  651. break;
  652. case 34:
  653. ui4Temp |= SINK_1080P30;
  654. ui4Temp |= SINK_1080P2997;
  655. break;
  656. default:
  657. break;
  658. }
  659. _ui4First_16_NTSC_VIC |= ui4CEA_NTSC;
  660. _ui4First_16_PAL_VIC |= ui4CEA_PAL;
  661. _ui4First_16_VIC[bIdx] = ui4Temp;
  662. }
  663. if (*(prData + 1 + bIdx) & 0x80) {
  664. ui4OrgCEA_NTSC = ui4CEA_NTSC & (~ui4OrgCEA_NTSC);
  665. ui4OrgCEA_PAL = ui4CEA_PAL & (~ui4OrgCEA_PAL);
  666. if (ui4OrgCEA_NTSC) {
  667. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution =
  668. ui4OrgCEA_NTSC;
  669. } else if (ui4OrgCEA_PAL) {
  670. _HdmiSinkAvCap.ui4_sink_native_pal_resolution =
  671. ui4OrgCEA_PAL;
  672. } else {
  673. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution = 0;
  674. _HdmiSinkAvCap.ui4_sink_native_pal_resolution = 0;
  675. }
  676. }
  677. } /* for(bIdx = 0; bIdx < bNo; bIdx++) */
  678. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution |= ui4CEA_NTSC;
  679. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution |= ui4CEA_PAL;
  680. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution |= ui4NativeCEA_NTSC;
  681. _HdmiSinkAvCap.ui4_sink_native_pal_resolution |= ui4NativeCEA_PAL;
  682. } else if (bType == 0x01) { /* Audio data block */
  683. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup &= ~(SINK_SAD_NO_EXIST);
  684. for (bIdx = 0; bIdx < (bNo / 3); bIdx++) {
  685. bLengthSum = bIdx * 3;
  686. bAudCode = (*(prData + bLengthSum + 1) & 0x78) >> 3; /* get audio code */
  687. if ((bAudCode >= AVD_LPCM) && bAudCode <= AVD_WMA)
  688. _HdmiSinkAvCap.ui2_sink_aud_dec |= (1 << (bAudCode - 1));
  689. /* PCM:1 HDMI_SINK_AUDIO_DEC_LPCM AC3:2 HDMI_SINK_AUDIO_DEC_AC3 */
  690. if (bAudCode == AVD_LPCM) { /* LPCM */
  691. bPcmChNum = (*(prData + bLengthSum + 1) & 0x07) + 1;
  692. if (bPcmChNum == 2) {
  693. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bPcmChNum -
  694. 2] =
  695. (*(prData + bLengthSum + 2) & 0x7f);
  696. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[bPcmChNum -
  697. 2] &= 0x07;
  698. _HdmiSinkAvCap.ui1_sink_pcm_bit_size[bPcmChNum -
  699. 2] =
  700. (*(prData + bLengthSum + 3) & 0x07);
  701. }
  702. }
  703. if (bAudCode == AVD_DST) { /* DST */
  704. bPcmChNum = (*(prData + bLengthSum + 1) & 0x07) + 1;
  705. if (bPcmChNum >= 2) {
  706. _HdmiSinkAvCap.ui1_sink_dst_ch_sampling[bPcmChNum -
  707. 2] =
  708. (*(prData + bLengthSum + 2) & 0x7f);
  709. }
  710. }
  711. if (bAudCode == AVD_DSD) { /* DSD */
  712. bPcmChNum = (*(prData + bLengthSum + 1) & 0x07) + 1;
  713. if (bPcmChNum >= 2) {
  714. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[bPcmChNum -
  715. 2] =
  716. (*(prData + bLengthSum + 2) & 0x7f);
  717. }
  718. }
  719. } /* for(bIdx = 0; bIdx < bNo/3; bIdx++) */
  720. } else if (bType == 0x04) { /* speaker allocation tag code, 0x04 */
  721. _HdmiSinkAvCap.ui1_sink_spk_allocation = *(prData + 1) & 0x7f;
  722. } else if (bType == 0x03) { /* VDSB exit */
  723. for (bTemp = 0; bTemp < EDID_VSDB_LEN; bTemp++) {
  724. if (*(prData + bTemp + 1) != aEDIDVSDBHeader[bTemp])
  725. break;
  726. }
  727. /* for loop to end, is. VSDB header match */
  728. if (bTemp == EDID_VSDB_LEN) {
  729. vSetSharedInfo(SI_EDID_VSDB_EXIST, TRUE);
  730. _HdmiSinkAvCap.b_sink_support_hdmi_mode = TRUE;
  731. /* Read CEC physis address */
  732. if (bNo >= 5) {
  733. _HdmiSinkAvCap.ui2_sink_cec_address =
  734. (*(prData + 4) << 8) | (*(prData + 5));
  735. } else {
  736. _HdmiSinkAvCap.ui2_sink_cec_address = 0xFFFF;
  737. }
  738. /* Read Support AI */
  739. if (bNo >= 6) {
  740. bTemp = *(prData + 6);
  741. if (bTemp & 0x80) {
  742. _HdmiSinkAvCap.ui1_sink_support_ai = 1;
  743. vSetSharedInfo(SI_HDMI_SUPPORTS_AI, 1);
  744. } else {
  745. _HdmiSinkAvCap.ui1_sink_support_ai = 0;
  746. vSetSharedInfo(SI_HDMI_SUPPORTS_AI, 0);
  747. }
  748. /* kenny add 2010/4/25 for repeater EDID check */
  749. _HdmiSinkAvCap.u1_sink_support_ai =
  750. i4SharedInfo(SI_HDMI_SUPPORTS_AI);
  751. _HdmiSinkAvCap.e_sink_rgb_color_bit = ((bTemp >> 4) & 0x07);
  752. _HdmiSinkAvCap.u1_sink_max_tmds = *(prData + 7);
  753. if (bTemp & 0x08) { /* support YCbCr Deep Color */
  754. _HdmiSinkAvCap.e_sink_ycbcr_color_bit =
  755. ((bTemp >> 4) & 0x07);
  756. }
  757. } else {
  758. _HdmiSinkAvCap.ui1_sink_support_ai = 0;
  759. vSetSharedInfo(SI_HDMI_SUPPORTS_AI, 0);
  760. }
  761. /* max tmds clock */
  762. if (bNo >= 7) {
  763. bTemp = *(prData + 7);
  764. _HdmiSinkAvCap.ui1_sink_max_tmds_clock = ((unsigned short) bTemp) * 5;
  765. /* _HdmiSinkAvCap.ui1_sink_max_tmds_clock = 190; */
  766. } else {
  767. _HdmiSinkAvCap.ui1_sink_max_tmds_clock = 0;
  768. }
  769. /* Read Latency data */
  770. if (bNo >= 8) {
  771. bTemp = *(prData + 8);
  772. if (bTemp & 0x20)
  773. _HdmiSinkAvCap.b_sink_hdmi_video_present = 1;
  774. else
  775. _HdmiSinkAvCap.b_sink_hdmi_video_present = 0;
  776. _HdmiSinkAvCap.ui1_sink_content_cnc = bTemp & 0x0f;
  777. if (bTemp & 0x80) {
  778. /* Latency Present */
  779. _HdmiSinkAvCap.ui1_sink_p_latency_present = TRUE;
  780. _HdmiSinkAvCap.ui1_sink_p_video_latency =
  781. *(prData + 9);
  782. _HdmiSinkAvCap.ui1_sink_p_audio_latency =
  783. *(prData + 10);
  784. if (bTemp & 0x40) {
  785. /* Interlace Latency present */
  786. _HdmiSinkAvCap.ui1_sink_i_latency_present =
  787. TRUE;
  788. _HdmiSinkAvCap.ui1_sink_i_video_latency =
  789. *(prData + 11);
  790. _HdmiSinkAvCap.ui1_sink_i_audio_latency =
  791. *(prData + 12);
  792. }
  793. }
  794. _HdmiSinkAvCap.ui1_CNC = bTemp & 0x0F;
  795. }
  796. if (bNo >= 8) {
  797. bTemp = *(prData + 8);
  798. if (!(bTemp & 0x80)) {
  799. /* Latency Present */
  800. bLatency_offset = bLatency_offset + 2;
  801. }
  802. if (!(bTemp & 0x40)) {
  803. /* Interlace Latency present */
  804. bLatency_offset = bLatency_offset + 2;
  805. }
  806. }
  807. if (bNo >= 13) {
  808. /* kenny add */
  809. bTemp = *(prData + 13);
  810. if (bTemp & 0x80)
  811. _HdmiSinkAvCap.b_sink_3D_present = 1;
  812. else
  813. _HdmiSinkAvCap.b_sink_3D_present = 0;
  814. }
  815. if (bNo >= 8)
  816. bTemp8 = *(prData + 8);
  817. if (bNo >= (13 - bLatency_offset)) {
  818. bTemp13 = *(prData + 13 - bLatency_offset);
  819. if (bTemp13 & 0x80) {
  820. _u4i_3D_VIC |= SINK_720P50;
  821. _u4i_3D_VIC |= SINK_720P60;
  822. _u4i_3D_VIC |= SINK_1080P23976;
  823. _u4i_3D_VIC |= SINK_1080P24;
  824. _HdmiSinkAvCap.b_sink_3D_present = TRUE;
  825. } else
  826. _HdmiSinkAvCap.b_sink_3D_present = FALSE;
  827. } else
  828. _HdmiSinkAvCap.b_sink_3D_present = FALSE;
  829. if (bNo >= (13 - bLatency_offset)) {
  830. bTemp13 = *(prData + 13 - bLatency_offset);
  831. if ((bTemp13 & 0x60) == 0x20)
  832. b3D_Multi_present = 0x20;
  833. else if ((bTemp13 & 0x60) == 0x40)
  834. b3D_Multi_present = 0x40;
  835. else
  836. b3D_Multi_present = 0x00;
  837. }
  838. if (bNo >= (14 - bLatency_offset))
  839. bTemp14 = *(prData + 14 - bLatency_offset);
  840. if (bNo > (14 - bLatency_offset + ((bTemp14 & 0xE0) >> 5))) {
  841. if (b3D_Multi_present == 0x20) {
  842. if (((15 - bLatency_offset +
  843. ((bTemp14 & 0xE0) >> 5)) +
  844. (bTemp14 & 0x1F)) >=
  845. (15 - bLatency_offset +
  846. ((bTemp14 & 0xE0) >> 5) + 2))
  847. b3D_Structure_7_0 =
  848. *(prData + 15 - bLatency_offset +
  849. ((bTemp14 & 0xE0) >> 5) + 1);
  850. if ((b3D_Structure_7_0 & 0x01) == 0x01) {
  851. for (i = 0; i < 0x10; i++)
  852. _u4i_3D_VIC |= _ui4First_16_VIC[i];
  853. }
  854. while (((15 - bLatency_offset +
  855. ((bTemp14 & 0xE0) >> 5)) +
  856. (bTemp14 & 0x1F)) >
  857. ((15 - bLatency_offset +
  858. ((bTemp14 & 0xE0) >> 5)) + 2 +
  859. b2D_VIC_order_Index)) {
  860. /* 2 is 3D_structure */
  861. bDataTemp =
  862. *(prData + 15 - bLatency_offset +
  863. ((bTemp14 & 0xE0) >> 5) + 2 +
  864. b2D_VIC_order_Index);
  865. if ((bDataTemp & 0x0F) < 0x08) {
  866. b2D_VIC_order_Index =
  867. b2D_VIC_order_Index + 1;
  868. if ((bDataTemp & 0x0F) == 0x00) {
  869. /* 3D_Structure=0, support frame packet */
  870. _u4i_3D_VIC |=
  871. _ui4First_16_VIC[((bDataTemp & 0xF0) >> 4)];
  872. }
  873. } else {
  874. b2D_VIC_order_Index =
  875. b2D_VIC_order_Index + 2;
  876. }
  877. }
  878. } else if (b3D_Multi_present == 0x40) {
  879. if (((15 - bLatency_offset +
  880. ((bTemp14 & 0xE0) >> 5)) +
  881. (bTemp14 & 0x1F)) >=
  882. ((15 - bLatency_offset +
  883. ((bTemp14 & 0xE0) >> 5)) + 4)) {
  884. /* 4 is 3D_structure+3D_MASK */
  885. /* b3D_Structure_15_8=*(prData+15+((bTemp&0xE0)>>5)); */
  886. b3D_Structure_7_0 =
  887. *(prData + 15 - bLatency_offset +
  888. ((bTemp14 & 0xE0) >> 5) + 1);
  889. b3D_MASK_15_8 =
  890. *(prData + 15 - bLatency_offset +
  891. ((bTemp14 & 0xE0) >> 5) + 2);
  892. b3D_MASK_7_0 =
  893. *(prData + 15 - bLatency_offset +
  894. ((bTemp14 & 0xE0) >> 5) + 3);
  895. if ((b3D_Structure_7_0 & 0x01) == 0x01) { /* support frame packet */
  896. u23D_MASK_ALL =
  897. (((unsigned short) (b3D_MASK_15_8)) << 8) |
  898. ((unsigned short) (b3D_MASK_7_0));
  899. for (i = 0; i < 0x10; i++) {
  900. if (u23D_MASK_ALL & 0x0001) {
  901. _u4i_3D_VIC |=
  902. _ui4First_16_VIC[i];
  903. }
  904. u23D_MASK_ALL =
  905. u23D_MASK_ALL >> 1;
  906. }
  907. }
  908. }
  909. while (((15 - bLatency_offset +
  910. ((bTemp14 & 0xE0) >> 5)) +
  911. (bTemp14 & 0x1F)) >
  912. (15 - bLatency_offset +
  913. ((bTemp14 & 0xE0) >> 5) + 4 +
  914. b2D_VIC_order_Index)) {
  915. bDataTemp =
  916. *(prData + 15 - bLatency_offset +
  917. ((bTemp14 & 0xE0) >> 5) + 4 +
  918. b2D_VIC_order_Index);
  919. if ((bDataTemp & 0x0F) < 0x08) {
  920. b2D_VIC_order_Index =
  921. b2D_VIC_order_Index + 1;
  922. if ((bDataTemp & 0x0F) == 0x00) { /* 3D_Structure=0 */
  923. _u4i_3D_VIC |=
  924. _ui4First_16_VIC[((bDataTemp & 0xF0) >> 4)];
  925. }
  926. } else {
  927. b2D_VIC_order_Index =
  928. b2D_VIC_order_Index + 2;
  929. }
  930. }
  931. } else {
  932. b3D_Structure_7_0 = 0;
  933. while (((15 - bLatency_offset +
  934. ((bTemp14 & 0xE0) >> 5)) +
  935. (bTemp14 & 0x1F)) >
  936. ((15 - bLatency_offset +
  937. ((bTemp14 & 0xE0) >> 5)) +
  938. b2D_VIC_order_Index)) {
  939. bDataTemp =
  940. *(prData + 15 - bLatency_offset +
  941. ((bTemp14 & 0xE0) >> 5) +
  942. b2D_VIC_order_Index);
  943. if ((bDataTemp & 0x0F) < 0x08) {
  944. b2D_VIC_order_Index =
  945. b2D_VIC_order_Index + 1;
  946. if ((bDataTemp & 0x0F) == 0x00) { /* 3D_Structure=0 */
  947. _u4i_3D_VIC |=
  948. _ui4First_16_VIC[((bDataTemp & 0xF0) >> 4)];
  949. }
  950. } else {
  951. b2D_VIC_order_Index =
  952. b2D_VIC_order_Index + 2;
  953. }
  954. }
  955. }
  956. }
  957. _HdmiSinkAvCap.ui4_sink_cea_3D_resolution = _u4i_3D_VIC;
  958. } else {
  959. /* if(bTemp==EDID_VSDB_LEN) */
  960. vSetSharedInfo(SI_EDID_VSDB_EXIST, FALSE);
  961. _HdmiSinkAvCap.b_sink_support_hdmi_mode = FALSE;
  962. }
  963. } else if (bType == 0x07) { /* Use Extended Tag */
  964. /* if(bType == 0x03) // VDSB exit */
  965. if (*(prData + 1) == 0x05) { /* Extend Tag code ==0x05 */
  966. if (*(prData + 2) & 0x1) {
  967. /* Suppot xvYcc601 */
  968. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_XV_YCC601;
  969. }
  970. if (*(prData + 2) & 0x2) {
  971. /* Suppot xvYcc709 */
  972. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_XV_YCC709;
  973. }
  974. if (*(prData + 3) & 0x1) {
  975. /* support Gamut data P0 */
  976. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_METADATA0;
  977. }
  978. if (*(prData + 3) & 0x2) {
  979. /* support Gamut data P1 */
  980. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_METADATA1;
  981. }
  982. if (*(prData + 3) & 0x4) {
  983. /* support Gamut data P1 */
  984. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_METADATA2;
  985. }
  986. } else if (*(prData + 1) == 0x0) {
  987. /* Extend Tag code ==0x0 */
  988. if (*(prData + 2) & 0x40) {
  989. /* support selectable, QS=1 */
  990. _HdmiSinkAvCap.ui2_sink_vcdb_data |= SINK_RGB_SELECTABLE;
  991. }
  992. }
  993. }
  994. /* re-assign the next data block address */
  995. prData += (bNo + 1); /* '1' means the tag byte */
  996. bLen -= (bNo + 1);
  997. } /* while(bLen) */
  998. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[5] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[6];
  999. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[4] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[5];
  1000. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[3] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[4];
  1001. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[2] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[3];
  1002. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[1] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[2];
  1003. _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[0] |= _HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[1];
  1004. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[5] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[6];
  1005. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[4] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[5];
  1006. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[3] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[4];
  1007. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[2] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[3];
  1008. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[1] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[2];
  1009. _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[0] |= _HdmiSinkAvCap.ui1_sink_dsd_ch_sampling[1];
  1010. if (_HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup & SINK_EXT_BLK_CHKSUM_ERR) {
  1011. /* 2007/2/12 for av output chksum error */
  1012. vSetSharedInfo(SI_EDID_VSDB_EXIST, FALSE);
  1013. _HdmiSinkAvCap.b_sink_support_hdmi_mode = FALSE;
  1014. }
  1015. }
  1016. unsigned char fgParserExtEDID(unsigned char *prData)
  1017. {
  1018. unsigned char bIdx;
  1019. unsigned char bTemp = 0;
  1020. unsigned short ui2HActive, ui2HBlanking, ui2VBlanking;
  1021. unsigned char bOfst, *prCEAaddr;
  1022. MT8193_EDID_FUNC();
  1023. _HdmiSinkAvCap.ui1_ExtEdid_Revision = *(prData + EXTEDID_ADDR_REVISION);
  1024. for (bIdx = 0; bIdx < EDID_BLOCK_LEN; bIdx++) {
  1025. /* add the value into checksum */
  1026. bTemp += *(prData + bIdx); /* i4SharedInfo(wPos+bIdx); */
  1027. }
  1028. bTemp = 0;
  1029. /* check if EDID checksume pass */
  1030. if (bTemp) {
  1031. ; return FALSE;
  1032. } else {
  1033. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup &= ~SINK_EXT_BLK_CHKSUM_ERR;
  1034. }
  1035. /* Step 1: get the offset value of 1st detail timing description within extension block */
  1036. bOfst = *(prData + EXTEDID_ADDR_OFST_TIME_DSPR);
  1037. if (*(prData + EDID_ADDR_EXTEND_BYTE3) & 0x40) /* Support basic audio */
  1038. _HdmiSinkAvCap.ui2_edid_chksum_and_audio_sup &= ~SINK_BASIC_AUDIO_NO_SUP;
  1039. /* Max'0528'04, move to here, after read 0x80 ~ 0xFF because it is 0x83... */
  1040. if (*(prData + EDID_ADDR_EXTEND_BYTE3) & 0x20) { /* receiver support YCbCr 4:4:4 */
  1041. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_YCBCR_444;
  1042. }
  1043. if (*(prData + EDID_ADDR_EXTEND_BYTE3) & 0x10) /* receiver support YCbCr 4:2:2 */
  1044. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_YCBCR_422;
  1045. _HdmiSinkAvCap.ui2_sink_colorimetry |= SINK_RGB;
  1046. /* Step 3: read-back the pixel clock of each timing descriptor */
  1047. /* Step 4: read-back V active line to define EDID resolution */
  1048. for (bIdx = 0; bIdx < 6; bIdx++) {
  1049. if (((bOfst + 18 * bIdx) > 109) || (*(prData + bOfst + 18 * bIdx) == 0))
  1050. break;
  1051. ui2HActive = (unsigned short) (*(prData + bOfst + 18 * bIdx + OFST_H_ACT_BLA_HI) & 0xf0) << 4;
  1052. ui2HActive |= *(prData + bOfst + 18 * bIdx + OFST_H_ACTIVE_LO);
  1053. ui2HBlanking =
  1054. (unsigned short) (*(prData + bOfst + 18 * bIdx + OFST_H_ACT_BLA_HI) & 0x0f) << 8;
  1055. ui2HBlanking |= *(prData + bOfst + 18 * bIdx + OFST_H_BLANKING_LO);
  1056. ui2VBlanking = (unsigned short) (*(prData + bOfst + 18 * bIdx + OFST_V_ACTIVE_HI) & 0x0f) << 8;
  1057. ui2VBlanking |= *(prData + bOfst + 18 * bIdx + OFST_V_BLANKING_LO);
  1058. bTemp = (*(prData + bOfst + 18 * bIdx + OFST_FLAGS) & 0x80) >> 7;
  1059. vAnalyzeDTD(ui2HActive, ui2HBlanking, bTemp, FALSE);
  1060. }
  1061. if (*(prData + EXTEDID_ADDR_REVISION) >= 0x03) { /* for simplay #7-37, #7-36 */
  1062. prCEAaddr = prData + 4;
  1063. vParserCEADataBlock(prCEAaddr, bOfst - 4);
  1064. }
  1065. /* if go here, ie. parsing EDID data ok !! */
  1066. return TRUE;
  1067. }
  1068. void vParserExtEDIDState(unsigned char *prEdid)
  1069. {
  1070. unsigned char bTemp;
  1071. unsigned char *prData;
  1072. MT8193_EDID_FUNC();
  1073. if (i4SharedInfo(SI_EDID_PARSING_RESULT) == TRUE) {
  1074. /* parsing EDID extension block if it exist */
  1075. for (bTemp = 0; bTemp < i4SharedInfo(SI_EDID_EXT_BLOCK_NO); bTemp++) {
  1076. if ((EDID_BLOCK_LEN + bTemp * EDID_BLOCK_LEN) < EDID_SIZE) { /* for Buffer Overflow error */
  1077. if (*(prEdid + EDID_BLOCK_LEN + bTemp * EDID_BLOCK_LEN) == 0x02) {
  1078. prData = (prEdid + EDID_BLOCK_LEN + bTemp * EDID_BLOCK_LEN);
  1079. fgParserExtEDID(prData);
  1080. } else if (*(prEdid + EDID_BLOCK_LEN + bTemp * EDID_BLOCK_LEN) ==
  1081. 0xF0) {
  1082. /****/
  1083. }
  1084. } else {
  1085. /****/
  1086. }
  1087. }
  1088. }
  1089. }
  1090. void mt8193_checkedid(unsigned char i1noedid)
  1091. {
  1092. unsigned char bTemp;
  1093. unsigned char bRetryCount = 2;
  1094. unsigned char i;
  1095. MT8193_EDID_FUNC();
  1096. vClearEdidInfo();
  1097. for (i = 0; i < 0x10; i++)
  1098. _ui4First_16_VIC[i] = 0;
  1099. _ui4First_16_NTSC_VIC = 0;
  1100. _ui4First_16_PAL_VIC = 0;
  1101. _u4i_3D_VIC = 0;
  1102. _HdmiSinkAvCap.b_sink_hdmi_video_present = FALSE;
  1103. _HdmiSinkAvCap.b_sink_3D_present = FALSE;
  1104. _HdmiSinkAvCap.ui4_sink_cea_3D_resolution = 0;
  1105. for (bTemp = 0; bTemp < bRetryCount; bTemp++) {
  1106. if (mt8193_fgreadedid(i1noedid) == TRUE) {
  1107. if (fgParserEDID(&_bEdidData[0]) == TRUE) {
  1108. vSetSharedInfo(SI_EDID_PARSING_RESULT, TRUE);
  1109. _HdmiSinkAvCap.b_sink_edid_ready = TRUE;
  1110. HDMI_DEF_LOG("[hdmi][edid]parser ok\n");
  1111. break;
  1112. }
  1113. if (bTemp == bRetryCount - 1)
  1114. vSetSharedInfo(SI_EDID_PARSING_RESULT, TRUE);
  1115. if (bTemp == bRetryCount - 1)
  1116. break;
  1117. } else {
  1118. if (bTemp == bRetryCount - 1) {
  1119. if (i4SharedInfo(SI_HDMI_RECEIVER_STATUS) == HDMI_PLUG_IN_ONLY)
  1120. vClearEdidInfo();
  1121. else if (i4SharedInfo(SI_HDMI_RECEIVER_STATUS) ==
  1122. HDMI_PLUG_IN_AND_SINK_POWER_ON)
  1123. vSetEdidChkError();
  1124. if (fgIsHdmiNoEDIDCheck())
  1125. vSetNoEdidChkInfo();
  1126. return;
  1127. }
  1128. }
  1129. udelay(5);
  1130. }
  1131. if ((i4SharedInfo(SI_EDID_EXT_BLOCK_NO) * EDID_BLOCK_LEN) < EDID_SIZE) /* for Buffer Overflow error */
  1132. vParserExtEDIDState(&_bEdidData[0]);
  1133. if (fgIsHdmiNoEDIDCheck())
  1134. vSetNoEdidChkInfo();
  1135. #ifdef CONFIG_SINGLE_PANEL_OUTPUT
  1136. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution &= (SINK_480P | SINK_720P60);
  1137. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution &= (SINK_480P | SINK_720P60);
  1138. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution &= (SINK_480P | SINK_720P60);
  1139. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution &= (SINK_480P | SINK_720P60);
  1140. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution &= (SINK_480P | SINK_720P60);
  1141. _HdmiSinkAvCap.ui4_sink_native_pal_resolution &= (SINK_480P | SINK_720P60);
  1142. #else
  1143. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1144. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1145. _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1146. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1147. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1148. _HdmiSinkAvCap.ui4_sink_native_pal_resolution &= (SINK_480P | SINK_720P60 | SINK_1080P30);
  1149. #endif
  1150. if (mt8193_log_on & hdmiedidlog) {
  1151. vShowEdidRawData();
  1152. vShowEdidInformation();
  1153. } else
  1154. hdmi_show_def_info();
  1155. }
  1156. unsigned char vCheckPcmBitSize(unsigned char ui1ChNumInx)
  1157. {
  1158. unsigned char ui1Data, u1MaxBit;
  1159. int i;
  1160. u1MaxBit = PCM_16BIT;
  1161. for (i = 6; i >= ui1ChNumInx; i--) {
  1162. ui1Data = _HdmiSinkAvCap.ui1_sink_pcm_bit_size[i];
  1163. if (ui1Data & (1 << PCM_24BIT)) {
  1164. if (u1MaxBit < PCM_24BIT)
  1165. u1MaxBit = PCM_24BIT;
  1166. } else if (ui1Data & (1 << PCM_20BIT)) {
  1167. if (u1MaxBit < PCM_20BIT)
  1168. u1MaxBit = PCM_20BIT;
  1169. }
  1170. }
  1171. return u1MaxBit;
  1172. }
  1173. void vShowEdidInformation(void)
  1174. {
  1175. unsigned int u4Res = 0;
  1176. unsigned char bInx = 0;
  1177. MT8193_EDID_FUNC();
  1178. hdmi_print("[HDMI]EDID ver:%d/rev:%d\n", _HdmiSinkAvCap.ui1_Edid_Version,
  1179. _HdmiSinkAvCap.ui1_Edid_Revision);
  1180. hdmi_print("[HDMI]EDID Extend Rev:%d\n", _HdmiSinkAvCap.ui1_ExtEdid_Revision);
  1181. if (_HdmiSinkAvCap.b_sink_support_hdmi_mode)
  1182. hdmi_print("[HDMI]SINK Device is HDMI\n");
  1183. else
  1184. hdmi_print("[HDMI]SINK Device is DVI\n");
  1185. if (_HdmiSinkAvCap.b_sink_support_hdmi_mode)
  1186. hdmi_print("[HDMI]CEC ADDRESS:%x\n", _HdmiSinkAvCap.ui2_sink_cec_address);
  1187. hdmi_print("[HDMI]max clock limit : %d\n", _HdmiSinkAvCap.ui1_sink_max_tmds_clock);
  1188. u4Res = (_HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution |
  1189. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution |
  1190. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution |
  1191. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution);
  1192. if (u4Res & SINK_480I)
  1193. hdmi_print("[HDMI]SUPPORT 1440x480I 59.94hz\n");
  1194. if (u4Res & SINK_480I_1440)
  1195. hdmi_print("[HDMI]SUPPORT 2880x480I 59.94hz\n");
  1196. if (u4Res & SINK_480P)
  1197. hdmi_print("[HDMI]SUPPORT 720x480P 59.94hz\n");
  1198. if (u4Res & SINK_480P_1440)
  1199. hdmi_print("[HDMI]SUPPORT 1440x480P 59.94hz\n");
  1200. if (u4Res & SINK_480P_2880)
  1201. hdmi_print("[HDMI]SUPPORT 2880x480P 59.94hz\n");
  1202. if (u4Res & SINK_720P60)
  1203. hdmi_print("[HDMI]SUPPORT 1280x720P 59.94hz\n");
  1204. if (u4Res & SINK_1080I60)
  1205. hdmi_print("[HDMI]SUPPORT 1920x1080I 59.94hz\n");
  1206. if (u4Res & SINK_1080P60)
  1207. hdmi_print("[HDMI]SUPPORT 1920x1080P 59.94hz\n");
  1208. if (u4Res & SINK_576I)
  1209. hdmi_print("[HDMI]SUPPORT 1440x576I 50hz\n");
  1210. if (u4Res & SINK_576I_1440)
  1211. hdmi_print("[HDMI]SUPPORT 2880x576I 50hz\n");
  1212. if (u4Res & SINK_576P)
  1213. hdmi_print("[HDMI]SUPPORT 720x576P 50hz\n");
  1214. if (u4Res & SINK_576P_1440)
  1215. hdmi_print("[HDMI]SUPPORT 1440x576P 50hz\n");
  1216. if (u4Res & SINK_576P_2880)
  1217. hdmi_print("[HDMI]SUPPORT 2880x576P 50hz\n");
  1218. if (u4Res & SINK_720P50)
  1219. hdmi_print("[HDMI]SUPPORT 1280x720P 50hz\n");
  1220. if (u4Res & SINK_1080I50)
  1221. hdmi_print("[HDMI]SUPPORT 1920x1080I 50hz\n");
  1222. if (u4Res & SINK_1080P50)
  1223. hdmi_print("[HDMI]SUPPORT 1920x1080P 50hz\n");
  1224. if (u4Res & SINK_1080P30)
  1225. hdmi_print("[HDMI]SUPPORT 1920x1080P 30hz\n");
  1226. if (u4Res & SINK_1080P24)
  1227. hdmi_print("[HDMI]SUPPORT 1920x1080P 24hz\n");
  1228. if (u4Res & SINK_1080P25)
  1229. hdmi_print("[HDMI]SUPPORT 1920x1080P 25hz\n");
  1230. u4Res =
  1231. (_HdmiSinkAvCap.ui4_sink_native_ntsc_resolution |
  1232. _HdmiSinkAvCap.ui4_sink_native_pal_resolution);
  1233. hdmi_print("[HDMI]NTSC Native =%x\n", _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution);
  1234. hdmi_print("[HDMI]PAL Native =%x\n", _HdmiSinkAvCap.ui4_sink_native_pal_resolution);
  1235. if (u4Res & SINK_480I)
  1236. hdmi_print("[HDMI]Native resolution is 1440x480I 59.94hz\n");
  1237. if (u4Res & SINK_480I_1440)
  1238. hdmi_print("[HDMI]Native resolution is 2880x480I 59.94hz\n");
  1239. if (u4Res & SINK_480P)
  1240. hdmi_print("[HDMI]Native resolution is 720x480P 59.94hz\n");
  1241. if (u4Res & SINK_480P_1440)
  1242. hdmi_print("[HDMI]Native resolution is 1440x480P 59.94hz\n");
  1243. if (u4Res & SINK_480P_2880)
  1244. hdmi_print("[HDMI]Native resolution is 2880x480P 59.94hz\n");
  1245. if (u4Res & SINK_720P60)
  1246. hdmi_print("[HDMI]Native resolution is 1280x720P 59.94hz\n");
  1247. if (u4Res & SINK_1080I60)
  1248. hdmi_print("[HDMI]Native resolution is 1920x1080I 59.94hz\n");
  1249. if (u4Res & SINK_1080P60)
  1250. hdmi_print("[HDMI]Native resolution is 1920x1080P 59.94hz\n");
  1251. if (u4Res & SINK_576I)
  1252. hdmi_print("[HDMI]Native resolution is 1440x576I 50hz\n");
  1253. if (u4Res & SINK_576I_1440)
  1254. hdmi_print("[HDMI]Native resolution is 2880x576I 50hz\n");
  1255. if (u4Res & SINK_576P)
  1256. hdmi_print("[HDMI]Native resolution is 720x576P 50hz\n");
  1257. if (u4Res & SINK_576P_1440)
  1258. hdmi_print("[HDMI]Native resolution is 1440x576P 50hz\n");
  1259. if (u4Res & SINK_576P_2880)
  1260. hdmi_print("[HDMI]Native resolution is 2880x576P 50hz\n");
  1261. if (u4Res & SINK_720P50)
  1262. hdmi_print("[HDMI]Native resolution is 1280x720P 50hz\n");
  1263. if (u4Res & SINK_1080I50)
  1264. hdmi_print("[HDMI]Native resolution is 1920x1080I 50hz\n");
  1265. if (u4Res & SINK_1080P50)
  1266. hdmi_print("[HDMI]Native resolution is 1920x1080P 50hz\n");
  1267. if (u4Res & SINK_1080P30)
  1268. hdmi_print("[HDMI]Native resolution is 1920x1080P 30hz\n");
  1269. if (u4Res & SINK_1080P24)
  1270. hdmi_print("[HDMI]Native resolution is 1920x1080P 24hz\n");
  1271. if (u4Res & SINK_1080P25)
  1272. hdmi_print("[HDMI]Native resolution is 1920x1080P 25hz\n");
  1273. hdmi_print("[HDMI]SUPPORT RGB\n");
  1274. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_YCBCR_444)
  1275. hdmi_print("[HDMI]SUPPORT YCBCR 444\n");
  1276. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_YCBCR_422)
  1277. hdmi_print("[HDMI]SUPPORT YCBCR 422\n");
  1278. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_XV_YCC709)
  1279. hdmi_print("[HDMI]SUPPORT xvYCC 709\n");
  1280. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_XV_YCC601)
  1281. hdmi_print("[HDMI]SUPPORT xvYCC 601\n");
  1282. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_METADATA0)
  1283. hdmi_print("[HDMI]SUPPORT metadata P0\n");
  1284. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_METADATA1)
  1285. hdmi_print("[HDMI]SUPPORT metadata P1\n");
  1286. if (_HdmiSinkAvCap.ui2_sink_colorimetry & SINK_METADATA2)
  1287. hdmi_print("[HDMI]SUPPORT metadata P2\n");
  1288. if (_HdmiSinkAvCap.e_sink_ycbcr_color_bit & HDMI_SINK_DEEP_COLOR_10_BIT)
  1289. hdmi_print("[HDMI]SUPPORT YCBCR 30 Bits Deep Color\n");
  1290. if (_HdmiSinkAvCap.e_sink_ycbcr_color_bit & HDMI_SINK_DEEP_COLOR_12_BIT)
  1291. hdmi_print("[HDMI]SUPPORT YCBCR 36 Bits Deep Color\n");
  1292. if (_HdmiSinkAvCap.e_sink_ycbcr_color_bit & HDMI_SINK_DEEP_COLOR_16_BIT)
  1293. hdmi_print("[HDMI]SUPPORT YCBCR 48 Bits Deep Color\n");
  1294. if (_HdmiSinkAvCap.e_sink_ycbcr_color_bit == HDMI_SINK_NO_DEEP_COLOR)
  1295. hdmi_print("[HDMI]Not SUPPORT YCBCR Deep Color\n");
  1296. if (_HdmiSinkAvCap.e_sink_rgb_color_bit & HDMI_SINK_DEEP_COLOR_10_BIT)
  1297. hdmi_print("[HDMI]SUPPORT RGB 30 Bits Deep Color\n");
  1298. if (_HdmiSinkAvCap.e_sink_rgb_color_bit & HDMI_SINK_DEEP_COLOR_12_BIT)
  1299. hdmi_print("[HDMI]SUPPORT RGB 36 Bits Deep Color\n");
  1300. if (_HdmiSinkAvCap.e_sink_rgb_color_bit & HDMI_SINK_DEEP_COLOR_16_BIT)
  1301. hdmi_print("[HDMI]SUPPORT RGB 48 Bits Deep Color\n");
  1302. if (_HdmiSinkAvCap.e_sink_rgb_color_bit == HDMI_SINK_NO_DEEP_COLOR)
  1303. hdmi_print("[HDMI]Not SUPPORT RGB Deep Color\n");
  1304. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_LPCM)
  1305. hdmi_print("[HDMI]SUPPORT LPCM\n");
  1306. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_AC3)
  1307. hdmi_print("[HDMI]SUPPORT AC3 Decode\n");
  1308. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_MPEG1)
  1309. hdmi_print("[HDMI]SUPPORT MPEG1 Decode\n");
  1310. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_MP3)
  1311. hdmi_print("[HDMI]SUPPORT AC3 Decode\n");
  1312. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_MPEG2)
  1313. hdmi_print("[HDMI]SUPPORT MPEG2 Decode\n");
  1314. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_AAC)
  1315. hdmi_print("[HDMI]SUPPORT AAC Decode\n");
  1316. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_DTS)
  1317. hdmi_print("[HDMI]SUPPORT DTS Decode\n");
  1318. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_ATRAC)
  1319. hdmi_print("[HDMI]SUPPORT ATRAC Decode\n");
  1320. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_DSD)
  1321. hdmi_print("[HDMI]SUPPORT SACD DSD Decode\n");
  1322. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_DOLBY_PLUS)
  1323. hdmi_print("[HDMI]SUPPORT Dolby Plus Decode\n");
  1324. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_DTS_HD)
  1325. hdmi_print("[HDMI]SUPPORT DTS HD Decode\n");
  1326. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_MAT_MLP)
  1327. hdmi_print("[HDMI]SUPPORT MAT MLP Decode\n");
  1328. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_DST)
  1329. hdmi_print("[HDMI]SUPPORT SACD DST Decode\n");
  1330. if (_HdmiSinkAvCap.ui2_sink_aud_dec & HDMI_SINK_AUDIO_DEC_WMA)
  1331. hdmi_print("[HDMI]SUPPORT WMA Decode\n");
  1332. if (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[0] != 0) {
  1333. for (bInx = 0; bInx < 50; bInx++)
  1334. memcpy(&cDstStr[0 + bInx], " ", 1);
  1335. for (bInx = 0; bInx < 7; bInx++) {
  1336. if ((_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[0] >> bInx) & 0x01)
  1337. memcpy(&cDstStr[0 + bInx * 7], &_cFsStr[bInx][0], 7);
  1338. }
  1339. hdmi_print("[HDMI]SUPPORT PCM Max 2CH, Fs is: %s\n", &cDstStr[0]);
  1340. }
  1341. if (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[4] != 0) {
  1342. for (bInx = 0; bInx < 50; bInx++)
  1343. memcpy(&cDstStr[0 + bInx], " ", 1);
  1344. for (bInx = 0; bInx < 7; bInx++) {
  1345. if ((_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[4] >> bInx) & 0x01)
  1346. memcpy(&cDstStr[0 + bInx * 7], &_cFsStr[bInx][0], 7);
  1347. }
  1348. hdmi_print("[HDMI]SUPPORT PCM Max 6CH Fs is: %s\n", &cDstStr[0]);
  1349. }
  1350. if (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[5] != 0) {
  1351. for (bInx = 0; bInx < 50; bInx++)
  1352. memcpy(&cDstStr[0 + bInx], " ", 1);
  1353. for (bInx = 0; bInx < 7; bInx++) {
  1354. if ((_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[5] >> bInx) & 0x01)
  1355. memcpy(&cDstStr[0 + bInx * 7], &_cFsStr[bInx][0], 7);
  1356. }
  1357. hdmi_print("[HDMI]SUPPORT PCM Max 7CH Fs is: %s\n", &cDstStr[0]);
  1358. }
  1359. if (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[6] != 0) {
  1360. for (bInx = 0; bInx < 50; bInx++)
  1361. memcpy(&cDstStr[0 + bInx], " ", 1);
  1362. for (bInx = 0; bInx < 7; bInx++) {
  1363. if ((_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[6] >> bInx) & 0x01)
  1364. memcpy(&cDstStr[0 + bInx * 7], &_cFsStr[bInx][0], 7);
  1365. }
  1366. hdmi_print("[HDMI]SUPPORT PCM Max 8CH, FS is: %s\n", &cDstStr[0]);
  1367. }
  1368. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_FL_FR)
  1369. hdmi_print("[HDMI]Speaker FL/FR allocated\n");
  1370. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_LFE)
  1371. hdmi_print("[HDMI]Speaker LFE allocated\n");
  1372. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_FC)
  1373. hdmi_print("[HDMI]Speaker FC allocated\n");
  1374. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_RL_RR)
  1375. hdmi_print("[HDMI]Speaker RL/RR allocated\n");
  1376. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_RC)
  1377. hdmi_print("[HDMI]Speaker RC allocated\n");
  1378. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_FLC_FRC)
  1379. hdmi_print("[HDMI]Speaker FLC/FRC allocated\n");
  1380. if (_HdmiSinkAvCap.ui1_sink_spk_allocation & SINK_AUDIO_RLC_RRC)
  1381. hdmi_print("[HDMI]Speaker RLC/RRC allocated\n");
  1382. hdmi_print("[HDMI]HDMI edid support content type =%x\n",
  1383. _HdmiSinkAvCap.ui1_sink_content_cnc);
  1384. hdmi_print("[HDMI]Lip Sync Progressive audio latency = %d\n",
  1385. _HdmiSinkAvCap.ui1_sink_p_audio_latency);
  1386. hdmi_print("[HDMI]Lip Sync Progressive video latency = %d\n",
  1387. _HdmiSinkAvCap.ui1_sink_p_video_latency);
  1388. if (_HdmiSinkAvCap.ui1_sink_i_latency_present) {
  1389. hdmi_print("[HDMI]Lip Sync Interlace audio latency = %d\n",
  1390. _HdmiSinkAvCap.ui1_sink_i_audio_latency);
  1391. hdmi_print("[HDMI]Lip Sync Interlace video latency = %d\n",
  1392. _HdmiSinkAvCap.ui1_sink_i_video_latency);
  1393. }
  1394. if (_HdmiSinkAvCap.ui1_sink_support_ai == 1)
  1395. hdmi_print("[HDMI]Support AI\n");
  1396. else
  1397. hdmi_print("[HDMI]Not Support AI\n");
  1398. hdmi_print("[HDMI]Monitor Max horizontal size = %d\n",
  1399. _HdmiSinkAvCap.ui1_Display_Horizontal_Size);
  1400. hdmi_print("[HDMI]Monitor Max vertical size = %d\n",
  1401. _HdmiSinkAvCap.ui1_Display_Vertical_Size);
  1402. if (_HdmiSinkAvCap.b_sink_hdmi_video_present == TRUE)
  1403. hdmi_print("[HDMI]HDMI_Video_Present\n");
  1404. else
  1405. hdmi_print("[HDMI]No HDMI_Video_Present\n");
  1406. if (_HdmiSinkAvCap.b_sink_3D_present == TRUE)
  1407. hdmi_print("[HDMI]3D_present\n");
  1408. else
  1409. hdmi_print("[HDMI]No 3D_present\n");
  1410. }
  1411. void hdmi_show_def_info(void)
  1412. {
  1413. unsigned int u4Res = 0;
  1414. if (_HdmiSinkAvCap.b_sink_support_hdmi_mode)
  1415. HDMI_DEF_LOG("[hdmi][edid]is hdmi\n");
  1416. else
  1417. HDMI_DEF_LOG("[hdmi][edid]is dvi\n");
  1418. u4Res = (_HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution |
  1419. _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution |
  1420. _HdmiSinkAvCap.ui4_sink_cea_pal_resolution |
  1421. _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution);
  1422. HDMI_DEF_LOG("[hdmi][edid]res:%x,aud_dec:%x,pa:%x\n", u4Res,
  1423. _HdmiSinkAvCap.ui2_sink_aud_dec, _HdmiSinkAvCap.ui2_sink_cec_address);
  1424. }
  1425. void mt8193_AppGetEdidInfo(HDMI_EDID_T *pv_get_info)
  1426. {
  1427. MT8193_EDID_FUNC();
  1428. pv_get_info->ui4_ntsc_resolution =
  1429. (_HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution
  1430. | _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution);
  1431. pv_get_info->ui4_pal_resolution =
  1432. (_HdmiSinkAvCap.
  1433. ui4_sink_cea_pal_resolution | _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution);
  1434. pv_get_info->ui4_sink_native_ntsc_resolution =
  1435. _HdmiSinkAvCap.ui4_sink_native_ntsc_resolution;
  1436. pv_get_info->ui4_sink_native_pal_resolution = _HdmiSinkAvCap.ui4_sink_native_pal_resolution;
  1437. pv_get_info->ui4_sink_cea_ntsc_resolution = _HdmiSinkAvCap.ui4_sink_cea_ntsc_resolution;
  1438. pv_get_info->ui4_sink_cea_pal_resolution = _HdmiSinkAvCap.ui4_sink_cea_pal_resolution;
  1439. pv_get_info->ui4_sink_dtd_ntsc_resolution = _HdmiSinkAvCap.ui4_sink_dtd_ntsc_resolution;
  1440. pv_get_info->ui4_sink_dtd_pal_resolution = _HdmiSinkAvCap.ui4_sink_dtd_pal_resolution;
  1441. pv_get_info->ui4_sink_1st_dtd_ntsc_resolution =
  1442. _HdmiSinkAvCap.ui4_sink_1st_dtd_ntsc_resolution;
  1443. pv_get_info->ui4_sink_1st_dtd_pal_resolution =
  1444. _HdmiSinkAvCap.ui4_sink_1st_dtd_pal_resolution;
  1445. pv_get_info->ui2_sink_colorimetry = _HdmiSinkAvCap.ui2_sink_colorimetry;
  1446. pv_get_info->ui1_sink_rgb_color_bit = _HdmiSinkAvCap.e_sink_rgb_color_bit;
  1447. pv_get_info->ui1_sink_ycbcr_color_bit = _HdmiSinkAvCap.e_sink_ycbcr_color_bit;
  1448. pv_get_info->ui2_sink_aud_dec = _HdmiSinkAvCap.ui2_sink_aud_dec;
  1449. pv_get_info->ui1_sink_is_plug_in = _stAvdAVInfo.b_hotplug_state;
  1450. pv_get_info->ui4_hdmi_pcm_ch_type = ((_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[0]) |
  1451. (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[4] << 8) |
  1452. (_HdmiSinkAvCap.ui1_sink_pcm_ch_sampling[6] << 16));
  1453. pv_get_info->ui1_sink_i_latency_present = _HdmiSinkAvCap.ui1_sink_i_latency_present;
  1454. pv_get_info->ui1_sink_p_audio_latency = _HdmiSinkAvCap.ui1_sink_p_audio_latency;
  1455. pv_get_info->ui1_sink_p_video_latency = _HdmiSinkAvCap.ui1_sink_p_video_latency;
  1456. pv_get_info->ui1_sink_i_audio_latency = _HdmiSinkAvCap.ui1_sink_i_audio_latency;
  1457. pv_get_info->ui1_sink_i_video_latency = _HdmiSinkAvCap.ui1_sink_i_video_latency;
  1458. pv_get_info->ui1ExtEdid_Revision = _HdmiSinkAvCap.ui1_ExtEdid_Revision;
  1459. pv_get_info->ui1Edid_Version = _HdmiSinkAvCap.ui1_Edid_Version;
  1460. pv_get_info->ui1Edid_Revision = _HdmiSinkAvCap.ui1_Edid_Revision;
  1461. pv_get_info->ui1_Display_Horizontal_Size = _HdmiSinkAvCap.ui1_Display_Horizontal_Size;
  1462. pv_get_info->ui1_Display_Vertical_Size = _HdmiSinkAvCap.ui1_Display_Vertical_Size;
  1463. pv_get_info->ui2_sink_cec_address = _HdmiSinkAvCap.ui2_sink_cec_address;
  1464. }
  1465. unsigned char mt8193_Check_EdidHeader(void)
  1466. {
  1467. unsigned char bIdx;
  1468. unsigned char *prbData;
  1469. prbData = &_bEdidData[0];
  1470. /* check if EDID header pass, ie. EDID[0] ~ EDID[7] == specify header pattern */
  1471. for (bIdx = EDID_ADDR_HEADER; bIdx < (EDID_ADDR_HEADER + EDID_HEADER_LEN); bIdx++) {
  1472. if (*(prbData + bIdx) != aEDIDHeader[bIdx])
  1473. return FALSE;
  1474. }
  1475. /* EDID Header Check OK Here */
  1476. return TRUE;
  1477. }
  1478. #endif