ddp_path.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. #define LOG_TAG "ddp_path"
  2. #include "ddp_log.h"
  3. #include <linux/types.h>
  4. #ifdef CONFIG_MTK_CLKMGR
  5. #include <mach/mt_clkmgr.h>
  6. #endif
  7. #define DISP_LIST_SCENARIO
  8. #include "ddp_reg.h"
  9. #include "disp_drv_platform.h"
  10. #include "ddp_debug.h"
  11. #include "ddp_path.h"
  12. #include "primary_display.h"
  13. #include "ddp_hal.h"
  14. #include "m4u.h"
  15. #include "ddp_drv.h"
  16. #pragma GCC optimize("O0")
  17. /* 1st para is mout's input, 2nd para is mout's output*/
  18. mout_t mout_map[DDP_MOUT_NUM] = {
  19. /* OVL_MOUT */
  20. {DISP_MODULE_OVL0,
  21. {{DISP_MODULE_COLOR0, 1 << 0}, {DISP_MODULE_WDMA0, 1 << 1}, {-1, 0} }, 0, 0},
  22. {DISP_MODULE_OVL1,
  23. {{DISP_MODULE_RDMA1, 1 << 0}, {DISP_MODULE_WDMA1, 1 << 1}, {DISP_MODULE_OVL0, 1 << 2},
  24. {-1, 0} }, 0, 0},
  25. /* DITHER0_MOUT */
  26. {DISP_MODULE_DITHER,
  27. {{DISP_MODULE_RDMA0, 1 << 0}, {DISP_MODULE_UFOE, 1 << 1}, {DISP_MODULE_WDMA0, 1 << 2},
  28. {-1, 0} }, 0, 0},
  29. /* UFOE_MOUT */
  30. {DISP_MODULE_UFOE,
  31. {{DISP_MODULE_DSI0, 1 << 0}, {DISP_MODULE_DPI, 1 << 1}, {DISP_MODULE_WDMA0, 1 << 2},
  32. {-1, 0} }, 0, 0},
  33. };
  34. sel_t sel_out_map[DDP_SEL_OUT_NUM] = {
  35. /* RDMA_SOUT */
  36. {DISP_MODULE_RDMA0,
  37. {DISP_MODULE_UFOE, DISP_MODULE_COLOR0, DISP_MODULE_DSI0, DISP_MODULE_DPI, -1}, 0, 0},
  38. {DISP_MODULE_RDMA1,
  39. {DISP_MODULE_DSI0, DISP_MODULE_DPI, -1}, 0, 0},
  40. };
  41. /* 1st para is sout's output, 2nd para is sout's input*/
  42. sel_t sel_in_map[DDP_SEL_IN_NUM] = {
  43. /* COLOR_SEL */
  44. {DISP_MODULE_COLOR0,
  45. {DISP_MODULE_RDMA0, DISP_MODULE_OVL0, -1}, 0, 0},
  46. /*UFOE_SEL */
  47. {DISP_MODULE_UFOE,
  48. {DISP_MODULE_RDMA0, DISP_MODULE_DITHER, -1}, 0, 0},
  49. /*DSI0_SEL */
  50. {DISP_MODULE_DSI0,
  51. {DISP_MODULE_UFOE, DISP_MODULE_RDMA0, DISP_MODULE_RDMA1, -1}, 0, 0},
  52. /*DPI0_SEL */
  53. {DISP_MODULE_DPI,
  54. {DISP_MODULE_UFOE, DISP_MODULE_RDMA0, DISP_MODULE_RDMA1, -1}, 0, 0},
  55. /* WDMA_SEL */
  56. {DISP_MODULE_WDMA0,
  57. {DISP_MODULE_OVL0, DISP_MODULE_DITHER, DISP_MODULE_UFOE, -1}, 0, 0},
  58. };
  59. int ddp_path_init(void)
  60. {
  61. /* mout */
  62. mout_map[0].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_OVL0_MOUT_EN;
  63. #if defined(MTK_FB_OVL1_SUPPORT)
  64. mout_map[1].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_OVL1_MOUT_EN;
  65. #endif
  66. mout_map[2].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_DITHER_MOUT_EN;
  67. mout_map[3].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_UFOE_MOUT_EN;
  68. /* sel_out */
  69. sel_out_map[0].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN;
  70. sel_out_map[1].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_RDMA1_SOUT_SEL_IN;
  71. /* sel_in */
  72. sel_in_map[0].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_COLOR0_SEL_IN; /* COLOR_SEL */
  73. sel_in_map[1].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_UFOE_SEL_IN; /* UFOE_SEL */
  74. sel_in_map[2].reg = (volatile unsigned long *)DISP_REG_CONFIG_DSI0_SEL_IN; /* DSI0_SEL */
  75. sel_in_map[3].reg = (volatile unsigned long *)DISP_REG_CONFIG_DPI0_SEL_IN; /* DPI0_SEL */
  76. sel_in_map[4].reg = (volatile unsigned long *)DISP_REG_CONFIG_DISP_WDMA0_SEL_IN; /* WDMA_SEL */
  77. return 0;
  78. }
  79. char *ddp_get_scenario_name(DDP_SCENARIO_ENUM scenario)
  80. {
  81. switch (scenario) {
  82. case DDP_SCENARIO_PRIMARY_DISP:
  83. return "primary_disp";
  84. case DDP_SCENARIO_PRIMARY_RDMA0_COLOR0_DISP:
  85. return "primary_rdma0_color0_disp";
  86. case DDP_SCENARIO_PRIMARY_RDMA0_DISP:
  87. return "primary_rdma0_disp";
  88. case DDP_SCENARIO_PRIMARY_BYPASS_RDMA:
  89. return "primary_bypass_rdma";
  90. case DDP_SCENARIO_PRIMARY_OVL_MEMOUT:
  91. return "primary_ovl_memout";
  92. case DDP_SCENARIO_PRIMARY_DITHER_MEMOUT:
  93. return "primary_dither_memout";
  94. case DDP_SCENARIO_PRIMARY_UFOE_MEMOUT:
  95. return "primary_ufoe_memout";
  96. case DDP_SCENARIO_SUB_DISP:
  97. return "sub_disp";
  98. case DDP_SCENARIO_SUB_RDMA1_DISP:
  99. return "sub_rdma1_disp";
  100. case DDP_SCENARIO_SUB_OVL_MEMOUT:
  101. return "sub_ovl_memout";
  102. case DDP_SCENARIO_PRIMARY_ALL:
  103. return "primary_all";
  104. case DDP_SCENARIO_SUB_ALL:
  105. return "sub_all";
  106. case DDP_SCENARIO_MULTIPLE_OVL:
  107. return "multi_ovl";
  108. default:
  109. DDPMSG("invalid scenario id=%d\n", scenario);
  110. return "unknown";
  111. }
  112. }
  113. int ddp_is_scenario_on_primary(DDP_SCENARIO_ENUM scenario)
  114. {
  115. int on_primary = 0;
  116. switch (scenario) {
  117. case DDP_SCENARIO_PRIMARY_DISP:
  118. case DDP_SCENARIO_PRIMARY_RDMA0_COLOR0_DISP:
  119. case DDP_SCENARIO_PRIMARY_RDMA0_DISP:
  120. case DDP_SCENARIO_PRIMARY_BYPASS_RDMA:
  121. case DDP_SCENARIO_PRIMARY_OVL_MEMOUT:
  122. case DDP_SCENARIO_PRIMARY_DITHER_MEMOUT:
  123. case DDP_SCENARIO_PRIMARY_UFOE_MEMOUT:
  124. case DDP_SCENARIO_PRIMARY_ALL:
  125. case DDP_SCENARIO_MULTIPLE_OVL:
  126. on_primary = 1;
  127. break;
  128. case DDP_SCENARIO_SUB_DISP:
  129. case DDP_SCENARIO_SUB_RDMA1_DISP:
  130. case DDP_SCENARIO_SUB_OVL_MEMOUT:
  131. case DDP_SCENARIO_SUB_ALL:
  132. on_primary = 0;
  133. break;
  134. default:
  135. DDPMSG("invalid scenario id=%d\n", scenario);
  136. }
  137. return on_primary;
  138. }
  139. char *ddp_get_mutex_sof_name(MUTEX_SOF mode)
  140. {
  141. switch (mode) {
  142. case SOF_SINGLE:
  143. return "single";
  144. case SOF_DSI0:
  145. return "dsi0";
  146. case SOF_DSI1:
  147. return "dsi1";
  148. case SOF_DPI0:
  149. return "dpi0";
  150. default:
  151. DDPMSG("invalid sof =%d\n", mode);
  152. return "unknown";
  153. }
  154. }
  155. char *ddp_get_mode_name(DDP_MODE ddp_mode)
  156. {
  157. switch (ddp_mode) {
  158. case DDP_VIDEO_MODE:
  159. return "vido_mode";
  160. case DDP_CMD_MODE:
  161. return "cmd_mode";
  162. default:
  163. DDPMSG("invalid ddp mode =%d\n", ddp_mode);
  164. return "unknown";
  165. }
  166. }
  167. static int ddp_get_module_num_l(int *module_list)
  168. {
  169. unsigned int num = 0;
  170. while (*(module_list + num) != -1) {
  171. num++;
  172. if (num == DDP_ENING_NUM)
  173. break;
  174. }
  175. return num;
  176. }
  177. /* config mout/msel to creat a compelte path */
  178. static void ddp_connect_path_l(int *module_list, void *handle)
  179. {
  180. unsigned int i, j, k;
  181. int step = 0;
  182. unsigned int mout = 0;
  183. unsigned int reg_mout = 0;
  184. unsigned int mout_idx = 0;
  185. unsigned int module_num = ddp_get_module_num_l(module_list);
  186. DDPDBG("connect_path: %s to %s\n", ddp_get_module_name(module_list[0]),
  187. ddp_get_module_name(module_list[module_num - 1]));
  188. /* connect mout */
  189. for (i = 0; i < module_num - 1; i++) {
  190. for (j = 0; j < DDP_MOUT_NUM; j++) {
  191. if (module_list[i] == mout_map[j].id) {
  192. /* find next module which can be connected */
  193. step = i + 1;
  194. while (module_can_connect[module_list[step]].bit == 0
  195. && step < module_num) {
  196. step++;
  197. }
  198. ASSERT(step < module_num);
  199. mout = mout_map[j].reg_val;
  200. for (k = 0; k < 5; k++) {
  201. if (mout_map[j].out_id_bit_map[k].m == -1)
  202. break;
  203. if (mout_map[j].out_id_bit_map[k].m == module_list[step]) {
  204. mout |= mout_map[j].out_id_bit_map[k].v;
  205. reg_mout |= mout;
  206. mout_idx = j;
  207. DDPDBG("connect mout %s to %s value 0x%x\n",
  208. ddp_get_module_name(module_list[i]),
  209. ddp_get_module_name(module_list[step]),
  210. reg_mout);
  211. break;
  212. }
  213. }
  214. mout_map[j].reg_val = mout;
  215. mout = 0;
  216. }
  217. }
  218. if (reg_mout) {
  219. DISP_REG_SET(handle, mout_map[mout_idx].reg, reg_mout);
  220. reg_mout = 0;
  221. mout_idx = 0;
  222. }
  223. }
  224. /* connect out select */
  225. for (i = 0; i < module_num - 1; i++) {
  226. for (j = 0; j < DDP_SEL_OUT_NUM; j++) {
  227. if (module_list[i] == sel_out_map[j].id) {
  228. step = i + 1;
  229. /* find next module which can be connected */
  230. while (module_can_connect[module_list[step]].bit == 0
  231. && step < module_num) {
  232. step++;
  233. }
  234. ASSERT(step < module_num);
  235. for (k = 0; k < 4; k++) {
  236. if (sel_out_map[j].id_bit_map[k] == -1)
  237. break;
  238. if (sel_out_map[j].id_bit_map[k] == module_list[step]) {
  239. DDPDBG("connect out_s %s to %s, bits=0x%x\n",
  240. ddp_get_module_name(module_list[i]),
  241. ddp_get_module_name(module_list[step]), k);
  242. DISP_REG_SET(handle, sel_out_map[j].reg, (uint16_t)k);
  243. break;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. /* connect input select */
  250. for (i = 1; i < module_num; i++) {
  251. for (j = 0; j < DDP_SEL_IN_NUM; j++) {
  252. if (module_list[i] == sel_in_map[j].id) {
  253. step = i - 1;
  254. /* find next module which can be connected */
  255. while (module_can_connect[module_list[step]].bit == 0 && step > 0)
  256. step--;
  257. ASSERT(step >= 0);
  258. for (k = 0; k < 4; k++) {
  259. if (sel_in_map[j].id_bit_map[k] == -1)
  260. break;
  261. if (sel_in_map[j].id_bit_map[k] == module_list[step]) {
  262. DDPDBG("connect in_s %s to %s, bits=0x%x\n",
  263. ddp_get_module_name(module_list[step]),
  264. ddp_get_module_name(module_list[i]), k);
  265. DISP_REG_SET(handle, sel_in_map[j].reg, (uint16_t)k);
  266. break;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. static void ddp_check_path_l(int *module_list)
  274. {
  275. unsigned int i, j, k;
  276. int step = 0;
  277. int valid = 0;
  278. unsigned int mout;
  279. unsigned int path_error = 0;
  280. unsigned int module_num = ddp_get_module_num_l(module_list);
  281. DDPDUMP("check_path: %s to %s\n", ddp_get_module_name(module_list[0])
  282. , ddp_get_module_name(module_list[module_num - 1]));
  283. /* check mout */
  284. for (i = 0; i < module_num - 1; i++) {
  285. for (j = 0; j < DDP_MOUT_NUM; j++) {
  286. if (module_list[i] == mout_map[j].id) {
  287. mout = 0;
  288. /* find next module which can be connected */
  289. step = i + 1;
  290. while (module_can_connect[module_list[step]].bit == 0
  291. && step < module_num) {
  292. step++;
  293. }
  294. ASSERT(step < module_num);
  295. for (k = 0; k < 5; k++) {
  296. if (mout_map[j].out_id_bit_map[k].m == -1)
  297. break;
  298. if (mout_map[j].out_id_bit_map[k].m == module_list[step]) {
  299. mout |= mout_map[j].out_id_bit_map[k].v;
  300. valid = 1;
  301. break;
  302. }
  303. }
  304. if (valid) {
  305. valid = 0;
  306. if ((DISP_REG_GET(mout_map[j].reg) & mout) == 0) {
  307. path_error += 1;
  308. DDPDUMP("error:%s mout, expect=0x%x, real=0x%x\n",
  309. ddp_get_module_name(module_list[i]),
  310. mout, DISP_REG_GET(mout_map[j].reg));
  311. } else if (DISP_REG_GET(mout_map[j].reg) != mout) {
  312. DDPDUMP
  313. ("warning: %s mout expect=0x%x, real=0x%x\n",
  314. ddp_get_module_name(module_list[i]), mout,
  315. DISP_REG_GET(mout_map[j].reg));
  316. }
  317. }
  318. break;
  319. }
  320. }
  321. }
  322. /* check out select */
  323. for (i = 0; i < module_num - 1; i++) {
  324. for (j = 0; j < DDP_SEL_OUT_NUM; j++) {
  325. if (module_list[i] != sel_out_map[j].id)
  326. continue;
  327. /* find next module which can be connected */
  328. step = i + 1;
  329. while (module_can_connect[module_list[step]].bit == 0
  330. && step < module_num) {
  331. step++;
  332. }
  333. ASSERT(step < module_num);
  334. for (k = 0; k < 4; k++) {
  335. if (sel_out_map[j].id_bit_map[k] == -1)
  336. break;
  337. if (sel_out_map[j].id_bit_map[k] == module_list[step]) {
  338. if (DISP_REG_GET(sel_out_map[j].reg) != k) {
  339. path_error += 1;
  340. DDPDUMP
  341. ("error:out_s %s not connect to %s,expect=0x%x,real=0x%x\n",
  342. ddp_get_module_name(module_list[i]),
  343. ddp_get_module_name(module_list[step]),
  344. k, DISP_REG_GET(sel_out_map[j].reg));
  345. }
  346. break;
  347. }
  348. }
  349. }
  350. }
  351. /* check input select */
  352. for (i = 1; i < module_num; i++) {
  353. for (j = 0; j < DDP_SEL_IN_NUM; j++) {
  354. if (module_list[i] != sel_in_map[j].id)
  355. continue;
  356. /* find next module which can be connected */
  357. step = i - 1;
  358. while (module_can_connect[module_list[step]].bit == 0 && step > 0)
  359. step--;
  360. ASSERT(step >= 0);
  361. for (k = 0; k < 4; k++) {
  362. if (sel_in_map[j].id_bit_map[k] == -1)
  363. break;
  364. if (sel_in_map[j].id_bit_map[k] == module_list[step]) {
  365. if (DISP_REG_GET(sel_in_map[j].reg) != k) {
  366. path_error += 1;
  367. DDPDUMP
  368. ("error:in_s%s not connect to %s,expect=0x%x,real=0x%x\n",
  369. ddp_get_module_name(module_list[step]),
  370. ddp_get_module_name(module_list[i]), k,
  371. DISP_REG_GET(sel_in_map[j].reg));
  372. }
  373. break;
  374. }
  375. }
  376. }
  377. }
  378. if (path_error == 0) {
  379. DDPDUMP("path: %s to %s is connected\n", ddp_get_module_name(module_list[0]),
  380. ddp_get_module_name(module_list[module_num - 1]));
  381. } else {
  382. DDPDUMP("path: %s to %s not connected!!!\n", ddp_get_module_name(module_list[0]),
  383. ddp_get_module_name(module_list[module_num - 1]));
  384. }
  385. }
  386. static void ddp_disconnect_path_l(int *module_list, void *handle)
  387. {
  388. unsigned int i, j, k;
  389. int step = 0;
  390. unsigned int mout = 0;
  391. unsigned int reg_mout = 0;
  392. unsigned int mout_idx = 0;
  393. unsigned int module_num = ddp_get_module_num_l(module_list);
  394. DDPDBG("disconnect_path: %s to %s\n", ddp_get_module_name(module_list[0]),
  395. ddp_get_module_name(module_list[module_num - 1]));
  396. for (i = 0; i < module_num - 1; i++) {
  397. for (j = 0; j < DDP_MOUT_NUM; j++) {
  398. if (module_list[i] == mout_map[j].id) {
  399. /* find next module which can be connected */
  400. step = i + 1;
  401. while (module_can_connect[module_list[step]].bit == 0
  402. && step < module_num) {
  403. step++;
  404. }
  405. ASSERT(step < module_num);
  406. for (k = 0; k < 5; k++) {
  407. if (mout_map[j].out_id_bit_map[k].m == -1)
  408. break;
  409. if (mout_map[j].out_id_bit_map[k].m == module_list[step]) {
  410. mout |= mout_map[j].out_id_bit_map[k].v;
  411. reg_mout |= mout;
  412. mout_idx = j;
  413. DDPDBG("disconnect mout %s to %s\n",
  414. ddp_get_module_name(module_list[i]),
  415. ddp_get_module_name(module_list[step]));
  416. break;
  417. }
  418. }
  419. /* update mout_value */
  420. mout_map[j].reg_val &= ~mout;
  421. mout = 0;
  422. }
  423. }
  424. if (reg_mout) {
  425. DISP_REG_SET(handle, mout_map[mout_idx].reg, mout_map[mout_idx].reg_val);
  426. reg_mout = 0;
  427. mout_idx = 0;
  428. }
  429. }
  430. }
  431. static MUTEX_SOF ddp_get_mutex_sof(DISP_MODULE_ENUM dest_module, DDP_MODE ddp_mode)
  432. {
  433. MUTEX_SOF mode = SOF_SINGLE;
  434. switch (dest_module) {
  435. case DISP_MODULE_DSI0:
  436. {
  437. mode = (ddp_mode == DDP_VIDEO_MODE ? SOF_DSI0 : SOF_SINGLE);
  438. break;
  439. }
  440. case DISP_MODULE_DSI1:
  441. {
  442. mode = (ddp_mode == DDP_VIDEO_MODE ? SOF_DSI1 : SOF_SINGLE);
  443. break;
  444. }
  445. case DISP_MODULE_DSIDUAL:
  446. {
  447. mode = (ddp_mode == DDP_VIDEO_MODE ? SOF_DSI0 : SOF_SINGLE);
  448. break;
  449. }
  450. case DISP_MODULE_DPI:
  451. {
  452. mode = SOF_DSI1; /* SOF_DPI0; has one DSI, so the DPI should use 1 for mutex_sof */
  453. break;
  454. }
  455. case DISP_MODULE_WDMA0:
  456. case DISP_MODULE_WDMA1:
  457. mode = SOF_SINGLE;
  458. break;
  459. default:
  460. DDPERR("get mutex sof, invalid param dst module = %s(%d), dis mode %s\n",
  461. ddp_get_module_name(dest_module), dest_module, ddp_get_mode_name(ddp_mode));
  462. }
  463. DDPDBG("mutex sof: %s dst module %s:%s\n",
  464. ddp_get_mutex_sof_name(mode), ddp_get_module_name(dest_module),
  465. ddp_get_mode_name(ddp_mode));
  466. return mode;
  467. }
  468. /* id: mutex ID, 0~5 */
  469. static int ddp_mutex_set_l(int mutex_id, int *module_list, DDP_MODE ddp_mode, void *handle)
  470. {
  471. int i = 0;
  472. uint32_t value = 0;
  473. int module_num = ddp_get_module_num_l(module_list);
  474. MUTEX_SOF mode = ddp_get_mutex_sof(module_list[module_num - 1], ddp_mode);
  475. if (mutex_id < DISP_MUTEX_DDP_FIRST || mutex_id > DISP_MUTEX_DDP_LAST) {
  476. DDPERR("exceed mutex max (0 ~ %d)\n", DISP_MUTEX_DDP_LAST);
  477. return -1;
  478. }
  479. for (i = 0; i < module_num; i++) {
  480. if (module_mutex_map[module_list[i]].bit != -1) {
  481. DDPDBG("module %s added to mutex %d\n", ddp_get_module_name(module_list[i]),
  482. mutex_id);
  483. value |= (1 << module_mutex_map[module_list[i]].bit);
  484. } else {
  485. DDPDBG("module %s not added to mutex %d\n",
  486. ddp_get_module_name(module_list[i]), mutex_id);
  487. }
  488. }
  489. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_MOD(mutex_id), value);
  490. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_SOF(mutex_id), mode);
  491. /* for primary config thread, save more time for register config */
  492. if (gEnableMutexRisingEdge == 1 && primary_display_is_video_mode() == 1 && mutex_id == 0) {
  493. DISP_REG_SET_FIELD(handle, SOF_FLD_MUTEX0_SOF_TIMING, DISP_REG_CONFIG_MUTEX0_SOF,
  494. 1);
  495. }
  496. if (gEnableSWTrigger == 1 && primary_display_is_video_mode() == 1 && mutex_id == 0) {
  497. /* set OVL0/OVL1 to separate mutex */
  498. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_MOD(DISP_OVL_SEPARATE_MUTEX_ID),
  499. value & ((1 << module_mutex_map[DISP_MODULE_OVL0].bit) |
  500. (1 << module_mutex_map[DISP_MODULE_OVL1].bit)));
  501. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_SOF(DISP_OVL_SEPARATE_MUTEX_ID),
  502. SOF_SINGLE);
  503. /* move OVL0/OVL1 out from primary path */
  504. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_MOD(mutex_id),
  505. value &
  506. (~
  507. ((1 << module_mutex_map[DISP_MODULE_OVL0].
  508. bit) | (1 << module_mutex_map[DISP_MODULE_OVL1].bit))));
  509. }
  510. DDPDBG("mutex %d value=0x%x, sof=%s\n", mutex_id, value, ddp_get_mutex_sof_name(mode));
  511. return 0;
  512. }
  513. static void ddp_check_mutex_l(int mutex_id, int *module_list, DDP_MODE ddp_mode)
  514. {
  515. int i = 0;
  516. uint32_t real_value = 0;
  517. uint32_t expect_value = 0;
  518. uint32_t real_sof = 0;
  519. MUTEX_SOF expect_sof = SOF_SINGLE;
  520. int module_num = ddp_get_module_num_l(module_list);
  521. if (mutex_id < DISP_MUTEX_DDP_FIRST || mutex_id > DISP_MUTEX_DDP_LAST) {
  522. DDPDUMP("error:check mutex fail:exceed mutex max (0 ~ %d)\n", DISP_MUTEX_DDP_LAST);
  523. return;
  524. }
  525. real_value = DISP_REG_GET(DISP_REG_CONFIG_MUTEX_MOD(mutex_id));
  526. for (i = 0; i < module_num; i++) {
  527. if (module_mutex_map[module_list[i]].bit != -1)
  528. expect_value |= (1 << module_mutex_map[module_list[i]].bit);
  529. }
  530. if (expect_value != real_value) {
  531. DDPDUMP("error:mutex %d error: expect 0x%x, real 0x%x\n", mutex_id, expect_value,
  532. real_value);
  533. }
  534. real_sof = DISP_REG_GET(DISP_REG_CONFIG_MUTEX_SOF(mutex_id));
  535. expect_sof = ddp_get_mutex_sof(module_list[module_num - 1], ddp_mode);
  536. if ((uint32_t) expect_sof != real_sof) {
  537. DDPDUMP("error:mutex %d sof error: expect %s, real %s\n", mutex_id,
  538. ddp_get_mutex_sof_name(expect_sof),
  539. ddp_get_mutex_sof_name((MUTEX_SOF) real_sof));
  540. }
  541. }
  542. static int ddp_mutex_enable_l(int mutex_idx, void *handle)
  543. {
  544. DDPDBG("mutex %d enable\n", mutex_idx);
  545. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_EN(mutex_idx), 1);
  546. return 0;
  547. }
  548. int ddp_mutex_hw_dcm_on(int mutex_idx, void *handle)
  549. {
  550. if (gMutexFreeRun == 1 && primary_display_is_video_mode() == 0 && mutex_idx == 0)
  551. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_HW_DCM, 1);
  552. DDPDBG("mutex %d hw_dcm 0x%x\n", mutex_idx, DISP_REG_GET(DISP_REG_CONFIG_MUTEX_HW_DCM));
  553. return 0;
  554. }
  555. int ddp_mutex_hw_dcm_off(int mutex_idx, void *handle)
  556. {
  557. if (gMutexFreeRun == 1 && primary_display_is_video_mode() == 0 && mutex_idx == 0)
  558. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_HW_DCM, 0);
  559. DDPDBG("mutex %d hw_dcm 0x%x\n", mutex_idx, DISP_REG_GET(DISP_REG_CONFIG_MUTEX_HW_DCM));
  560. return 0;
  561. }
  562. int ddp_get_module_num(DDP_SCENARIO_ENUM scenario)
  563. {
  564. return ddp_get_module_num_l(module_list_scenario[scenario]);
  565. }
  566. static void ddp_print_scenario(DDP_SCENARIO_ENUM scenario)
  567. {
  568. int i = 0;
  569. char path[512] = { '\0' };
  570. int num = ddp_get_module_num(scenario);
  571. for (i = 0; i < num; i++)
  572. strcat(path, ddp_get_module_name(module_list_scenario[scenario][i]));
  573. DDPMSG("scenario %s have modules: %s\n", ddp_get_scenario_name(scenario), path);
  574. }
  575. static int ddp_find_module_index(DDP_SCENARIO_ENUM ddp_scenario, DISP_MODULE_ENUM module)
  576. {
  577. int i = 0;
  578. for (i = 0; i < DDP_ENING_NUM; i++) {
  579. if (module_list_scenario[ddp_scenario][i] == module)
  580. return i;
  581. }
  582. DDPDBG("find module: can not find module %s on scenario %s\n", ddp_get_module_name(module),
  583. ddp_get_scenario_name(ddp_scenario));
  584. return -1;
  585. }
  586. /* set display interface when kernel init */
  587. int ddp_set_dst_module(DDP_SCENARIO_ENUM scenario, DISP_MODULE_ENUM dst_module)
  588. {
  589. int i = 0;
  590. DDPMSG("ddp_set_dst_module, scenario=%s, dst_module=%s\n",
  591. ddp_get_scenario_name(scenario), ddp_get_module_name(dst_module));
  592. if (ddp_find_module_index(scenario, dst_module) > 0) {
  593. DDPDBG("%s is already on path\n", ddp_get_module_name(dst_module));
  594. return 0;
  595. }
  596. i = ddp_get_module_num_l(module_list_scenario[scenario]) - 1;
  597. ASSERT(i >= 0);
  598. if (dst_module == DISP_MODULE_DSIDUAL) {
  599. if (i < (DDP_ENING_NUM - 1)) {
  600. module_list_scenario[scenario][i++] = DISP_MODULE_SPLIT1;
  601. } else {
  602. DDPERR("set dst module over up bound\n");
  603. return -1;
  604. }
  605. } else {
  606. if (ddp_get_dst_module(scenario) == DISP_MODULE_DSIDUAL) {
  607. if (i >= 1) {
  608. module_list_scenario[scenario][i--] = -1;
  609. } else {
  610. DDPERR("set dst module over low bound\n");
  611. return -1;
  612. }
  613. }
  614. }
  615. module_list_scenario[scenario][i] = dst_module;
  616. if (scenario == DDP_SCENARIO_PRIMARY_ALL)
  617. ddp_set_dst_module(DDP_SCENARIO_PRIMARY_DISP, dst_module);
  618. else if (scenario == DDP_SCENARIO_SUB_ALL)
  619. ddp_set_dst_module(DDP_SCENARIO_SUB_DISP, dst_module);
  620. ddp_print_scenario(scenario);
  621. return 0;
  622. }
  623. DISP_MODULE_ENUM ddp_get_dst_module(DDP_SCENARIO_ENUM ddp_scenario)
  624. {
  625. DISP_MODULE_ENUM module_name = DISP_MODULE_UNKNOWN;
  626. int module_num = ddp_get_module_num_l(module_list_scenario[ddp_scenario]) - 1;
  627. if (module_num >= 0)
  628. module_name = module_list_scenario[ddp_scenario][module_num];
  629. /* DDPMSG("ddp_get_dst_module, scneario=%s, dst_module=%s\n", */
  630. /* ddp_get_scenario_name(ddp_scenario), */
  631. /* ddp_get_module_name(module_name)); */
  632. return module_name;
  633. }
  634. int *ddp_get_scenario_list(DDP_SCENARIO_ENUM ddp_scenario)
  635. {
  636. return module_list_scenario[ddp_scenario];
  637. }
  638. int ddp_is_module_in_scenario(DDP_SCENARIO_ENUM ddp_scenario, DISP_MODULE_ENUM module)
  639. {
  640. int i = 0;
  641. for (i = 0; i < DDP_ENING_NUM; i++) {
  642. if (module_list_scenario[ddp_scenario][i] == module)
  643. return 1;
  644. }
  645. return 0;
  646. }
  647. int ddp_insert_module(DDP_SCENARIO_ENUM ddp_scenario, DISP_MODULE_ENUM place,
  648. DISP_MODULE_ENUM module)
  649. {
  650. int i = DDP_ENING_NUM - 1;
  651. int idx = ddp_find_module_index(ddp_scenario, place);
  652. if (idx < 0) {
  653. DDPERR("error: ddp_insert_module , place=%s is not in scenario %s!\n",
  654. ddp_get_module_name(place), ddp_get_scenario_name(ddp_scenario));
  655. return -1;
  656. }
  657. for (i = 0; i < DDP_ENING_NUM; i++) {
  658. if (module_list_scenario[ddp_scenario][i] == module) {
  659. DDPERR("error: ddp_insert_module , module=%s is already in scenario %s!\n",
  660. ddp_get_module_name(module), ddp_get_scenario_name(ddp_scenario));
  661. return -1;
  662. }
  663. }
  664. /* should have empty room for insert */
  665. ASSERT(module_list_scenario[ddp_scenario][DDP_ENING_NUM - 1] == -1);
  666. for (i = DDP_ENING_NUM - 2; i >= idx; i--)
  667. module_list_scenario[ddp_scenario][i + 1] = module_list_scenario[ddp_scenario][i];
  668. module_list_scenario[ddp_scenario][idx] = module;
  669. if (0) {
  670. int *modules = ddp_get_scenario_list(ddp_scenario);
  671. int module_num = ddp_get_module_num(ddp_scenario);
  672. DDPMSG("after insert module, module list is:\n");
  673. for (i = 0; i < module_num; i++)
  674. DDPMSG("%s-", ddp_get_module_name(modules[i]));
  675. }
  676. return 0;
  677. }
  678. int ddp_remove_module(DDP_SCENARIO_ENUM ddp_scenario, DISP_MODULE_ENUM module)
  679. {
  680. int i = 0;
  681. int idx = ddp_find_module_index(ddp_scenario, module);
  682. if (idx < 0) {
  683. DDPERR("ddp_remove_module, can not find module %s in scenario %s\n",
  684. ddp_get_module_name(module), ddp_get_scenario_name(ddp_scenario));
  685. return -1;
  686. }
  687. for (i = idx; i < DDP_ENING_NUM - 1; i++)
  688. module_list_scenario[ddp_scenario][i] = module_list_scenario[ddp_scenario][i + 1];
  689. module_list_scenario[ddp_scenario][DDP_ENING_NUM - 1] = -1;
  690. {
  691. int *modules = ddp_get_scenario_list(ddp_scenario);
  692. int module_num = ddp_get_module_num(ddp_scenario);
  693. DDPMSG("after remove module, module list is:\n");
  694. for (i = 0; i < module_num; i++)
  695. DDPMSG("%s-", ddp_get_module_name(modules[i]));
  696. }
  697. return 0;
  698. }
  699. void ddp_connect_path(DDP_SCENARIO_ENUM scenario, void *handle)
  700. {
  701. DDPDBG("path connect on scenario %s\n", ddp_get_scenario_name(scenario));
  702. if (scenario == DDP_SCENARIO_PRIMARY_ALL) {
  703. ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP], handle);
  704. ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT], handle);
  705. } else if (scenario == DDP_SCENARIO_SUB_ALL) {
  706. ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP], handle);
  707. ddp_connect_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT], handle);
  708. } else {
  709. ddp_connect_path_l(module_list_scenario[scenario], handle);
  710. }
  711. }
  712. void ddp_disconnect_path(DDP_SCENARIO_ENUM scenario, void *handle)
  713. {
  714. DDPDBG("path disconnect on scenario %s\n", ddp_get_scenario_name(scenario));
  715. if (scenario == DDP_SCENARIO_PRIMARY_ALL) {
  716. ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP], handle);
  717. ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT],
  718. handle);
  719. } else if (scenario == DDP_SCENARIO_SUB_ALL) {
  720. ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP], handle);
  721. ddp_disconnect_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT], handle);
  722. } else {
  723. ddp_disconnect_path_l(module_list_scenario[scenario], handle);
  724. }
  725. }
  726. void ddp_check_path(DDP_SCENARIO_ENUM scenario)
  727. {
  728. DDPDBG("path check path on scenario %s\n", ddp_get_scenario_name(scenario));
  729. if (scenario == DDP_SCENARIO_PRIMARY_ALL) {
  730. ddp_check_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_DISP]);
  731. ddp_check_path_l(module_list_scenario[DDP_SCENARIO_PRIMARY_OVL_MEMOUT]);
  732. } else if (scenario == DDP_SCENARIO_SUB_ALL) {
  733. ddp_check_path_l(module_list_scenario[DDP_SCENARIO_SUB_DISP]);
  734. ddp_check_path_l(module_list_scenario[DDP_SCENARIO_SUB_OVL_MEMOUT]);
  735. } else {
  736. ddp_check_path_l(module_list_scenario[scenario]);
  737. }
  738. }
  739. void ddp_check_mutex(int mutex_id, DDP_SCENARIO_ENUM scenario, DDP_MODE mode)
  740. {
  741. DDPDBG("check mutex %d on scenario %s\n", mutex_id, ddp_get_scenario_name(scenario));
  742. ddp_check_mutex_l(mutex_id, module_list_scenario[scenario], mode);
  743. }
  744. int ddp_mutex_set(int mutex_id, DDP_SCENARIO_ENUM scenario, DDP_MODE mode, void *handle)
  745. {
  746. if (scenario < DDP_SCENARIO_MAX)
  747. return ddp_mutex_set_l(mutex_id, module_list_scenario[scenario], mode, handle);
  748. DDPERR("Invalid scenario %d when setting mutex\n", scenario);
  749. return -1;
  750. }
  751. int ddp_mutex_Interrupt_enable(int mutex_id, void *handle)
  752. {
  753. DDPDBG("mutex %d interrupt enable\n", mutex_id);
  754. if (gEnableIRQ == 0 && mutex_id == 0)
  755. return 0;
  756. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_INTEN, 0x1 << mutex_id, 0x1 << mutex_id);
  757. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_INTEN, 1 << (mutex_id + DISP_MUTEX_TOTAL),
  758. 0x1 << (mutex_id + DISP_MUTEX_TOTAL));
  759. return 0;
  760. }
  761. int ddp_mutex_Interrupt_disable(int mutex_id, void *handle)
  762. {
  763. DDPDBG("mutex %d interrupt disenable\n", mutex_id);
  764. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_INTEN, 0, 0x1 << mutex_id);
  765. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_INTEN, 0, 0x1 << (mutex_id + DISP_MUTEX_TOTAL));
  766. return 0;
  767. }
  768. int ddp_mutex_reset(int mutex_id, void *handle)
  769. {
  770. DDPDBG("mutex %d reset\n", mutex_id);
  771. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_RST(mutex_id), 1);
  772. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_RST(mutex_id), 0);
  773. return 0;
  774. }
  775. int ddp_mutex_add_module(int mutex_id, DISP_MODULE_ENUM module, void *handle)
  776. {
  777. int value = 0;
  778. if (module < DISP_MODULE_UNKNOWN) {
  779. if (module_mutex_map[module].bit != -1) {
  780. DDPDBG("module %s added to mutex %d\n", ddp_get_module_name(module),
  781. mutex_id);
  782. value |= (1 << module_mutex_map[module].bit);
  783. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_MOD(mutex_id), value, value);
  784. }
  785. }
  786. return 0;
  787. }
  788. int ddp_mutex_remove_module(int mutex_id, DISP_MODULE_ENUM module, void *handle)
  789. {
  790. int value = 0;
  791. if (module < DISP_MODULE_UNKNOWN) {
  792. if (module_mutex_map[module].bit != -1) {
  793. DDPDBG("module %s added to mutex %d\n", ddp_get_module_name(module),
  794. mutex_id);
  795. value |= (1 << module_mutex_map[module].bit);
  796. DISP_REG_MASK(handle, DISP_REG_CONFIG_MUTEX_MOD(mutex_id), 0, value);
  797. }
  798. }
  799. return 0;
  800. }
  801. int ddp_mutex_clear(int mutex_id, void *handle)
  802. {
  803. DDPDBG("mutex %d clear\n", mutex_id);
  804. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_MOD(mutex_id), 0);
  805. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_SOF(mutex_id), 0);
  806. /*reset mutex */
  807. ddp_mutex_reset(mutex_id, handle);
  808. return 0;
  809. }
  810. int ddp_mutex_enable(int mutex_id, DDP_SCENARIO_ENUM scenario, void *handle)
  811. {
  812. return ddp_mutex_enable_l(mutex_id, handle);
  813. }
  814. int ddp_mutex_disenable(int mutex_id, DDP_SCENARIO_ENUM scenario, void *handle)
  815. {
  816. DDPDBG("mutex %d disable\n", mutex_id);
  817. DISP_REG_SET(handle, DISP_REG_CONFIG_MUTEX_EN(mutex_id), 0);
  818. return 0;
  819. }
  820. int ddp_check_engine_status(int mutexID)
  821. {
  822. /* check engines' clock bit & enable bit & status bit before unlock mutex */
  823. /* should not needed, in comdq do? */
  824. int result = 0;
  825. return result;
  826. }
  827. int ddp_path_top_clock_on(void)
  828. {
  829. #ifdef ENABLE_CLK_MGR
  830. #ifdef CONFIG_MTK_CLKMGR
  831. enable_clock(MT_CG_DISP0_SMI_COMMON, "DDP");
  832. enable_clock(MT_CG_DISP0_SMI_LARB0, "DDP");
  833. /* enable_clock(MT_CG_DISP0_MUTEX_32K , "DDP"); */
  834. #else
  835. static int need_enable;
  836. if (need_enable) {
  837. ddp_clk_prepare_enable(DISP_MTCMOS_CLK);
  838. ddp_clk_prepare_enable(DISP0_SMI_COMMON);
  839. ddp_clk_prepare_enable(DISP0_SMI_LARB0);
  840. /* ddp_clk_prepare_enable(MT_CG_DISP0_MUTEX_32K); */
  841. } else {
  842. need_enable = 1;
  843. }
  844. #endif
  845. DDPMSG("ddp path top clock on CG:%08x\n", DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON0));
  846. #endif
  847. return 0;
  848. }
  849. int ddp_path_top_clock_off(void)
  850. {
  851. #ifdef ENABLE_CLK_MGR
  852. DDPMSG("ddp path top clock off\n");
  853. #ifdef CONFIG_MTK_CLKMGR
  854. if (clk_is_force_on(MT_CG_DISP0_SMI_LARB0) || clk_is_force_on(MT_CG_DISP0_SMI_COMMON)) {
  855. DDPMSG("clear SMI_LARB0 & SMI_COMMON forced on\n");
  856. clk_clr_force_on(MT_CG_DISP0_SMI_LARB0);
  857. clk_clr_force_on(MT_CG_DISP0_SMI_COMMON);
  858. }
  859. #endif
  860. #ifdef CONFIG_MTK_CLKMGR
  861. /* disable_clock(MT_CG_DISP0_MUTEX_32K , "DDP"); */
  862. disable_clock(MT_CG_DISP0_SMI_LARB0, "DDP");
  863. disable_clock(MT_CG_DISP0_SMI_COMMON, "DDP");
  864. #else
  865. /*ddp_clk_disable_unprepare(DISP0_MUTEX_32K); */
  866. ddp_clk_disable_unprepare(DISP0_SMI_LARB0);
  867. ddp_clk_disable_unprepare(DISP0_SMI_COMMON);
  868. ddp_clk_disable_unprepare(DISP_MTCMOS_CLK);
  869. #endif
  870. #endif
  871. return 0;
  872. }
  873. int ddp_path_lp_top_clock_on(void)
  874. {
  875. #ifdef ENABLE_CLK_MGR
  876. #ifdef CONFIG_MTK_CLKMGR
  877. enable_clock(MT_CG_DISP0_SMI_COMMON, "DDP");
  878. enable_clock(MT_CG_DISP0_SMI_LARB0, "DDP");
  879. #else
  880. ddp_clk_enable(DISP_MTCMOS_CLK);
  881. ddp_clk_enable(DISP0_SMI_COMMON);
  882. ddp_clk_enable(DISP0_SMI_LARB0);
  883. #endif
  884. #endif
  885. return 0;
  886. }
  887. int ddp_path_lp_top_clock_off(void)
  888. {
  889. #ifdef ENABLE_CLK_MGR
  890. #ifdef CONFIG_MTK_CLKMGR
  891. disable_clock(MT_CG_DISP0_SMI_LARB0, "DDP");
  892. disable_clock(MT_CG_DISP0_SMI_COMMON, "DDP");
  893. #else
  894. ddp_clk_disable(DISP0_SMI_LARB0);
  895. ddp_clk_disable(DISP0_SMI_COMMON);
  896. ddp_clk_disable(DISP_MTCMOS_CLK);
  897. #endif
  898. #endif
  899. return 0;
  900. }
  901. /* should remove */
  902. int ddp_insert_config_allow_rec(void *handle)
  903. {
  904. int ret = 0;
  905. if (handle == NULL)
  906. ASSERT(0);
  907. if (primary_display_is_video_mode()) {
  908. if (gEnableMutexRisingEdge == 1)
  909. ret = cmdqRecWaitNoClear(handle, CMDQ_EVENT_DISP_RDMA0_EOF);
  910. else
  911. ret = cmdqRecWaitNoClear(handle, CMDQ_EVENT_MUTEX0_STREAM_EOF);
  912. } else {
  913. ret = cmdqRecWaitNoClear(handle, CMDQ_SYNC_TOKEN_STREAM_EOF);
  914. }
  915. return ret;
  916. }
  917. int ddp_insert_config_dirty_rec(void *handle)
  918. {
  919. int ret = 0;
  920. if (handle == NULL)
  921. ASSERT(0);
  922. if (primary_display_is_video_mode())
  923. /* TODO: modify this */
  924. {
  925. /* do nothing */
  926. } else {
  927. ret = cmdqRecSetEventToken(handle, CMDQ_SYNC_TOKEN_CONFIG_DIRTY);
  928. }
  929. return ret;
  930. }
  931. int disp_get_dst_module(DDP_SCENARIO_ENUM scenario)
  932. {
  933. return ddp_get_dst_module(scenario);
  934. }