jd9365_hd720_dsi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. * The following software/firmware and/or related documentation ("MediaTek Software")
  32. * have been modified by MediaTek Inc. All revisions are subject to any receiver\'s
  33. * applicable license agreements with MediaTek Inc.
  34. */
  35. #ifdef BUILD_LK
  36. #include <string.h>
  37. #include <platform/mt_gpio.h>
  38. #include <platform/mt_pmic.h>
  39. #include <platform/upmu_common.h>
  40. #include <platform/mt_i2c.h>
  41. #include <platform/mt_pmic.h>
  42. #endif
  43. #include "lcm_drv.h"
  44. /* --------------------------------------------------------------------------- */
  45. /* Local Constants */
  46. /* --------------------------------------------------------------------------- */
  47. #define LCM_DSI_CMD_MODE 0
  48. #define FRAME_WIDTH (720)
  49. #define FRAME_HEIGHT (1280)
  50. #define GPIO_OUT_ONE 1
  51. #define GPIO_OUT_ZERO 0
  52. #ifdef GPIO_LCM_RST
  53. #define GPIO_LCD_RST GPIO_LCM_RST
  54. #endif
  55. #ifdef GPIO_LCM_PWR_EN
  56. #define GPIO_LCD_PWR_EN GPIO_LCM_PWR_EN
  57. #else
  58. #define GPIO_LCD_PWR_EN 0xFFFFFFFF
  59. #endif
  60. #ifdef GPIO_LCD_BIAS_ENP_PIN
  61. #define GPIO_LCD_BIAS_ENP GPIO_LCD_BIAS_ENP_PIN
  62. #endif
  63. static LCM_UTIL_FUNCS lcm_util;
  64. #define SET_RESET_PIN(v) (lcm_util.set_reset_pin((v)))
  65. #define UDELAY(n) (lcm_util.udelay(n))
  66. #define MDELAY(n) (lcm_util.mdelay(n))
  67. /* --------------------------------------------------------------------------- */
  68. /* Local Functions */
  69. /* --------------------------------------------------------------------------- */
  70. #define dsi_set_cmdq_V2(cmd, count, ppara, force_update) lcm_util.dsi_set_cmdq_V2(cmd, count, ppara, force_update)
  71. #define dsi_set_cmdq(pdata, queue_size, force_update) lcm_util.dsi_set_cmdq(pdata, queue_size, force_update)
  72. #define wrtie_cmd(cmd) lcm_util.dsi_write_cmd(cmd)
  73. #define write_regs(addr, pdata, byte_nums) lcm_util.dsi_write_regs(addr, pdata, byte_nums)
  74. #define read_reg(cmd) lcm_util.dsi_dcs_read_lcm_reg(cmd)
  75. #define read_reg_v2(cmd, buffer, buffer_size) lcm_util.dsi_dcs_read_lcm_reg_v2(cmd, buffer, buffer_size)
  76. /* --------------------------------------------------------------------------- */
  77. /* Local Constants */
  78. /* --------------------------------------------------------------------------- */
  79. #define REGFLAG_DELAY 0xFC
  80. #define REGFLAG_END_OF_TABLE 0xFD /* END OF REGISTERS MARKER */
  81. #ifndef TRUE
  82. #define TRUE 1
  83. #endif
  84. #ifndef FALSE
  85. #define FALSE 0
  86. #endif
  87. /* --------------------------------------------------------------------------- */
  88. /* Local Variables */
  89. /* --------------------------------------------------------------------------- */
  90. static void lcm_set_gpio_output(unsigned int GPIO, unsigned int output)
  91. {
  92. if (GPIO == 0xFFFFFFFF) {
  93. #ifdef BUILD_LK
  94. printf("[LK/LCM] GPIO_LCD_PWR_EN = 0x%x\n", GPIO_LCD_PWR_EN);
  95. printf("[LK/LCM] GPIO_LCD_BIAS_ENP = 0x%x\n", GPIO_LCD_BIAS_ENP);
  96. printf("[LK/LCM] GPIO_LCM_RST = 0x%x\n", GPIO_LCD_RST);
  97. #endif
  98. return;
  99. }
  100. #ifdef BUILD_LK
  101. mt_set_gpio_mode(GPIO, GPIO_MODE_00);
  102. mt_set_gpio_dir(GPIO, GPIO_DIR_OUT);
  103. mt_set_gpio_out(GPIO, (output > 0) ? GPIO_OUT_ONE : GPIO_OUT_ZERO);
  104. #endif
  105. }
  106. struct LCM_setting_table {
  107. unsigned char cmd;
  108. unsigned char count;
  109. unsigned char para_list[64];
  110. };
  111. static struct LCM_setting_table lcm_initialization_setting[] = {
  112. {0xE0, 1, {0x00} },
  113. {0xE1, 1, {0x93} },
  114. {0xE2, 1, {0x65} },
  115. {0xE3, 1, {0xF8} },
  116. {0xE0, 1, {0x04} },
  117. {0x2D, 1, {0x03} },
  118. {0xE0, 1, {0x00} },
  119. {0x70, 1, {0x10} },
  120. {0x71, 1, {0x13} },
  121. {0x72, 1, {0x06} },
  122. {0x75, 1, {0x03} },
  123. {0x80, 1, {0x03} },
  124. {0xE0, 1, {0x01} },
  125. {0x00, 1, {0x00} },
  126. {0x01, 1, {0xB5} },
  127. {0x03, 1, {0x00} },
  128. {0x04, 1, {0xA0} },
  129. {0x0A, 1, {0x07} },
  130. {0x0C, 1, {0x74} },
  131. {0x17, 1, {0x00} },
  132. {0x18, 1, {0xD7} },
  133. {0x19, 1, {0x01} },
  134. {0x1A, 1, {0x00} },
  135. {0x1B, 1, {0xD7} },
  136. {0x1C, 1, {0x01} },
  137. {0x1F, 1, {0x74} },
  138. {0x20, 1, {0x19} },
  139. {0x21, 1, {0x19} },
  140. {0x22, 1, {0x0E} },
  141. {0x27, 1, {0x43} },
  142. {0x37, 1, {0x09} },
  143. {0x38, 1, {0x04} },
  144. {0x39, 1, {0x08} },
  145. {0x3A, 1, {0x18} },
  146. {0x3B, 1, {0x18} },
  147. {0x3C, 1, {0x72} },
  148. {0x3E, 1, {0xFF} },
  149. {0x3E, 1, {0xFF} },
  150. {0x3F, 1, {0xFF} },
  151. {0x40, 1, {0x04} },
  152. {0x41, 1, {0xA0} },
  153. {0x43, 1, {0x08} },
  154. {0x44, 1, {0x07} },
  155. {0x45, 1, {0x30} },
  156. {0x55, 1, {0x01} },
  157. {0x56, 1, {0x01} },
  158. {0x57, 1, {0x65} },
  159. {0x58, 1, {0x0A} },
  160. {0x59, 1, {0x0A} },
  161. {0x5A, 1, {0x28} },
  162. {0x5B, 1, {0x0F} },
  163. {0x5D, 1, {0x7C} },
  164. {0x5E, 1, {0x5F} },
  165. {0x5F, 1, {0x4D} },
  166. {0x60, 1, {0x3F} },
  167. {0x61, 1, {0x39} },
  168. {0x62, 1, {0x29} },
  169. {0x63, 1, {0x2B} },
  170. {0x64, 1, {0x12} },
  171. {0x65, 1, {0x28} },
  172. {0x66, 1, {0x24} },
  173. {0x67, 1, {0x22} },
  174. {0x68, 1, {0x3E} },
  175. {0x69, 1, {0x2C} },
  176. {0x6A, 1, {0x33} },
  177. {0x6B, 1, {0x26} },
  178. {0x6C, 1, {0x23} },
  179. {0x6D, 1, {0x18} },
  180. {0x6E, 1, {0x09} },
  181. {0x6F, 1, {0x00} },
  182. {0x70, 1, {0x7C} },
  183. {0x71, 1, {0x5F} },
  184. {0x72, 1, {0x4D} },
  185. {0x73, 1, {0x3F} },
  186. {0x74, 1, {0x39} },
  187. {0x75, 1, {0x29} },
  188. {0x76, 1, {0x2B} },
  189. {0x77, 1, {0x12} },
  190. {0x78, 1, {0x28} },
  191. {0x79, 1, {0x24} },
  192. {0x7A, 1, {0x22} },
  193. {0x7B, 1, {0x3E} },
  194. {0x7C, 1, {0x2C} },
  195. {0x7D, 1, {0x33} },
  196. {0x7E, 1, {0x26} },
  197. {0x7F, 1, {0x23} },
  198. {0x80, 1, {0x18} },
  199. {0x81, 1, {0x09} },
  200. {0x82, 1, {0x00} },
  201. {0xE0, 1, {0x02} },
  202. {0x00, 1, {0x37} },
  203. {0x01, 1, {0x17} },
  204. {0x02, 1, {0x0A} },
  205. {0x03, 1, {0x06} },
  206. {0x04, 1, {0x08} },
  207. {0x05, 1, {0x04} },
  208. {0x06, 1, {0x00} },
  209. {0x07, 1, {0x1F} },
  210. {0x08, 1, {0x1F} },
  211. {0x09, 1, {0x1F} },
  212. {0x0A, 1, {0x1F} },
  213. {0x0B, 1, {0x1F} },
  214. {0x0C, 1, {0x1F} },
  215. {0x0D, 1, {0x1F} },
  216. {0x0E, 1, {0x1F} },
  217. {0x0F, 1, {0x1F} },
  218. {0x10, 1, {0x3F} },
  219. {0x11, 1, {0x1F} },
  220. {0x12, 1, {0x1F} },
  221. {0x13, 1, {0x1E} },
  222. {0x14, 1, {0x10} },
  223. {0x15, 1, {0x1F} },
  224. {0x16, 1, {0x37} },
  225. {0x17, 1, {0x17} },
  226. {0x18, 1, {0x0B} },
  227. {0x19, 1, {0x07} },
  228. {0x1A, 1, {0x09} },
  229. {0x1B, 1, {0x05} },
  230. {0x1C, 1, {0x01} },
  231. {0x1D, 1, {0x1F} },
  232. {0x1E, 1, {0x1F} },
  233. {0x1F, 1, {0x1F} },
  234. {0x20, 1, {0x1F} },
  235. {0x21, 1, {0x1F} },
  236. {0x22, 1, {0x1F} },
  237. {0x23, 1, {0x1F} },
  238. {0x24, 1, {0x1F} },
  239. {0x25, 1, {0x1F} },
  240. {0x26, 1, {0x1F} },
  241. {0x27, 1, {0x1F} },
  242. {0x28, 1, {0x1F} },
  243. {0x29, 1, {0x1E} },
  244. {0x2A, 1, {0x11} },
  245. {0x2B, 1, {0x1F} },
  246. {0x2C, 1, {0x37} },
  247. {0x2D, 1, {0x17} },
  248. {0x2E, 1, {0x05} },
  249. {0x2F, 1, {0x09} },
  250. {0x30, 1, {0x07} },
  251. {0x31, 1, {0x0B} },
  252. {0x32, 1, {0x11} },
  253. {0x33, 1, {0x1F} },
  254. {0x34, 1, {0x1F} },
  255. {0x35, 1, {0x1F} },
  256. {0x36, 1, {0x1F} },
  257. {0x37, 1, {0x1F} },
  258. {0x38, 1, {0x1F} },
  259. {0x39, 1, {0x1F} },
  260. {0x3A, 1, {0x1F} },
  261. {0x3B, 1, {0x1F} },
  262. {0x3C, 1, {0x3F} },
  263. {0x3D, 1, {0x1F} },
  264. {0x3E, 1, {0x1E} },
  265. {0x3F, 1, {0x1F} },
  266. {0x40, 1, {0x01} },
  267. {0x41, 1, {0x1F} },
  268. {0x42, 1, {0x38} },
  269. {0x43, 1, {0x18} },
  270. {0x44, 1, {0x04} },
  271. {0x45, 1, {0x08} },
  272. {0x46, 1, {0x06} },
  273. {0x47, 1, {0x0A} },
  274. {0x48, 1, {0x10} },
  275. {0x49, 1, {0x1F} },
  276. {0x4A, 1, {0x1F} },
  277. {0x4B, 1, {0x1F} },
  278. {0x4C, 1, {0x1F} },
  279. {0x4D, 1, {0x1F} },
  280. {0x4E, 1, {0x1F} },
  281. {0x4F, 1, {0x1F} },
  282. {0x50, 1, {0x1F} },
  283. {0x51, 1, {0x1F} },
  284. {0x52, 1, {0x1F} },
  285. {0x53, 1, {0x1F} },
  286. {0x54, 1, {0x1E} },
  287. {0x55, 1, {0x1F} },
  288. {0x56, 1, {0x00} },
  289. {0x57, 1, {0x1F} },
  290. {0x58, 1, {0x10} },
  291. {0x59, 1, {0x00} },
  292. {0x5A, 1, {0x00} },
  293. {0x5B, 1, {0x10} },
  294. {0x5C, 1, {0x01} },
  295. {0x5D, 1, {0x50} },
  296. {0x5E, 1, {0x01} },
  297. {0x5F, 1, {0x02} },
  298. {0x60, 1, {0x30} },
  299. {0x61, 1, {0x01} },
  300. {0x62, 1, {0x02} },
  301. {0x63, 1, {0x06} },
  302. {0x64, 1, {0x6A} },
  303. {0x65, 1, {0x55} },
  304. {0x66, 1, {0x08} },
  305. {0x67, 1, {0x73} },
  306. {0x68, 1, {0x05} },
  307. {0x69, 1, {0x08} },
  308. {0x6A, 1, {0x6E} },
  309. {0x6B, 1, {0x00} },
  310. {0x6C, 1, {0x00} },
  311. {0x6D, 1, {0x00} },
  312. {0x6E, 1, {0x00} },
  313. {0x6F, 1, {0x88} },
  314. {0x70, 1, {0x00} },
  315. {0x71, 1, {0x00} },
  316. {0x72, 1, {0x06} },
  317. {0x73, 1, {0x7B} },
  318. {0x74, 1, {0x00} },
  319. {0x75, 1, {0x80} },
  320. {0x76, 1, {0x00} },
  321. {0x77, 1, {0x0D} },
  322. {0x78, 1, {0x18} },
  323. {0x79, 1, {0x00} },
  324. {0x7A, 1, {0x00} },
  325. {0x7B, 1, {0x00} },
  326. {0x7C, 1, {0x00} },
  327. {0x7D, 1, {0x03} },
  328. {0x7E, 1, {0x7B} },
  329. {0xE0, 1, {0x04} },
  330. {0x04, 1, {0x01} },
  331. {0x0E, 1, {0x38} },
  332. {0x2B, 1, {0x2B} },
  333. {0x2E, 1, {0x44} },
  334. {0xE0, 1, {0x00} },
  335. {0xE6, 1, {0x02} },
  336. {0xE6, 1, {0x02} },
  337. {0x11, 0, {} },
  338. {REGFLAG_DELAY, 120, {} },
  339. {0x29, 0, {} },
  340. {REGFLAG_DELAY, 5, {} },
  341. {0x35, 1, {0x00} },
  342. {REGFLAG_END_OF_TABLE, 0x00, {} }
  343. };
  344. static void dsi_send_cmdq_tinno(unsigned cmd, unsigned char count, unsigned char *para_list,
  345. unsigned char force_update)
  346. {
  347. unsigned int item[16];
  348. unsigned char dsi_cmd = (unsigned char)cmd;
  349. unsigned char dc;
  350. int index = 0, length = 0;
  351. memset(item, 0, sizeof(item));
  352. if (count + 1 > 60)
  353. return;
  354. if (count == 0) {
  355. item[0] = 0x0500 | (dsi_cmd << 16);
  356. length = 1;
  357. } else if (count == 1) {
  358. item[0] = 0x1500 | (dsi_cmd << 16) | (para_list[0] << 24);
  359. length = 1;
  360. } else {
  361. item[0] = 0x3902 | ((count + 1) << 16); /* Count include command. */
  362. ++length;
  363. while (1) {
  364. if (index == count + 1)
  365. break;
  366. if (index == 0)
  367. dc = cmd;
  368. else
  369. dc = para_list[index - 1];
  370. /* an item make up of 4data. */
  371. item[index / 4 + 1] |= (dc << (8 * (index % 4)));
  372. if (index % 4 == 0)
  373. ++length;
  374. ++index;
  375. }
  376. }
  377. dsi_set_cmdq(item, length, force_update);
  378. }
  379. static void push_table(struct LCM_setting_table *table, unsigned int count,
  380. unsigned char force_update)
  381. {
  382. unsigned int i;
  383. unsigned cmd;
  384. for (i = 0; i < count; i++) {
  385. cmd = table[i].cmd;
  386. switch (cmd) {
  387. case REGFLAG_DELAY:
  388. MDELAY(table[i].count);
  389. break;
  390. case REGFLAG_END_OF_TABLE:
  391. break;
  392. default:
  393. dsi_send_cmdq_tinno(cmd, table[i].count, table[i].para_list, force_update);
  394. /* dsi_set_cmdq_V2(cmd, table[i].count, table[i].para_list, force_update); */
  395. }
  396. }
  397. }
  398. static void init_lcm_registers(void)
  399. {
  400. push_table(lcm_initialization_setting,
  401. sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
  402. }
  403. /* --------------------------------------------------------------------------- */
  404. /* LCM Driver Implementations */
  405. /* --------------------------------------------------------------------------- */
  406. static void lcm_set_util_funcs(const LCM_UTIL_FUNCS *util)
  407. {
  408. memcpy(&lcm_util, util, sizeof(LCM_UTIL_FUNCS));
  409. }
  410. static void lcm_get_params(LCM_PARAMS *params)
  411. {
  412. memset(params, 0, sizeof(LCM_PARAMS));
  413. params->type = LCM_TYPE_DSI;
  414. params->width = FRAME_WIDTH;
  415. params->height = FRAME_HEIGHT;
  416. #if (LCM_DSI_CMD_MODE)
  417. params->dsi.mode = CMD_MODE;
  418. #else
  419. params->dsi.mode = SYNC_PULSE_VDO_MODE;
  420. #endif
  421. /* DSI */
  422. /* Command mode setting */
  423. params->dsi.LANE_NUM = LCM_FOUR_LANE;
  424. /* The following defined the fomat for data coming from LCD engine. */
  425. params->dsi.data_format.color_order = LCM_COLOR_ORDER_RGB;
  426. params->dsi.data_format.trans_seq = LCM_DSI_TRANS_SEQ_MSB_FIRST;
  427. params->dsi.data_format.padding = LCM_DSI_PADDING_ON_LSB;
  428. params->dsi.data_format.format = LCM_DSI_FORMAT_RGB888;
  429. params->dsi.intermediat_buffer_num = 2;
  430. params->dsi.PS = LCM_PACKED_PS_24BIT_RGB888;
  431. #ifndef BUILD_LK
  432. params->dsi.esd_check_enable = 1;
  433. params->dsi.customization_esd_check_enable = 1;
  434. params->dsi.lcm_esd_check_table[0].cmd = 0x0A;
  435. params->dsi.lcm_esd_check_table[0].count = 1;
  436. params->dsi.lcm_esd_check_table[0].para_list[0] = 0x9c;
  437. #endif
  438. params->dsi.vertical_sync_active = 4;
  439. params->dsi.vertical_backporch = 4;
  440. params->dsi.vertical_frontporch = 16;
  441. params->dsi.vertical_active_line = FRAME_HEIGHT;
  442. params->dsi.horizontal_sync_active = 55;
  443. params->dsi.horizontal_backporch = 53;
  444. params->dsi.horizontal_frontporch = 24;
  445. params->dsi.horizontal_active_pixel = FRAME_WIDTH;
  446. /* video mode timing */
  447. params->dsi.word_count = FRAME_WIDTH * 3;
  448. params->dsi.PLL_CLOCK = 270;
  449. }
  450. static void lcm_init_lcm(void)
  451. {
  452. #ifdef BUILD_LK
  453. printf("[LK/LCM] lcm_init() enter\n");
  454. lcm_set_gpio_output(GPIO_LCM_RST, GPIO_OUT_ONE);
  455. MDELAY(10);
  456. lcm_set_gpio_output(GPIO_LCD_PWR_EN, GPIO_OUT_ONE);
  457. MDELAY(10);
  458. lcm_set_gpio_output(GPIO_LCD_BIAS_ENP, GPIO_OUT_ONE);
  459. MDELAY(10);
  460. lcm_set_gpio_output(GPIO_LCM_RST, GPIO_OUT_ZERO);
  461. MDELAY(10);
  462. lcm_set_gpio_output(GPIO_LCM_RST, GPIO_OUT_ONE);
  463. MDELAY(10);
  464. lcm_set_gpio_output(GPIO_LCM_RST, GPIO_OUT_ZERO);
  465. MDELAY(10);
  466. init_lcm_registers();
  467. #endif
  468. }
  469. void lcm_suspend(void)
  470. {
  471. #ifdef BUILD_LK
  472. printf("[LK/LCM] lcm_suspend() enter\n");
  473. #endif
  474. }
  475. void lcm_resume(void)
  476. {
  477. #ifdef BUILD_LK
  478. printf("[LK/LCM] lcm_resume() enter\n");
  479. #endif
  480. }
  481. #if (LCM_DSI_CMD_MODE)
  482. static void lcm_update(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
  483. {
  484. unsigned int x0 = x;
  485. unsigned int y0 = y;
  486. unsigned int x1 = x0 + width - 1;
  487. unsigned int y1 = y0 + height - 1;
  488. unsigned char x0_MSB = ((x0 >> 8) & 0xFF);
  489. unsigned char x0_LSB = (x0 & 0xFF);
  490. unsigned char x1_MSB = ((x1 >> 8) & 0xFF);
  491. unsigned char x1_LSB = (x1 & 0xFF);
  492. unsigned char y0_MSB = ((y0 >> 8) & 0xFF);
  493. unsigned char y0_LSB = (y0 & 0xFF);
  494. unsigned char y1_MSB = ((y1 >> 8) & 0xFF);
  495. unsigned char y1_LSB = (y1 & 0xFF);
  496. unsigned int data_array[16];
  497. data_array[0] = 0x00053902;
  498. data_array[1] = (x1_MSB << 24) | (x0_LSB << 16) | (x0_MSB << 8) | 0x2a;
  499. data_array[2] = (x1_LSB);
  500. dsi_set_cmdq(data_array, 3, 1);
  501. data_array[0] = 0x00053902;
  502. data_array[1] = (y1_MSB << 24) | (y0_LSB << 16) | (y0_MSB << 8) | 0x2b;
  503. data_array[2] = (y1_LSB);
  504. dsi_set_cmdq(data_array, 3, 1);
  505. data_array[0] = 0x002c3909;
  506. dsi_set_cmdq(data_array, 1, 0);
  507. }
  508. #endif
  509. LCM_DRIVER jd9365_hd720_dsi_lcm_drv = {
  510. .name = "jd9365_hd720_dsi",
  511. .set_util_funcs = lcm_set_util_funcs,
  512. .get_params = lcm_get_params,
  513. .init = lcm_init_lcm,
  514. .suspend = lcm_suspend,
  515. .resume = lcm_resume,
  516. };