ddp_dump.c 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #define LOG_TAG "DUMP"
  32. #include <platform/ddp_info.h>
  33. #include <platform/ddp_log.h>
  34. #include <platform/ddp_path.h>
  35. #include <platform/ddp_dump.h>
  36. #include <platform/ddp_rdma.h>
  37. #include <platform/disp_drv_platform.h>
  38. #include "platform/ddp_reg.h"
  39. #include <platform/ddp_dsi.h>
  40. static const char* ddp_signal[2][32] = {
  41. {
  42. "disp_aal0__to__disp_gamma0",
  43. "disp_ccorr0__to__disp_aal0",
  44. "disp_color0__to__disp_color0_out_sel_in0",
  45. "disp_color_out_sel__to__disp_ccorr0",
  46. "disp_dither0__to__disp_dither0_mout",
  47. "disp_gamma0__to__disp_dither0",
  48. "disp_ovl0_2l__to__disp_ovl0_2l_mout",
  49. "disp_ovl0_2l_mout_out0__to__disp_path0_sel_in1",
  50. "disp_ovl0_2l_mout_out1__to__disp_wdma0_sel_in2",
  51. "disp_ovl0_2l_mout_out2__to__disp_rsz0_sel_in1",
  52. "disp_ovl0__to__disp_ovl0_mout",
  53. "disp_ovl0_mout_out0__to__disp_path0_sel_in0",
  54. "disp_ovl0_mout_out1__to__disp_ovl_2l_in0",
  55. "disp_ovl0_mout_out2__to__disp_wdma0_sel_in1",
  56. "disp_ovl0_mout_out3__to__disp_rsz0_sel_in0",
  57. "disp_path0_sel__to__disp_rdma0",
  58. "disp_rdma0__to__disp_rdma0_rsz0_in_sout",
  59. "disp_rdma_rsz_in_sout_out0__to__disp_rdma_rsz_sel_in0",
  60. "disp_rdma_rsz_in_sout_out1__to__disp_rsz0_sel_in2",
  61. "disp_rdma0_rsz0_sel__to__disp_rdma0_sout",
  62. "disp_rdma0_sout_out0__to__dsi0_sel_in0",
  63. "disp_rdma0_sout_out1__to__disp_color0",
  64. "disp_rdma0_sout_out2__to__disp_color0_out_sel_in1",
  65. "disp_rsz0__to__disp_rsz0_mout",
  66. "disp_rsz0_mout_out0__to__disp_path0_sel_in2",
  67. "disp_rsz0_mout_out1__to__disp_ovl0_in2",
  68. "disp_rsz0_mout_out2__to__dsi1_ovl0_2l_in2",
  69. "disp_rsz0_mout_out3__to__disp_rdma_rsz_sel_in1",
  70. "disp_rsz0_mout_out4__to__disp_wdma0_sel_in3",
  71. "disp_rsz0_sel__to__disp_rsz0",
  72. "disp_wdma0_sel__to__disp_wdma0",
  73. "dither0_mout_out0__to__dsi0_sel_in1",
  74. },
  75. {
  76. "dither0_mout_out1__to__disp_wdma0_sel_in0",
  77. "dsi0_sel__to__dsi0",
  78. },
  79. };
  80. static char *ddp_greq_name(int bit)
  81. {
  82. switch (bit) {
  83. case 0:
  84. return "OVL0";
  85. case 1:
  86. return "OVL0_2L";
  87. case 2:
  88. return "DISP_RDMA0";
  89. case 3:
  90. return "DISP_WDMA0";
  91. case 4:
  92. return "MDP_RDMA0";
  93. case 5:
  94. return "MDP_WDMA0";
  95. case 6:
  96. return "MDP_WROT0";
  97. case 7:
  98. return "DISP_FAKE";
  99. default:
  100. return NULL;
  101. }
  102. }
  103. static char *ddp_get_mutex_module0_name(unsigned int bit)
  104. {
  105. switch (bit) {
  106. case 0: return "mdp_rdma0";
  107. case 1: return "mdp_ccorr0";
  108. case 2: return "mdp_rsz0";
  109. case 3: return "mdp_rsz1";
  110. case 4: return "mdp_wdma0";
  111. case 5: return "mdp_wrot0";
  112. case 6: return "mdp_tdshp";
  113. case 7: return "disp_ovl0";
  114. case 8: return "disp_ovl0_2l";
  115. case 9: return "disp_rdma0";
  116. case 10: return "disp_wdma0";
  117. case 11: return "disp_color0";
  118. case 12: return "disp_ccorr0";
  119. case 13: return "disp_aal0";
  120. case 14: return "disp_gamma0";
  121. case 15: return "disp_dither0";
  122. case 16: return "DSI0";
  123. case 17: return "disp_rsz0";
  124. case 18: return "img_dl_ready";
  125. case 19: return "disp_pwm0";
  126. default: return "mutex-unknown";
  127. }
  128. }
  129. char *ddp_get_fmt_name(DISP_MODULE_ENUM module, unsigned int fmt)
  130. {
  131. if (module == DISP_MODULE_WDMA0) {
  132. switch (fmt) {
  133. case 0:
  134. return "rgb565";
  135. case 1:
  136. return "rgb888";
  137. case 2:
  138. return "rgba8888";
  139. case 3:
  140. return "argb8888";
  141. case 4:
  142. return "uyvy";
  143. case 5:
  144. return "yuy2";
  145. case 7:
  146. return "y-only";
  147. case 8:
  148. return "iyuv";
  149. case 12:
  150. return "nv12";
  151. default:
  152. DDPDUMP("ddp_get_fmt_name, unknown fmt=%d, module=%d\n", fmt, module);
  153. return "unknown";
  154. }
  155. } else if (module == DISP_MODULE_OVL0) {
  156. switch (fmt) {
  157. case 0:
  158. return "rgb565";
  159. case 1:
  160. return "rgb888";
  161. case 2:
  162. return "rgba8888";
  163. case 3:
  164. return "argb8888";
  165. case 4:
  166. return "uyvy";
  167. case 5:
  168. return "yuyv";
  169. default:
  170. DDPDUMP("ddp_get_fmt_name, unknown fmt=%d, module=%d\n", fmt, module);
  171. return "unknown";
  172. }
  173. } else if (module == DISP_MODULE_RDMA0 || module == DISP_MODULE_RDMA1) {
  174. switch (fmt) {
  175. case 0:
  176. return "rgb565";
  177. case 1:
  178. return "rgb888";
  179. case 2:
  180. return "rgba8888";
  181. case 3:
  182. return "argb8888";
  183. case 4:
  184. return "uyvy";
  185. case 5:
  186. return "yuyv";
  187. default:
  188. DDPDUMP("ddp_get_fmt_name, unknown fmt=%d, module=%d\n", fmt, module);
  189. return "unknown";
  190. }
  191. } else {
  192. DDPDUMP("ddp_get_fmt_name, unknown module=%d\n", module);
  193. }
  194. return "unknown";
  195. }
  196. static char *ddp_clock_0(int bit)
  197. {
  198. switch (bit) {
  199. case 7:
  200. return "ovl0, ";
  201. case 8:
  202. return "ovl0_2L, ";
  203. case 9:
  204. return "disp_rsz0, ";
  205. case 10:
  206. return "rdma0, ";
  207. case 11:
  208. return "wdma0, ";
  209. case 12:
  210. return "color, ";
  211. case 13:
  212. return "ccorr, ";
  213. case 14:
  214. return "aal, ";
  215. case 15:
  216. return "gamma, ";
  217. case 16:
  218. return "dither, ";
  219. case 17:
  220. return "dsi0_mm(cg), ";
  221. case 19:
  222. return "smi_common(cg), ";
  223. case 20:
  224. return "smi_larb0(cg), ";
  225. case 21:
  226. return "smi_comm0(cg), ";
  227. case 22:
  228. return "smi_comm1(cg), ";
  229. case 28:
  230. return "dsi0_interface(cg), ";
  231. case 29:
  232. return "26M, ";
  233. default:
  234. return NULL;
  235. }
  236. }
  237. /* cervino no need ddp_clock_1 */
  238. /*
  239. * static char *ddp_clock_1(int bit)
  240. * {
  241. * switch (bit) {
  242. * case 0:
  243. * return "dsi0_mm(cg), ";
  244. * case 1:
  245. * return "dsi0_interface(cg), ";
  246. * case 7:
  247. * return "26M, ";
  248. * default:
  249. * return NULL;
  250. * }
  251. * }
  252. */
  253. static void mutex_dump_reg(void)
  254. {
  255. unsigned long module_base = DISPSYS_MUTEX_BASE;
  256. DDPDUMP("== START: DISP MUTEX registers ==\n");
  257. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  258. 0x0, INREG32(module_base + 0x0),
  259. 0x4, INREG32(module_base + 0x4),
  260. 0x8, INREG32(module_base + 0x8),
  261. 0xC, INREG32(module_base + 0xC));
  262. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  263. 0x10, INREG32(module_base + 0x10),
  264. 0x18, INREG32(module_base + 0x18),
  265. 0x1C, INREG32(module_base + 0x1C),
  266. 0x020, INREG32(module_base + 0x020));
  267. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  268. 0x024, INREG32(module_base + 0x024),
  269. 0x028, INREG32(module_base + 0x028),
  270. 0x02C, INREG32(module_base + 0x02C),
  271. 0x030, INREG32(module_base + 0x030));
  272. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  273. 0x040, INREG32(module_base + 0x040),
  274. 0x044, INREG32(module_base + 0x044),
  275. 0x048, INREG32(module_base + 0x048),
  276. 0x04C, INREG32(module_base + 0x04C));
  277. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  278. 0x050, INREG32(module_base + 0x050),
  279. 0x060, INREG32(module_base + 0x060),
  280. 0x064, INREG32(module_base + 0x064),
  281. 0x068, INREG32(module_base + 0x068));
  282. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  283. 0x06C, INREG32(module_base + 0x06C),
  284. 0x070, INREG32(module_base + 0x070),
  285. 0x080, INREG32(module_base + 0x080),
  286. 0x084, INREG32(module_base + 0x084));
  287. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  288. 0x088, INREG32(module_base + 0x088),
  289. 0x08C, INREG32(module_base + 0x08C),
  290. 0x090, INREG32(module_base + 0x090),
  291. 0x0A0, INREG32(module_base + 0x0A0));
  292. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  293. 0x0A4, INREG32(module_base + 0x0A4),
  294. 0x0A8, INREG32(module_base + 0x0A8),
  295. 0x0AC, INREG32(module_base + 0x0AC),
  296. 0x0B0, INREG32(module_base + 0x0B0));
  297. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  298. 0x0C0, INREG32(module_base + 0x0C0),
  299. 0x0C4, INREG32(module_base + 0x0C4),
  300. 0x0C8, INREG32(module_base + 0x0C8),
  301. 0x0CC, INREG32(module_base + 0x0CC));
  302. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  303. 0x0D0, INREG32(module_base + 0x0D0),
  304. 0x0E0, INREG32(module_base + 0x0E0),
  305. 0x0E4, INREG32(module_base + 0x0E4),
  306. 0x0E8, INREG32(module_base + 0x0E8));
  307. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  308. 0x0EC, INREG32(module_base + 0x0EC),
  309. 0x0F0, INREG32(module_base + 0x0F0),
  310. 0x100, INREG32(module_base + 0x100),
  311. 0x104, INREG32(module_base + 0x104));
  312. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  313. 0x108, INREG32(module_base + 0x108),
  314. 0x10C, INREG32(module_base + 0x10C),
  315. 0x110, INREG32(module_base + 0x110),
  316. 0x120, INREG32(module_base + 0x120));
  317. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  318. 0x124, INREG32(module_base + 0x124),
  319. 0x128, INREG32(module_base + 0x128),
  320. 0x12C, INREG32(module_base + 0x12C),
  321. 0x130, INREG32(module_base + 0x130));
  322. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  323. 0x140, INREG32(module_base + 0x140),
  324. 0x144, INREG32(module_base + 0x144),
  325. 0x148, INREG32(module_base + 0x148),
  326. 0x14C, INREG32(module_base + 0x14C));
  327. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  328. 0x150, INREG32(module_base + 0x150),
  329. 0x160, INREG32(module_base + 0x160),
  330. 0x164, INREG32(module_base + 0x164),
  331. 0x168, INREG32(module_base + 0x168));
  332. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  333. 0x16C, INREG32(module_base + 0x16C),
  334. 0x170, INREG32(module_base + 0x170),
  335. 0x180, INREG32(module_base + 0x180),
  336. 0x184, INREG32(module_base + 0x184));
  337. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  338. 0x188, INREG32(module_base + 0x188),
  339. 0x18C, INREG32(module_base + 0x18C),
  340. 0x190, INREG32(module_base + 0x190),
  341. 0x300, INREG32(module_base + 0x300));
  342. DDPDUMP("MUTEX: 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  343. 0x304, INREG32(module_base + 0x304),
  344. 0x30C, INREG32(module_base + 0x30C));
  345. DDPDUMP("-- END: DISP MUTEX registers --\n");
  346. return;
  347. }
  348. static void mutex_dump_analysis(void)
  349. {
  350. int i = 0;
  351. int j = 0;
  352. char mutex_module[512] = { '\0' };
  353. char *p = NULL;
  354. int len = 0;
  355. unsigned int val;
  356. DDPDUMP("== DISP Mutex Analysis ==\n");
  357. for (i = 0; i < 5; i++) {
  358. p = mutex_module;
  359. len = 0;
  360. if (DISP_REG_GET(DISP_REG_CONFIG_MUTEX_MOD0(i)) == 0)
  361. continue;
  362. val = DISP_REG_GET(DISP_REG_CONFIG_MUTEX_SOF(i));
  363. len = sprintf(p, "MUTEX%d :SOF=%s,EOF=%s,WAIT=%d,module=(",
  364. i,
  365. ddp_get_mutex_sof_name(REG_FLD_VAL_GET(SOF_FLD_MUTEX0_SOF, val)),
  366. ddp_get_mutex_sof_name(REG_FLD_VAL_GET(SOF_FLD_MUTEX0_EOF, val)),
  367. REG_FLD_VAL_GET(SOF_FLD_MUTEX0_SOF_WAIT, val));
  368. p += len;
  369. for (j = 0; j < 32; j++) {
  370. unsigned int regval = DISP_REG_GET(DISP_REG_CONFIG_MUTEX_MOD0(i));
  371. if ((regval & (1 << j))) {
  372. len = sprintf(p, "%s,", ddp_get_mutex_module0_name(j));
  373. p += len;
  374. }
  375. }
  376. DDPDUMP("%s)\n", mutex_module);
  377. }
  378. }
  379. static void mmsys_config_dump_reg(void)
  380. {
  381. unsigned long module_base = DISPSYS_CONFIG_BASE;
  382. DDPDUMP("== START: DISP MMSYS_CONFIG registers ==\n");
  383. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  384. 0x000, INREG32(module_base + 0x000),
  385. 0x004, INREG32(module_base + 0x004),
  386. 0x00C, INREG32(module_base + 0x00C),
  387. 0x010, INREG32(module_base + 0x010));
  388. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  389. 0x014, INREG32(module_base + 0x014),
  390. 0x018, INREG32(module_base + 0x018),
  391. 0x020, INREG32(module_base + 0x020),
  392. 0x024, INREG32(module_base + 0x024));
  393. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  394. 0x028, INREG32(module_base + 0x028),
  395. 0x02C, INREG32(module_base + 0x02C),
  396. 0x030, INREG32(module_base + 0x030),
  397. 0x034, INREG32(module_base + 0x034));
  398. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  399. 0x038, INREG32(module_base + 0x038),
  400. 0x048, INREG32(module_base + 0x048),
  401. 0x0F0, INREG32(module_base + 0x0F0),
  402. 0x0F4, INREG32(module_base + 0x0F4));
  403. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  404. 0x0F8, INREG32(module_base + 0x0F8),
  405. 0x100, INREG32(module_base + 0x100),
  406. 0x104, INREG32(module_base + 0x104),
  407. 0x108, INREG32(module_base + 0x108));
  408. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  409. 0x110, INREG32(module_base + 0x110),
  410. 0x114, INREG32(module_base + 0x114),
  411. 0x118, INREG32(module_base + 0x118),
  412. 0x120, INREG32(module_base + 0x120));
  413. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  414. 0x124, INREG32(module_base + 0x124),
  415. 0x128, INREG32(module_base + 0x128),
  416. 0x130, INREG32(module_base + 0x130),
  417. 0x134, INREG32(module_base + 0x134));
  418. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  419. 0x138, INREG32(module_base + 0x138),
  420. 0x140, INREG32(module_base + 0x140),
  421. 0x144, INREG32(module_base + 0x144),
  422. 0x150, INREG32(module_base + 0x150));
  423. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  424. 0x180, INREG32(module_base + 0x180),
  425. 0x184, INREG32(module_base + 0x184),
  426. 0x190, INREG32(module_base + 0x190),
  427. 0x200, INREG32(module_base + 0x200));
  428. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  429. 0x204, INREG32(module_base + 0x204),
  430. 0x208, INREG32(module_base + 0x208),
  431. 0x20C, INREG32(module_base + 0x20C),
  432. 0x210, INREG32(module_base + 0x210));
  433. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  434. 0x214, INREG32(module_base + 0x214),
  435. 0x218, INREG32(module_base + 0x218),
  436. 0x220, INREG32(module_base + 0x220),
  437. 0x224, INREG32(module_base + 0x224));
  438. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  439. 0x228, INREG32(module_base + 0x228),
  440. 0x22C, INREG32(module_base + 0x22C),
  441. 0x230, INREG32(module_base + 0x230),
  442. 0x234, INREG32(module_base + 0x234));
  443. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  444. 0x238, INREG32(module_base + 0x238),
  445. 0x800, INREG32(module_base + 0x800),
  446. 0x804, INREG32(module_base + 0x804),
  447. 0x808, INREG32(module_base + 0x808));
  448. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  449. 0x80C, INREG32(module_base + 0x80C),
  450. 0x810, INREG32(module_base + 0x810),
  451. 0x814, INREG32(module_base + 0x814),
  452. 0x818, INREG32(module_base + 0x818));
  453. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  454. 0x81C, INREG32(module_base + 0x81C),
  455. 0x820, INREG32(module_base + 0x820),
  456. 0x824, INREG32(module_base + 0x824),
  457. 0x828, INREG32(module_base + 0x828));
  458. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  459. 0x82C, INREG32(module_base + 0x82C),
  460. 0x830, INREG32(module_base + 0x830),
  461. 0x834, INREG32(module_base + 0x834),
  462. 0x838, INREG32(module_base + 0x838));
  463. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  464. 0x83C, INREG32(module_base + 0x83C),
  465. 0x840, INREG32(module_base + 0x840),
  466. 0x844, INREG32(module_base + 0x844),
  467. 0x848, INREG32(module_base + 0x848));
  468. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  469. 0x84C, INREG32(module_base + 0x84C),
  470. 0x854, INREG32(module_base + 0x854),
  471. 0x858, INREG32(module_base + 0x858),
  472. 0x85C, INREG32(module_base + 0x85C));
  473. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  474. 0x860, INREG32(module_base + 0x860),
  475. 0x864, INREG32(module_base + 0x864),
  476. 0x868, INREG32(module_base + 0x868),
  477. 0x870, INREG32(module_base + 0x870));
  478. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  479. 0x874, INREG32(module_base + 0x874),
  480. 0x878, INREG32(module_base + 0x878),
  481. 0x88C, INREG32(module_base + 0x88C),
  482. 0x890, INREG32(module_base + 0x890));
  483. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  484. 0x894, INREG32(module_base + 0x894),
  485. 0x898, INREG32(module_base + 0x898),
  486. 0x89C, INREG32(module_base + 0x89C),
  487. 0x8A0, INREG32(module_base + 0x8A0));
  488. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  489. 0x8A4, INREG32(module_base + 0x8A4),
  490. 0x8A8, INREG32(module_base + 0x8A8),
  491. 0x8AC, INREG32(module_base + 0x8AC),
  492. 0x8B0, INREG32(module_base + 0x8B0));
  493. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  494. 0x8B4, INREG32(module_base + 0x8B4),
  495. 0x8B8, INREG32(module_base + 0x8B8),
  496. 0x8C0, INREG32(module_base + 0x8C0),
  497. 0x8C4, INREG32(module_base + 0x8C4));
  498. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  499. 0x8CC, INREG32(module_base + 0x8CC),
  500. 0x8D0, INREG32(module_base + 0x8D0),
  501. 0x8D4, INREG32(module_base + 0x8D4),
  502. 0x8D8, INREG32(module_base + 0x8D8));
  503. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  504. 0x8DC, INREG32(module_base + 0x8DC),
  505. 0x8E0, INREG32(module_base + 0x8E0),
  506. 0x8E4, INREG32(module_base + 0x8E4),
  507. 0x8E8, INREG32(module_base + 0x8E8));
  508. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  509. 0x8EC, INREG32(module_base + 0x8EC),
  510. 0x8F0, INREG32(module_base + 0x8F0),
  511. 0x908, INREG32(module_base + 0x908),
  512. 0x90C, INREG32(module_base + 0x90C));
  513. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  514. 0x910, INREG32(module_base + 0x910),
  515. 0x914, INREG32(module_base + 0x914),
  516. 0x918, INREG32(module_base + 0x918),
  517. 0x91C, INREG32(module_base + 0x91C));
  518. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  519. 0x920, INREG32(module_base + 0x920),
  520. 0x924, INREG32(module_base + 0x924),
  521. 0x928, INREG32(module_base + 0x928),
  522. 0x934, INREG32(module_base + 0x934));
  523. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  524. 0x938, INREG32(module_base + 0x938),
  525. 0x93C, INREG32(module_base + 0x93C),
  526. 0x940, INREG32(module_base + 0x940),
  527. 0x944, INREG32(module_base + 0x944));
  528. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  529. 0xF00, INREG32(module_base + 0xF00),
  530. 0xF04, INREG32(module_base + 0xF04),
  531. 0xF08, INREG32(module_base + 0xF08),
  532. 0xF0C, INREG32(module_base + 0xF0C));
  533. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  534. 0xF10, INREG32(module_base + 0xF10),
  535. 0xF20, INREG32(module_base + 0xF20),
  536. 0xF24, INREG32(module_base + 0xF24),
  537. 0xF28, INREG32(module_base + 0xF28));
  538. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  539. 0xF2C, INREG32(module_base + 0xF2C),
  540. 0xF30, INREG32(module_base + 0xF30),
  541. 0xF34, INREG32(module_base + 0xF34),
  542. 0xF38, INREG32(module_base + 0xF38));
  543. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  544. 0xF3C, INREG32(module_base + 0xF3C),
  545. 0xF40, INREG32(module_base + 0xF40),
  546. 0xF44, INREG32(module_base + 0xF44),
  547. 0xF48, INREG32(module_base + 0xF48));
  548. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  549. 0xF50, INREG32(module_base + 0xF50),
  550. 0xF54, INREG32(module_base + 0xF54),
  551. 0xF58, INREG32(module_base + 0xF58),
  552. 0xF5C, INREG32(module_base + 0xF5C));
  553. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  554. 0xF80, INREG32(module_base + 0xF80),
  555. 0xF84, INREG32(module_base + 0xF84),
  556. 0xF88, INREG32(module_base + 0xF88),
  557. 0xF8C, INREG32(module_base + 0xF8C));
  558. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  559. 0xF90, INREG32(module_base + 0xF90),
  560. 0xF94, INREG32(module_base + 0xF94),
  561. 0xF98, INREG32(module_base + 0xF98),
  562. 0xFA0, INREG32(module_base + 0xFA0));
  563. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  564. 0xFA4, INREG32(module_base + 0xFA4),
  565. 0xFA8, INREG32(module_base + 0xFA8),
  566. 0xFAC, INREG32(module_base + 0xFAC),
  567. 0xFB0, INREG32(module_base + 0xFB0));
  568. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  569. 0xFC0, INREG32(module_base + 0xFC0),
  570. 0XFC4, INREG32(module_base + 0XFC4),
  571. 0xFC8, INREG32(module_base + 0xFC8),
  572. 0xFCC, INREG32(module_base + 0xFCC));
  573. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  574. 0xFD0, INREG32(module_base + 0xFD0),
  575. 0xFD4, INREG32(module_base + 0xFD4),
  576. 0xFD8, INREG32(module_base + 0xFD8),
  577. 0xFDC, INREG32(module_base + 0xFDC));
  578. DDPDUMP("MMSYS_CONFIG: 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  579. 0xFE0, INREG32(module_base + 0xFE0),
  580. 0xFE4, INREG32(module_base + 0xFE4));
  581. DDPDUMP("-- END: DISP MMSYS_CONFIG registers --\n");
  582. return;
  583. }
  584. /* ------ clock:
  585. Before power on mmsys:
  586. CLK_CFG_0_CLR (address is 0x10000048) = 0x80000000 (bit 31).
  587. Before using DISP_PWM0 or DISP_PWM1:
  588. CLK_CFG_1_CLR(address is 0x10000058)=0x80 (bit 7).
  589. Before using DPI pixel clock:
  590. CLK_CFG_6_CLR(address is 0x100000A8)=0x80 (bit 7).
  591. Only need to enable the corresponding bits of MMSYS_CG_CON0 and MMSYS_CG_CON1 for the modules:
  592. smi_common, larb0, mdp_crop, fake_eng, mutex_32k, pwm0, pwm1, dsi0, dsi1, dpi.
  593. Other bits could keep 1. Suggest to keep smi_common and larb0 always clock on.
  594. --------valid & ready
  595. example:
  596. ovl0 -> ovl0_mout_ready=1 means engines after ovl_mout are ready for receiving data
  597. ovl0_mout_ready=0 means ovl0_mout can not receive data, maybe ovl0_mout or after engines config error
  598. ovl0 -> ovl0_mout_valid=1 means engines before ovl0_mout is OK,
  599. ovl0_mout_valid=0 means ovl can not transfer data to ovl0_mout, means ovl0 or before engines are not ready.
  600. */
  601. static void mmsys_config_dump_analysis(void)
  602. {
  603. unsigned int i = 0, j;
  604. unsigned int reg = 0;
  605. char clock_on[512] = { '\0' };
  606. char *pos = NULL;
  607. const char *name;
  608. /* int len = 0; */
  609. unsigned int valid[2], ready[2];
  610. unsigned int greq;
  611. valid[0] = DISP_REG_GET(DISP_REG_CONFIG_DISP_DL_VALID_0);
  612. valid[1] = DISP_REG_GET(DISP_REG_CONFIG_DISP_DL_VALID_1);
  613. ready[0] = DISP_REG_GET(DISP_REG_CONFIG_DISP_DL_READY_0);
  614. ready[1] = DISP_REG_GET(DISP_REG_CONFIG_DISP_DL_READY_1);
  615. greq = DISP_REG_GET(DISP_REG_CONFIG_SMI_LARB0_GREQ);
  616. DDPDUMP("== DISP MMSYS_CONFIG ANALYSIS ==\n");
  617. #if 0 /* TODO: mmsys clk?? */
  618. DDPDUMP("mmsys clock=0x%x, CG_CON0=0x%x, CG_CON1=0x%x\n",
  619. DISP_REG_GET(DISP_REG_CLK_CFG_0_MM_CLK),
  620. DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON0),
  621. DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON1));
  622. if ((DISP_REG_GET(DISP_REG_CLK_CFG_0_MM_CLK) >> 31) & 0x1)
  623. DDPERR("mmsys clock abnormal!!\n");
  624. #endif
  625. reg = DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON0);
  626. for (i = 0; i < 32; i++) {
  627. if ((reg & (1 << i)) == 0) {
  628. name = ddp_clock_0(i);
  629. if (name)
  630. strncat(clock_on, name, sizeof(clock_on));
  631. }
  632. }
  633. /* cervino no need ddp_clock_1 */
  634. /*
  635. * reg = DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON1);
  636. * for (i = 0; i < 32; i++) {
  637. * if ((reg & (1 << i)) == 0) {
  638. * name = ddp_clock_1(i);
  639. * if (name)
  640. * strncat(clock_on, name,
  641. * (sizeof(clock_on) -
  642. * strlen(clock_on) - 1));
  643. * }
  644. * }
  645. */
  646. DDPDUMP("clock on modules:%s\n", clock_on);
  647. DDPDUMP("valid0=0x%x,valid1=0x%x,ready0=0x%x,ready1=0x%x,greq=0%x\n",
  648. valid[0], valid[1], ready[0], ready[1], greq);
  649. for (j = 0; j < ARRAY_SIZE(valid); j++) {
  650. for (i = 0; i < 32; i++) {
  651. name = ddp_signal[j][i];
  652. if (!name)
  653. continue;
  654. pos = clock_on;
  655. if ((valid[j] & (1 << i)))
  656. pos += sprintf(pos, "%s,", "v");
  657. else
  658. pos += sprintf(pos, "%s,", "n");
  659. if ((ready[j] & (1 << i)))
  660. pos += sprintf(pos, "%s", "r");
  661. else
  662. pos += sprintf(pos, "%s", "n");
  663. pos += sprintf(pos, ": %s", name);
  664. DDPDUMP("%s\n", clock_on);
  665. }
  666. }
  667. /* greq: 1 means SMI dose not grant, maybe SMI hang */
  668. if (greq)
  669. DDPDUMP("smi greq not grant module: (greq: 1 means SMI dose not grant, maybe SMI hang)");
  670. clock_on[0] = '\0';
  671. for (i = 0; i < 32; i++) {
  672. if (greq & (1 << i)) {
  673. name = ddp_greq_name(i);
  674. if (!name)
  675. continue;
  676. strncat(clock_on, name, sizeof(clock_on));
  677. }
  678. }
  679. DDPDUMP("%s\n", clock_on);
  680. }
  681. static void gamma_dump_reg(void)
  682. {
  683. unsigned long module_base = DISPSYS_GAMMA_BASE;
  684. DDPDUMP("== START: DISP gamma0 registers ==\n");
  685. DDPDUMP("gamma0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  686. 0x0000, INREG32(module_base + 0x0000),
  687. 0x0004, INREG32(module_base + 0x0004),
  688. 0x0008, INREG32(module_base + 0x0008),
  689. 0x000c, INREG32(module_base + 0x000c));
  690. DDPDUMP("gamma0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  691. 0x0010, INREG32(module_base + 0x0010),
  692. 0x0020, INREG32(module_base + 0x0020),
  693. 0x0024, INREG32(module_base + 0x0024),
  694. 0x0028, INREG32(module_base + 0x0028));
  695. DDPDUMP("gamma0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  696. 0x002c, INREG32(module_base + 0x002c),
  697. 0x0030, INREG32(module_base + 0x0030),
  698. 0x0034, INREG32(module_base + 0x0034),
  699. 0x0700, INREG32(module_base + 0x0700));
  700. DDPDUMP("-- END: DISP gamma0 registers --\n");
  701. }
  702. static void gamma_dump_analysis(void)
  703. {
  704. DDPDUMP("== DISP GAMMA ANALYSIS ==\n");
  705. DDPDUMP("gamma: en=%d, w=%d, h=%d, in_p_cnt=%d, in_l_cnt=%d, out_p_cnt=%d, out_l_cnt=%d\n",
  706. DISP_REG_GET(DISP_REG_GAMMA_EN),
  707. (DISP_REG_GET(DISP_REG_GAMMA_SIZE) >> 16) & 0x1fff,
  708. DISP_REG_GET(DISP_REG_GAMMA_SIZE) & 0x1fff,
  709. DISP_REG_GET(DISP_REG_GAMMA_INPUT_COUNT) & 0x1fff,
  710. (DISP_REG_GET(DISP_REG_GAMMA_INPUT_COUNT) >> 16) & 0x1fff,
  711. DISP_REG_GET(DISP_REG_GAMMA_OUTPUT_COUNT) & 0x1fff,
  712. (DISP_REG_GET(DISP_REG_GAMMA_OUTPUT_COUNT) >> 16) & 0x1fff);
  713. }
  714. static void color_dump_reg(DISP_MODULE_ENUM module)
  715. {
  716. int idx = 0;
  717. unsigned long module_base = DISPSYS_COLOR0_BASE;
  718. DDPDUMP("== START: DISP COLOR%d registers ==\n", idx);
  719. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  720. idx,
  721. 0x00000400, INREG32(module_base + 0x00000400),
  722. 0x00000404, INREG32(module_base + 0x00000404),
  723. 0x00000408, INREG32(module_base + 0x00000408),
  724. 0x0000040C, INREG32(module_base + 0x0000040C));
  725. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  726. idx,
  727. 0x00000410, INREG32(module_base + 0x00000410),
  728. 0x00000418, INREG32(module_base + 0x00000418),
  729. 0x0000041C, INREG32(module_base + 0x0000041C),
  730. 0x00000420, INREG32(module_base + 0x00000420));
  731. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  732. idx,
  733. 0x00000428, INREG32(module_base + 0x00000428),
  734. 0x0000042C, INREG32(module_base + 0x0000042C),
  735. 0x00000430, INREG32(module_base + 0x00000430),
  736. 0x00000434, INREG32(module_base + 0x00000434));
  737. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  738. idx,
  739. 0x00000438, INREG32(module_base + 0x00000438),
  740. 0x00000484, INREG32(module_base + 0x00000484),
  741. 0x00000488, INREG32(module_base + 0x00000488),
  742. 0x0000048C, INREG32(module_base + 0x0000048C));
  743. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  744. idx,
  745. 0x00000490, INREG32(module_base + 0x00000490),
  746. 0x00000494, INREG32(module_base + 0x00000494),
  747. 0x00000498, INREG32(module_base + 0x00000498),
  748. 0x0000049C, INREG32(module_base + 0x0000049C));
  749. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  750. idx,
  751. 0x000004A0, INREG32(module_base + 0x000004A0),
  752. 0x000004A4, INREG32(module_base + 0x000004A4),
  753. 0x000004A8, INREG32(module_base + 0x000004A8),
  754. 0x000004AC, INREG32(module_base + 0x000004AC));
  755. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  756. idx,
  757. 0x000004B0, INREG32(module_base + 0x000004B0),
  758. 0x000004B4, INREG32(module_base + 0x000004B4),
  759. 0x000004B8, INREG32(module_base + 0x000004B8),
  760. 0x000004BC, INREG32(module_base + 0x000004BC));
  761. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  762. idx,
  763. 0x00000620, INREG32(module_base + 0x00000620),
  764. 0x00000624, INREG32(module_base + 0x00000624),
  765. 0x00000628, INREG32(module_base + 0x00000628),
  766. 0x0000062C, INREG32(module_base + 0x0000062C));
  767. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  768. idx,
  769. 0x00000630, INREG32(module_base + 0x00000630),
  770. 0x00000740, INREG32(module_base + 0x00000740),
  771. 0x0000074C, INREG32(module_base + 0x0000074C),
  772. 0x00000768, INREG32(module_base + 0x00000768));
  773. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  774. idx,
  775. 0x0000076C, INREG32(module_base + 0x0000076C),
  776. 0x0000079C, INREG32(module_base + 0x0000079C),
  777. 0x000007E0, INREG32(module_base + 0x000007E0),
  778. 0x000007E4, INREG32(module_base + 0x000007E4));
  779. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  780. idx,
  781. 0x000007E8, INREG32(module_base + 0x000007E8),
  782. 0x000007EC, INREG32(module_base + 0x000007EC),
  783. 0x000007F0, INREG32(module_base + 0x000007F0),
  784. 0x000007FC, INREG32(module_base + 0x000007FC));
  785. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  786. idx,
  787. 0x00000800, INREG32(module_base + 0x00000800),
  788. 0x00000804, INREG32(module_base + 0x00000804),
  789. 0x00000808, INREG32(module_base + 0x00000808),
  790. 0x0000080C, INREG32(module_base + 0x0000080C));
  791. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  792. idx,
  793. 0x00000810, INREG32(module_base + 0x00000810),
  794. 0x00000814, INREG32(module_base + 0x00000814),
  795. 0x00000818, INREG32(module_base + 0x00000818),
  796. 0x0000081C, INREG32(module_base + 0x0000081C));
  797. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  798. idx,
  799. 0x00000820, INREG32(module_base + 0x00000820),
  800. 0x00000824, INREG32(module_base + 0x00000824),
  801. 0x00000828, INREG32(module_base + 0x00000828),
  802. 0x0000082C, INREG32(module_base + 0x0000082C));
  803. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  804. idx,
  805. 0x00000830, INREG32(module_base + 0x00000830),
  806. 0x00000834, INREG32(module_base + 0x00000834),
  807. 0x00000838, INREG32(module_base + 0x00000838),
  808. 0x0000083C, INREG32(module_base + 0x0000083C));
  809. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  810. idx,
  811. 0x00000840, INREG32(module_base + 0x00000840),
  812. 0x00000844, INREG32(module_base + 0x00000844),
  813. 0x00000848, INREG32(module_base + 0x00000848),
  814. 0x0000084C, INREG32(module_base + 0x0000084C));
  815. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  816. idx,
  817. 0x00000850, INREG32(module_base + 0x00000850),
  818. 0x00000854, INREG32(module_base + 0x00000854),
  819. 0x00000858, INREG32(module_base + 0x00000858),
  820. 0x0000085C, INREG32(module_base + 0x0000085C));
  821. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  822. idx,
  823. 0x00000860, INREG32(module_base + 0x00000860),
  824. 0x00000864, INREG32(module_base + 0x00000864),
  825. 0x00000868, INREG32(module_base + 0x00000868),
  826. 0x0000086C, INREG32(module_base + 0x0000086C));
  827. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  828. idx,
  829. 0x00000870, INREG32(module_base + 0x00000870),
  830. 0x00000874, INREG32(module_base + 0x00000874),
  831. 0x00000878, INREG32(module_base + 0x00000878),
  832. 0x0000087C, INREG32(module_base + 0x0000087C));
  833. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  834. idx,
  835. 0x00000880, INREG32(module_base + 0x00000880),
  836. 0x00000884, INREG32(module_base + 0x00000884),
  837. 0x00000888, INREG32(module_base + 0x00000888),
  838. 0x0000088C, INREG32(module_base + 0x0000088C));
  839. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  840. idx,
  841. 0x00000890, INREG32(module_base + 0x00000890),
  842. 0x00000894, INREG32(module_base + 0x00000894),
  843. 0x00000898, INREG32(module_base + 0x00000898),
  844. 0x0000089C, INREG32(module_base + 0x0000089C));
  845. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  846. idx,
  847. 0x000008A0, INREG32(module_base + 0x000008A0),
  848. 0x000008A4, INREG32(module_base + 0x000008A4),
  849. 0x000008A8, INREG32(module_base + 0x000008A8),
  850. 0x000008AC, INREG32(module_base + 0x000008AC));
  851. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  852. idx,
  853. 0x000008B0, INREG32(module_base + 0x000008B0),
  854. 0x000008B4, INREG32(module_base + 0x000008B4),
  855. 0x000008B8, INREG32(module_base + 0x000008B8),
  856. 0x000008BC, INREG32(module_base + 0x000008BC));
  857. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  858. idx,
  859. 0x000008C0, INREG32(module_base + 0x000008C0),
  860. 0x000008C4, INREG32(module_base + 0x000008C4),
  861. 0x000008C8, INREG32(module_base + 0x000008C8),
  862. 0x000008CC, INREG32(module_base + 0x000008CC));
  863. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  864. idx,
  865. 0x000008D0, INREG32(module_base + 0x000008D0),
  866. 0x000008D4, INREG32(module_base + 0x000008D4),
  867. 0x000008D8, INREG32(module_base + 0x000008D8),
  868. 0x000008DC, INREG32(module_base + 0x000008DC));
  869. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  870. idx,
  871. 0x000008E0, INREG32(module_base + 0x000008E0),
  872. 0x000008E4, INREG32(module_base + 0x000008E4),
  873. 0x000008E8, INREG32(module_base + 0x000008E8),
  874. 0x000008EC, INREG32(module_base + 0x000008EC));
  875. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  876. idx,
  877. 0x000008F0, INREG32(module_base + 0x000008F0),
  878. 0x000008F4, INREG32(module_base + 0x000008F4),
  879. 0x000008F8, INREG32(module_base + 0x000008F8),
  880. 0x000008FC, INREG32(module_base + 0x000008FC));
  881. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  882. idx,
  883. 0x00000900, INREG32(module_base + 0x00000900),
  884. 0x00000904, INREG32(module_base + 0x00000904),
  885. 0x00000908, INREG32(module_base + 0x00000908),
  886. 0x0000090C, INREG32(module_base + 0x0000090C));
  887. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  888. idx,
  889. 0x00000910, INREG32(module_base + 0x00000910),
  890. 0x00000914, INREG32(module_base + 0x00000914),
  891. 0x00000C00, INREG32(module_base + 0x00000C00),
  892. 0x00000C04, INREG32(module_base + 0x00000C04));
  893. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  894. idx,
  895. 0x00000C08, INREG32(module_base + 0x00000C08),
  896. 0x00000C0C, INREG32(module_base + 0x00000C0C),
  897. 0x00000C10, INREG32(module_base + 0x00000C10),
  898. 0x00000C14, INREG32(module_base + 0x00000C14));
  899. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  900. idx,
  901. 0x00000C18, INREG32(module_base + 0x00000C18),
  902. 0x00000C28, INREG32(module_base + 0x00000C28),
  903. 0x00000C50, INREG32(module_base + 0x00000C50),
  904. 0x00000C54, INREG32(module_base + 0x00000C54));
  905. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  906. idx,
  907. 0x00000C60, INREG32(module_base + 0x00000C60),
  908. 0x00000CA0, INREG32(module_base + 0x00000CA0),
  909. 0x00000CB0, INREG32(module_base + 0x00000CB0),
  910. 0x00000CF0, INREG32(module_base + 0x00000CF0));
  911. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  912. idx,
  913. 0x00000CF4, INREG32(module_base + 0x00000CF4),
  914. 0x00000CF8, INREG32(module_base + 0x00000CF8),
  915. 0x00000CFC, INREG32(module_base + 0x00000CFC),
  916. 0x00000D00, INREG32(module_base + 0x00000D00));
  917. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  918. idx,
  919. 0x00000D04, INREG32(module_base + 0x00000D04),
  920. 0x00000D08, INREG32(module_base + 0x00000D08),
  921. 0x00000D0C, INREG32(module_base + 0x00000D0C),
  922. 0x00000D10, INREG32(module_base + 0x00000D10));
  923. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  924. idx,
  925. 0x00000D14, INREG32(module_base + 0x00000D14),
  926. 0x00000D18, INREG32(module_base + 0x00000D18),
  927. 0x00000D1C, INREG32(module_base + 0x00000D1C),
  928. 0x00000D20, INREG32(module_base + 0x00000D20));
  929. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  930. idx,
  931. 0x00000D24, INREG32(module_base + 0x00000D24),
  932. 0x00000D28, INREG32(module_base + 0x00000D28),
  933. 0x00000D2C, INREG32(module_base + 0x00000D2C),
  934. 0x00000D30, INREG32(module_base + 0x00000D30));
  935. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  936. idx,
  937. 0x00000D34, INREG32(module_base + 0x00000D34),
  938. 0x00000D38, INREG32(module_base + 0x00000D38),
  939. 0x00000D3C, INREG32(module_base + 0x00000D3C),
  940. 0x00000D40, INREG32(module_base + 0x00000D40));
  941. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  942. idx,
  943. 0x00000D44, INREG32(module_base + 0x00000D44),
  944. 0x00000D48, INREG32(module_base + 0x00000D48),
  945. 0x00000D4C, INREG32(module_base + 0x00000D4C),
  946. 0x00000D50, INREG32(module_base + 0x00000D50));
  947. DDPDUMP("COLOR%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  948. idx,
  949. 0x00000D54, INREG32(module_base + 0x00000D54),
  950. 0x00000D58, INREG32(module_base + 0x00000D58),
  951. 0x00000D5C, INREG32(module_base + 0x00000D5C));
  952. DDPDUMP("-- END: DISP COLOR%d registers --\n", idx);
  953. return;
  954. }
  955. static void color_dump_analysis(DISP_MODULE_ENUM module)
  956. {
  957. int index = 0;
  958. if (DISP_MODULE_COLOR0 == module) {
  959. index = 0;
  960. } else {
  961. DDPDUMP("error: DISP COLOR%d dose not exist!\n", index);
  962. return;
  963. }
  964. DDPDUMP("== DISP COLOR%d ANALYSIS ==\n", index);
  965. DDPDUMP("color%d: bypass=%d, w=%d, h=%d, pixel_cnt=%d, line_cnt=%d,\n",
  966. index,
  967. (DISP_REG_GET(DISP_COLOR_CFG_MAIN) >> 7) & 0x1,
  968. DISP_REG_GET(DISP_COLOR_INTERNAL_IP_WIDTH),
  969. DISP_REG_GET(DISP_COLOR_INTERNAL_IP_HEIGHT),
  970. DISP_REG_GET(DISP_COLOR_PXL_CNT_MAIN) & 0xffff,
  971. (DISP_REG_GET(DISP_COLOR_LINE_CNT_MAIN) >> 16) & 0x1fff);
  972. return;
  973. }
  974. static void aal_dump_reg(void)
  975. {
  976. int i = 0;
  977. unsigned long module_base = DISPSYS_AAL_BASE;
  978. DDPDUMP("== START: DISP AAL%d registers ==\n", i);
  979. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  980. 0x00000000, INREG32(module_base + 0x00000000),
  981. 0x00000004, INREG32(module_base + 0x00000004),
  982. 0x00000008, INREG32(module_base + 0x00000008),
  983. 0x0000000C, INREG32(module_base + 0x0000000C));
  984. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  985. 0x00000010, INREG32(module_base + 0x00000010),
  986. 0x00000020, INREG32(module_base + 0x00000020),
  987. 0x00000024, INREG32(module_base + 0x00000024),
  988. 0x00000028, INREG32(module_base + 0x00000028));
  989. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  990. 0x0000002C, INREG32(module_base + 0x0000002C),
  991. 0x00000030, INREG32(module_base + 0x00000030),
  992. 0x000000B0, INREG32(module_base + 0x000000B0),
  993. 0x000000C0, INREG32(module_base + 0x000000C0));
  994. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  995. 0x000000FC, INREG32(module_base + 0x000000FC),
  996. 0x00000204, INREG32(module_base + 0x00000204),
  997. 0x0000020C, INREG32(module_base + 0x0000020C),
  998. 0x00000214, INREG32(module_base + 0x00000214));
  999. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1000. 0x0000021C, INREG32(module_base + 0x0000021C),
  1001. 0x00000224, INREG32(module_base + 0x00000224),
  1002. 0x00000228, INREG32(module_base + 0x00000228),
  1003. 0x0000022C, INREG32(module_base + 0x0000022C));
  1004. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1005. 0x00000230, INREG32(module_base + 0x00000230),
  1006. 0x00000234, INREG32(module_base + 0x00000234),
  1007. 0x00000238, INREG32(module_base + 0x00000238),
  1008. 0x0000023C, INREG32(module_base + 0x0000023C));
  1009. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1010. 0x00000240, INREG32(module_base + 0x00000240),
  1011. 0x00000244, INREG32(module_base + 0x00000244),
  1012. 0x00000248, INREG32(module_base + 0x00000248),
  1013. 0x0000024C, INREG32(module_base + 0x0000024C));
  1014. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1015. 0x00000250, INREG32(module_base + 0x00000250),
  1016. 0x00000254, INREG32(module_base + 0x00000254),
  1017. 0x00000258, INREG32(module_base + 0x00000258),
  1018. 0x0000025C, INREG32(module_base + 0x0000025C));
  1019. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1020. 0x00000260, INREG32(module_base + 0x00000260),
  1021. 0x00000264, INREG32(module_base + 0x00000264),
  1022. 0x00000268, INREG32(module_base + 0x00000268),
  1023. 0x0000026C, INREG32(module_base + 0x0000026C));
  1024. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1025. 0x00000270, INREG32(module_base + 0x00000270),
  1026. 0x00000274, INREG32(module_base + 0x00000274),
  1027. 0x00000278, INREG32(module_base + 0x00000278),
  1028. 0x0000027C, INREG32(module_base + 0x0000027C));
  1029. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1030. 0x00000280, INREG32(module_base + 0x00000280),
  1031. 0x00000284, INREG32(module_base + 0x00000284),
  1032. 0x00000288, INREG32(module_base + 0x00000288),
  1033. 0x0000028C, INREG32(module_base + 0x0000028C));
  1034. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1035. 0x00000290, INREG32(module_base + 0x00000290),
  1036. 0x00000294, INREG32(module_base + 0x00000294),
  1037. 0x00000298, INREG32(module_base + 0x00000298),
  1038. 0x0000029C, INREG32(module_base + 0x0000029C));
  1039. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1040. 0x000002A0, INREG32(module_base + 0x000002A0),
  1041. 0x000002A4, INREG32(module_base + 0x000002A4),
  1042. 0x00000358, INREG32(module_base + 0x00000358),
  1043. 0x0000035C, INREG32(module_base + 0x0000035C));
  1044. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1045. 0x00000360, INREG32(module_base + 0x00000360),
  1046. 0x00000364, INREG32(module_base + 0x00000364),
  1047. 0x00000368, INREG32(module_base + 0x00000368),
  1048. 0x0000036C, INREG32(module_base + 0x0000036C));
  1049. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1050. 0x00000370, INREG32(module_base + 0x00000370),
  1051. 0x00000374, INREG32(module_base + 0x00000374),
  1052. 0x00000378, INREG32(module_base + 0x00000378),
  1053. 0x0000037C, INREG32(module_base + 0x0000037C));
  1054. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1055. 0x00000380, INREG32(module_base + 0x00000380),
  1056. 0x000003B0, INREG32(module_base + 0x000003B0),
  1057. 0x0000040C, INREG32(module_base + 0x0000040C),
  1058. 0x00000410, INREG32(module_base + 0x00000410));
  1059. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1060. 0x00000414, INREG32(module_base + 0x00000414),
  1061. 0x00000418, INREG32(module_base + 0x00000418),
  1062. 0x0000041C, INREG32(module_base + 0x0000041C),
  1063. 0x00000420, INREG32(module_base + 0x00000420));
  1064. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1065. 0x00000424, INREG32(module_base + 0x00000424),
  1066. 0x00000428, INREG32(module_base + 0x00000428),
  1067. 0x0000042C, INREG32(module_base + 0x0000042C),
  1068. 0x00000430, INREG32(module_base + 0x00000430));
  1069. DDPDUMP("AAL: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1070. 0x00000434, INREG32(module_base + 0x00000434),
  1071. 0x00000440, INREG32(module_base + 0x00000440),
  1072. 0x00000444, INREG32(module_base + 0x00000444),
  1073. 0x00000448, INREG32(module_base + 0x00000448));
  1074. DDPDUMP("-- END: DISP AAL%d registers --\n", i);
  1075. return;
  1076. }
  1077. static void aal_dump_analysis(void)
  1078. {
  1079. DDPDUMP("== DISP AAL ANALYSIS ==\n");
  1080. DDPDUMP("aal: bypass=%d, relay=%d, en=%d, w=%d, h=%d, in(%d,%d),out(%d,%d)\n",
  1081. DISP_REG_GET(DISP_AAL_EN) == 0x0,
  1082. DISP_REG_GET(DISP_AAL_CFG) & 0x01,
  1083. DISP_REG_GET(DISP_AAL_EN),
  1084. (DISP_REG_GET(DISP_AAL_SIZE) >> 16) & 0x1fff,
  1085. DISP_REG_GET(DISP_AAL_SIZE) & 0x1fff,
  1086. DISP_REG_GET(DISP_AAL_IN_CNT) & 0x1fff,
  1087. (DISP_REG_GET(DISP_AAL_IN_CNT) >> 16) & 0x1fff,
  1088. DISP_REG_GET(DISP_AAL_OUT_CNT) & 0x1fff,
  1089. (DISP_REG_GET(DISP_AAL_OUT_CNT) >> 16) & 0x1fff);
  1090. }
  1091. static void pwm_dump_reg(DISP_MODULE_ENUM module)
  1092. {
  1093. unsigned long module_base = DISPSYS_PWM0_BASE;
  1094. DDPDUMP("== START: DISP PWM0 registers ==\n");
  1095. DDPDUMP("PWM0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1096. 0x0, INREG32(module_base + 0x0),
  1097. 0x4, INREG32(module_base + 0x4),
  1098. 0x8, INREG32(module_base + 0x8),
  1099. 0xC, INREG32(module_base + 0xC));
  1100. DDPDUMP("PWM0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1101. 0x10, INREG32(module_base + 0x10),
  1102. 0x14, INREG32(module_base + 0x14),
  1103. 0x18, INREG32(module_base + 0x18),
  1104. 0x1C, INREG32(module_base + 0x1C));
  1105. DDPDUMP("PWM0: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1106. 0x80, INREG32(module_base + 0x80),
  1107. 0x28, INREG32(module_base + 0x28),
  1108. 0x2C, INREG32(module_base + 0x2C),
  1109. 0x30, INREG32(module_base + 0x30));
  1110. DDPDUMP("PWM0: 0x%04x=0x%08x\n",
  1111. 0xC0, INREG32(module_base + 0xC0));
  1112. DDPDUMP("-- END: DISP PWM0 registers --\n");
  1113. }
  1114. static void pwm_dump_analysis(DISP_MODULE_ENUM module)
  1115. {
  1116. int index = 0;
  1117. unsigned int reg_base = 0;
  1118. if (module == DISP_MODULE_PWM0) {
  1119. index = 0;
  1120. reg_base = DISPSYS_PWM0_BASE;
  1121. } else {
  1122. index = 1;
  1123. reg_base = DISPSYS_PWM0_BASE;
  1124. }
  1125. DDPDUMP("== DISP PWM%d REG_BASE:0x%08x ANALYSIS ==\n", index, reg_base);
  1126. #if 0 /* TODO: clk reg?? */
  1127. DDPDUMP("pwm clock=%d\n", (DISP_REG_GET(DISP_REG_CLK_CFG_1_CLR) >> 7) & 0x1);
  1128. #endif
  1129. return;
  1130. }
  1131. static void ccorr_dump_reg(void)
  1132. {
  1133. int i = 0;
  1134. unsigned long module_base = DISPSYS_CCORR_BASE;
  1135. DDPDUMP("== START: DISP CCORR%i registers ==\n", i);
  1136. DDPDUMP("CCORR: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1137. 0x000, INREG32(module_base + 0x000),
  1138. 0x004, INREG32(module_base + 0x004),
  1139. 0x008, INREG32(module_base + 0x008),
  1140. 0x00C, INREG32(module_base + 0x00C));
  1141. DDPDUMP("CCORR: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1142. 0x010, INREG32(module_base + 0x010),
  1143. 0x020, INREG32(module_base + 0x020),
  1144. 0x024, INREG32(module_base + 0x024),
  1145. 0x028, INREG32(module_base + 0x028));
  1146. DDPDUMP("CCORR: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1147. 0x02C, INREG32(module_base + 0x02C),
  1148. 0x030, INREG32(module_base + 0x030),
  1149. 0x080, INREG32(module_base + 0x080),
  1150. 0x084, INREG32(module_base + 0x084));
  1151. DDPDUMP("CCORR: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1152. 0x088, INREG32(module_base + 0x088),
  1153. 0x08C, INREG32(module_base + 0x08C),
  1154. 0x090, INREG32(module_base + 0x090),
  1155. 0x0A0, INREG32(module_base + 0x0A0));
  1156. DDPDUMP("CCORR: 0x%04x=0x%08x\n",
  1157. 0x0C0, INREG32(module_base + 0x0C0));
  1158. DDPDUMP("-- END: DISP CCORR%d registers --\n", i);
  1159. }
  1160. static void ccorr_dump_analyze(void)
  1161. {
  1162. DDPDUMP("ccorr: en=%d, config=%d, w=%d, h=%d, in_p_cnt=%d, in_l_cnt=%d, out_p_cnt=%d, out_l_cnt=%d\n",
  1163. DISP_REG_GET(DISP_REG_CCORR_EN), DISP_REG_GET(DISP_REG_CCORR_CFG),
  1164. (DISP_REG_GET(DISP_REG_CCORR_SIZE) >> 16) & 0x1fff,
  1165. DISP_REG_GET(DISP_REG_CCORR_SIZE) & 0x1fff,
  1166. DISP_REG_GET(DISP_REG_CCORR_IN_CNT) & 0x1fff,
  1167. (DISP_REG_GET(DISP_REG_CCORR_IN_CNT) >> 16) & 0x1fff,
  1168. DISP_REG_GET(DISP_REG_CCORR_IN_CNT) & 0x1fff,
  1169. (DISP_REG_GET(DISP_REG_CCORR_IN_CNT) >> 16) & 0x1fff);
  1170. }
  1171. static void dither_dump_reg(void)
  1172. {
  1173. int i = 0;
  1174. unsigned long module_base = DISPSYS_DITHER_BASE;
  1175. DDPDUMP("== START: DISP DITHER%d registers ==\n", i);
  1176. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1177. 0x00000000, INREG32(module_base + 0x00000000),
  1178. 0x00000004, INREG32(module_base + 0x00000004),
  1179. 0x00000008, INREG32(module_base + 0x00000008),
  1180. 0x0000000C, INREG32(module_base + 0x0000000C));
  1181. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1182. 0x00000010, INREG32(module_base + 0x00000010),
  1183. 0x00000020, INREG32(module_base + 0x00000020),
  1184. 0x00000024, INREG32(module_base + 0x00000024),
  1185. 0x00000028, INREG32(module_base + 0x00000028));
  1186. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1187. 0x0000002C, INREG32(module_base + 0x0000002C),
  1188. 0x00000030, INREG32(module_base + 0x00000030),
  1189. 0x000000C0, INREG32(module_base + 0x000000C0),
  1190. 0x00000100, INREG32(module_base + 0x00000100));
  1191. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1192. 0x00000114, INREG32(module_base + 0x00000114),
  1193. 0x00000118, INREG32(module_base + 0x00000118),
  1194. 0x0000011C, INREG32(module_base + 0x0000011C),
  1195. 0x00000120, INREG32(module_base + 0x00000120));
  1196. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1197. 0x00000124, INREG32(module_base + 0x00000124),
  1198. 0x00000128, INREG32(module_base + 0x00000128),
  1199. 0x0000012C, INREG32(module_base + 0x0000012C),
  1200. 0x00000130, INREG32(module_base + 0x00000130));
  1201. DDPDUMP("DITHER: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1202. 0x00000134, INREG32(module_base + 0x00000134),
  1203. 0x00000138, INREG32(module_base + 0x00000138),
  1204. 0x0000013C, INREG32(module_base + 0x0000013C),
  1205. 0x00000140, INREG32(module_base + 0x00000140));
  1206. DDPDUMP("DITHER: 0x%04x=0x%08x\n",
  1207. 0x00000144, INREG32(module_base + 0x00000144));
  1208. DDPDUMP("-- END: DISP DITHER%d registers --\n", i);
  1209. }
  1210. static void dither_dump_analyze(void)
  1211. {
  1212. DDPDUMP("dither: en=%d, config=%d, w=%d, h=%d, in_p_cnt=%d, in_l_cnt=%d, out_p_cnt=%d, out_l_cnt=%d\n",
  1213. DISP_REG_GET(DISPSYS_DITHER_BASE + 0x000), DISP_REG_GET(DISPSYS_DITHER_BASE + 0x020),
  1214. (DISP_REG_GET(DISP_REG_DITHER_SIZE) >> 16) & 0x1fff,
  1215. DISP_REG_GET(DISP_REG_DITHER_SIZE) & 0x1fff,
  1216. DISP_REG_GET(DISP_REG_DITHER_IN_CNT) & 0x1fff,
  1217. (DISP_REG_GET(DISP_REG_DITHER_IN_CNT) >> 16) & 0x1fff,
  1218. DISP_REG_GET(DISP_REG_DITHER_OUT_CNT) & 0x1fff,
  1219. (DISP_REG_GET(DISP_REG_DITHER_OUT_CNT) >> 16) & 0x1fff);
  1220. }
  1221. static void dsi_dump_reg(DISP_MODULE_ENUM module)
  1222. {
  1223. DSI_DumpRegisters(module, 1);
  1224. #if 0
  1225. if (DISP_MODULE_DSI0) {
  1226. int i = 0;
  1227. DDPDUMP("== DISP DSI0 REGS ==\n");
  1228. for (i = 0; i < 25 * 16; i += 16) {
  1229. DDPDUMP("DSI0+%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n", i,
  1230. INREG32(DISPSYS_DSI0_BASE + i), INREG32(DISPSYS_DSI0_BASE + i + 0x4),
  1231. INREG32(DISPSYS_DSI0_BASE + i + 0x8),
  1232. INREG32(DISPSYS_DSI0_BASE + i + 0xc));
  1233. }
  1234. DDPDUMP("DSI0 CMDQ+0x200: 0x%08x 0x%08x 0x%08x 0x%08x\n",
  1235. INREG32(DISPSYS_DSI0_BASE + 0x200), INREG32(DISPSYS_DSI0_BASE + 0x200 + 0x4),
  1236. INREG32(DISPSYS_DSI0_BASE + 0x200 + 0x8),
  1237. INREG32(DISPSYS_DSI0_BASE + 0x200 + 0xc));
  1238. }
  1239. #endif
  1240. }
  1241. static void dpi_dump_reg(void)
  1242. {
  1243. }
  1244. static void dpi_dump_analysis(void)
  1245. {
  1246. #if 0
  1247. DDPDUMP("== DISP DPI ANALYSIS ==\n");
  1248. /* TODO: mmsys clk?? */
  1249. DDPDUMP("DPI clock=0x%x\n", DISP_REG_GET(DISP_REG_CLK_CFG_6_DPI));
  1250. DDPDUMP("DPI clock_clear=%d\n", (DISP_REG_GET(DISP_REG_CLK_CFG_6_CLR) >> 7) & 0x1);
  1251. DDPDUMP("(0x000)S_ENABLE=0x%x\n", DISP_REG_GET(DISP_REG_SPLIT_ENABLE));
  1252. DDPDUMP("(0x004)S_SW_RST=0x%x\n", DISP_REG_GET(DISP_REG_SPLIT_SW_RESET));
  1253. #endif
  1254. }
  1255. static int split_dump_regs(void)
  1256. {
  1257. unsigned long module_base = DISPSYS_SPLIT0_BASE;
  1258. unsigned int idx = 0;
  1259. DDPDUMP("== START: DISP SPLIT registers ==\n");
  1260. DDPDUMP("SPLIT%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1261. idx,
  1262. 0x000, INREG32(module_base + 0x000),
  1263. 0x004, INREG32(module_base + 0x004),
  1264. 0x008, INREG32(module_base + 0x008),
  1265. 0x00C, INREG32(module_base + 0x00C));
  1266. DDPDUMP("SPLIT%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1267. idx,
  1268. 0x010, INREG32(module_base + 0x010),
  1269. 0x020, INREG32(module_base + 0x020),
  1270. 0x024, INREG32(module_base + 0x024),
  1271. 0x028, INREG32(module_base + 0x028));
  1272. DDPDUMP("SPLIT%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1273. idx,
  1274. 0x02C, INREG32(module_base + 0x02C),
  1275. 0x030, INREG32(module_base + 0x030),
  1276. 0x034, INREG32(module_base + 0x034),
  1277. 0x038, INREG32(module_base + 0x038));
  1278. DDPDUMP("SPLIT%d: 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x, 0x%04x=0x%08x\n",
  1279. idx,
  1280. 0x03C, INREG32(module_base + 0x03C),
  1281. 0x040, INREG32(module_base + 0x040),
  1282. 0x044, INREG32(module_base + 0x044),
  1283. 0x48, INREG32(module_base + 0x48));
  1284. DDPDUMP("SPLIT%d: 0x%04x=0x%08x\n",
  1285. idx,
  1286. 0x080, INREG32(module_base + 0x080));
  1287. DDPDUMP("-- END: DISP SPLIT registers --\n");
  1288. return 0;
  1289. }
  1290. static int split_dump_analysis(void)
  1291. {
  1292. #if 0
  1293. unsigned int pixel = DISP_REG_GET_FIELD(DEBUG_FLD_IN_PIXEL_CNT, DISP_REG_SPLIT_DEBUG);
  1294. unsigned int state = DISP_REG_GET_FIELD(DEBUG_FLD_SPLIT_FSM, DISP_REG_SPLIT_DEBUG);
  1295. DDPDUMP("== DISP SPLIT0 ANALYSIS ==\n");
  1296. DDPDUMP("cur_pixel %u, state %s\n", pixel, split_state(state));
  1297. return 0;
  1298. #else
  1299. return 0;
  1300. #endif
  1301. }
  1302. int ddp_dump_reg(DISP_MODULE_ENUM module)
  1303. {
  1304. switch (module) {
  1305. case DISP_MODULE_WDMA0:
  1306. //wdma_dump_reg(module);
  1307. break;
  1308. case DISP_MODULE_RDMA0:
  1309. case DISP_MODULE_RDMA1:
  1310. RDMADump(module);
  1311. break;
  1312. case DISP_MODULE_OVL0:
  1313. case DISP_MODULE_OVL0_2L:
  1314. case DISP_MODULE_OVL1_2L:
  1315. OVLDump(module);
  1316. break;
  1317. case DISP_MODULE_GAMMA0:
  1318. gamma_dump_reg();
  1319. break;
  1320. case DISP_MODULE_CONFIG:
  1321. mmsys_config_dump_reg();
  1322. break;
  1323. case DISP_MODULE_MUTEX:
  1324. mutex_dump_reg();
  1325. break;
  1326. case DISP_MODULE_SPLIT0:
  1327. split_dump_regs();
  1328. break;
  1329. case DISP_MODULE_COLOR0:
  1330. color_dump_reg(module);
  1331. break;
  1332. case DISP_MODULE_AAL0:
  1333. aal_dump_reg();
  1334. break;
  1335. case DISP_MODULE_PWM0:
  1336. pwm_dump_reg(module);
  1337. break;
  1338. case DISP_MODULE_DSI0:
  1339. case DISP_MODULE_DSI1:
  1340. case DISP_MODULE_DSIDUAL:
  1341. dsi_dump_reg(module);
  1342. break;
  1343. case DISP_MODULE_CCORR0:
  1344. ccorr_dump_reg();
  1345. break;
  1346. case DISP_MODULE_DITHER0:
  1347. dither_dump_reg();
  1348. break;
  1349. default:
  1350. DDPDUMP("no dump_reg for module %s(%d)\n", ddp_get_module_name(module), module);
  1351. }
  1352. return 0;
  1353. }
  1354. int ddp_dump_analysis(DISP_MODULE_ENUM module)
  1355. {
  1356. switch (module) {
  1357. case DISP_MODULE_WDMA0:
  1358. //wdma_dump_analysis(module);
  1359. break;
  1360. case DISP_MODULE_RDMA0:
  1361. case DISP_MODULE_RDMA1:
  1362. rdma_dump_analysis(module);
  1363. break;
  1364. case DISP_MODULE_OVL0:
  1365. case DISP_MODULE_OVL0_2L:
  1366. case DISP_MODULE_OVL1_2L:
  1367. ovl_dump_analysis(module);
  1368. break;
  1369. case DISP_MODULE_GAMMA0:
  1370. gamma_dump_analysis();
  1371. break;
  1372. case DISP_MODULE_CONFIG:
  1373. mmsys_config_dump_analysis();
  1374. break;
  1375. case DISP_MODULE_MUTEX:
  1376. mutex_dump_analysis();
  1377. break;
  1378. case DISP_MODULE_SPLIT0:
  1379. split_dump_analysis();
  1380. break;
  1381. case DISP_MODULE_COLOR0:
  1382. color_dump_analysis(module);
  1383. break;
  1384. case DISP_MODULE_AAL0:
  1385. aal_dump_analysis();
  1386. break;
  1387. case DISP_MODULE_PWM0:
  1388. pwm_dump_analysis(module);
  1389. break;
  1390. case DISP_MODULE_DSI0:
  1391. case DISP_MODULE_DSI1:
  1392. case DISP_MODULE_DSIDUAL:
  1393. dsi_analysis(module);
  1394. break;
  1395. case DISP_MODULE_CCORR0:
  1396. ccorr_dump_analyze();
  1397. break;
  1398. case DISP_MODULE_DITHER0:
  1399. dither_dump_analyze();
  1400. break;
  1401. default:
  1402. DDPDUMP("no dump_analysis for module %s(%d)\n", ddp_get_module_name(module),
  1403. module);
  1404. }
  1405. return 0;
  1406. }