it6121_g156xw01v1_lvds_vdo.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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. #ifndef BUILD_LK
  36. #include <linux/string.h>
  37. #else
  38. #include <string.h>
  39. #endif
  40. #include "lcm_drv.h"
  41. #ifdef BUILD_LK
  42. #include <platform/mt_gpio.h>
  43. #include <platform/mt_pmic.h>
  44. #include <platform/mt_i2c.h>
  45. #elif defined(BUILD_UBOOT)
  46. #else
  47. #include <mach/mt_gpio.h>
  48. #include <mach/mt_pm_ldo.h>
  49. #endif
  50. // ---------------------------------------------------------------------------
  51. // Local Constants
  52. // ---------------------------------------------------------------------------
  53. #define FRAME_WIDTH (1368)
  54. #define FRAME_HEIGHT (768)
  55. #ifdef GPIO_LCM_RST
  56. #define GPIO_LCD_RST_EN GPIO_LCM_RST
  57. #else
  58. #define GPIO_LCD_RST_EN 0xFFFFFFFF
  59. #endif
  60. // ---------------------------------------------------------------------------
  61. // Local Variables
  62. // ---------------------------------------------------------------------------
  63. static LCM_UTIL_FUNCS lcm_util =
  64. {
  65. .set_reset_pin = NULL,
  66. .udelay = NULL,
  67. .mdelay = NULL,
  68. };
  69. typedef struct
  70. {
  71. kal_uint8 dev_addr;
  72. kal_uint8 addr;
  73. kal_uint8 data;
  74. }it6121_setting_table;
  75. #define SET_RESET_PIN(v) (lcm_util.set_reset_pin((v)))
  76. #define UDELAY(n) (lcm_util.udelay(n))
  77. #define MDELAY(n) (lcm_util.mdelay(n))
  78. // ---------------------------------------------------------------------------
  79. // Local Functions
  80. // ---------------------------------------------------------------------------
  81. #define dsi_set_cmdq_V2(cmd, count, ppara, force_update) lcm_util.dsi_set_cmdq_V2(cmd, count, ppara, force_update)
  82. #define dsi_set_cmdq(pdata, queue_size, force_update) lcm_util.dsi_set_cmdq(pdata, queue_size, force_update)
  83. #define wrtie_cmd(cmd) lcm_util.dsi_write_cmd(cmd)
  84. #define write_regs(addr, pdata, byte_nums) lcm_util.dsi_write_regs(addr, pdata, byte_nums)
  85. #define read_reg(cmd) lcm_util.dsi_dcs_read_lcm_reg(cmd)
  86. #define read_reg_v2(cmd, buffer, buffer_size) lcm_util.dsi_dcs_read_lcm_reg_v2(cmd, buffer, buffer_size)
  87. #define LCM_DSI_CMD_MODE 0
  88. #define MIPI_I2C_ADDR (0x6C << 0)
  89. #define REGFLAG_DELAY (0xAB)
  90. //#define it6121_DEBUG
  91. // ---------------------------------------------------------------------------
  92. // LCM Driver Implementations
  93. // ---------------------------------------------------------------------------
  94. static void lcm_set_util_funcs(const LCM_UTIL_FUNCS *util)
  95. {
  96. memcpy(&lcm_util, util, sizeof(LCM_UTIL_FUNCS));
  97. }
  98. static void lcm_set_gpio_output(unsigned int GPIO, unsigned int output)
  99. {
  100. if(GPIO == 0xFFFFFFFF)
  101. {
  102. #ifdef BUILD_LK
  103. printf("[LK/LCM] GPIO_LCD_RST_EN = 0x%x \n",GPIO_LCD_RST_EN);
  104. #elif (defined BUILD_UBOOT)
  105. #else
  106. #endif
  107. return;
  108. }
  109. mt_set_gpio_mode(GPIO, GPIO_MODE_00);
  110. mt_set_gpio_dir(GPIO, GPIO_DIR_OUT);
  111. mt_set_gpio_out(GPIO, (output>0)? GPIO_OUT_ONE: GPIO_OUT_ZERO);
  112. }
  113. #ifdef BUILD_LK
  114. #define IT6121_BUSNUM I2C0
  115. static kal_uint32 it6121_i2c_write_byte(kal_uint8 dev_addr,kal_uint8 addr, kal_uint8 data)
  116. {
  117. kal_uint32 ret_code = I2C_OK;
  118. kal_uint8 write_data[I2C_FIFO_SIZE], len;
  119. struct mt_i2c_t i2c;
  120. i2c.id = IT6121_BUSNUM;
  121. i2c.addr = dev_addr;
  122. i2c.mode = ST_MODE;
  123. i2c.speed = 100;
  124. write_data[0]= addr;
  125. write_data[1] = data;
  126. len = 2;
  127. #ifdef it6121_DEBUG
  128. /* dump write_data for check */
  129. printf("[it6121_i2c_write] dev_addr = 0x%x, write_data[0x%x] = 0x%x \n", dev_addr, write_data[0], write_data[1]);
  130. #endif
  131. ret_code = i2c_write(&i2c, write_data, len);
  132. return ret_code;
  133. }
  134. static kal_uint32 it6121_i2c_read_byte(kal_uint8 dev_addr,kal_uint8 addr, kal_uint8 *dataBuffer)
  135. {
  136. kal_uint32 ret_code = I2C_OK;
  137. kal_uint8 len;
  138. struct mt_i2c_t i2c;
  139. *dataBuffer = addr;
  140. i2c.id = IT6121_BUSNUM;
  141. i2c.addr = dev_addr;
  142. i2c.mode = ST_MODE;
  143. i2c.speed = 100;
  144. len = 1;
  145. ret_code = i2c_write_read(&i2c, dataBuffer, len, len);
  146. #ifdef it6121_DEBUG
  147. /* dump write_data for check */
  148. printf("[it6121_read_byte] dev_addr = 0x%x, read_data[0x%x] = 0x%x \n", dev_addr, addr, *dataBuffer);
  149. #endif
  150. return ret_code;
  151. }
  152. /******************************************************************************
  153. *IIC drvier,:protocol type 2 add by chenguangjian end
  154. ******************************************************************************/
  155. #else
  156. extern int it6121_i2c_read_byte(kal_uint8 dev_addr, kal_uint8 addr, kal_uint8 *returnData);
  157. extern int it6121_i2c_write_byte(kal_uint8 dev_addr, kal_uint8 addr, kal_uint8 writeData);
  158. #endif
  159. /////////////////////////////////////////////////////////////////////
  160. /// for it6121 defines start ///////////////////////////////
  161. /////////////////////////////////////////////////////////////////////
  162. //#define PANEL_RESOLUTION_1280x800_NOUFO
  163. //#define PANEL_RESOLUTION_2048x1536_NOUFO_18B
  164. //#define PANEL_RESOLUTION_2048x1536
  165. //#define PANEL_RESOLUTION_2048x1536_NOUFO
  166. //#define PANEL_RESOLUTION_1920x1200p60RB
  167. //#define PANEL_RESOLUTION_1920x1080p60
  168. //#define PANEL_RESOLUTION_1366x768_2LANE_24B
  169. //#define PANEL_RESOLUTION_1366x768_4LANE_24B
  170. #define PANEL_RESOLUTION_1368x768_4LANE_24B
  171. #define MIPI_4_LANE (3)
  172. #define MIPI_3_LANE (2)
  173. #define MIPI_2_LANE (1)
  174. #define MIPI_1_LANE (0)
  175. // MIPI Packed Pixel Stream
  176. #define RGB_24b (0x3E)
  177. #define RGB_30b (0x0D)
  178. #define RGB_36b (0x1D)
  179. #define RGB_18b (0x1E)
  180. #define RGB_18b_L (0x2E)
  181. #define YCbCr_16b (0x2C)
  182. #define YCbCr_20b (0x0C)
  183. #define YCbCr_24b (0x1C)
  184. // DPTX reg62[3:0]
  185. #define B_DPTXIN_6Bpp (0)
  186. #define B_DPTXIN_8Bpp (1)
  187. #define B_DPTXIN_10Bpp (2)
  188. #define B_DPTXIN_12Bpp (3)
  189. #define B_LBR (1)
  190. #define B_HBR (0)
  191. #define DP_4_LANE (3)
  192. #define DP_2_LANE (1)
  193. #define DP_1_LANE (0)
  194. #define B_SSC_ENABLE (1)
  195. #define B_SSC_DISABLE (0)
  196. #define H_Neg (0)
  197. #define H_Pos (1)
  198. #define V_Neg (0)
  199. #define V_Pos (1)
  200. #define En_UFO (1)
  201. #define H_ReSync (1)
  202. ///////////////////////////////////////////////////////////////////////////
  203. //CONFIGURE
  204. ///////////////////////////////////////////////////////////////////////////
  205. #define TRAINING_BITRATE (B_HBR)
  206. #define DPTX_SSC_SETTING (B_SSC_ENABLE)
  207. #define HIGH_PCLK (1)
  208. #define MP_MCLK_INV (1)
  209. #define MP_CONTINUOUS_CLK (1)
  210. #define MP_LANE_DESKEW (1)
  211. #define MP_LANE_SWAP (0)
  212. #define MP_PN_SWAP (0)
  213. #define DP_PN_SWAP (0)
  214. #define DP_AUX_PN_SWAP (0)
  215. #define DP_LANE_SWAP (1) //(0) our convert board need to LANE SWAP for data lane
  216. #define FRAME_RESYNC (1)
  217. #define LVDS_LANE_SWAP (0)
  218. #define LVDS_PN_SWAP (0)
  219. #define LVDS_DC_BALANCE (0)
  220. #define LVDS_6BIT (1) // '0' for 8 bit, '1' for 6 bit
  221. #define VESA_MAP (1) // '0' for JEIDA , '1' for VESA MAP
  222. #define INT_MASK (3)
  223. #define MIPI_RECOVER (1)
  224. #define MIPI_EVENT_MODE (1)
  225. #define MIPI_HSYNC_W (8)
  226. #define MIPI_VSYNC_W (2)
  227. #define TIMER_CNT (0x0A)
  228. ///////////////////////////////////////////////////////////////////////
  229. // Global Setting
  230. ///////////////////////////////////////////////////////////////////////
  231. struct PanelInfoStr{
  232. unsigned char ucVic;// non-Zero value for CEA setting, check the given input format.
  233. unsigned short usPWidth;
  234. unsigned char ucDpLanes;
  235. unsigned char ucMpLanes;
  236. unsigned char ucMpHPol;
  237. unsigned char ucMpVPol;
  238. unsigned char ucUFO;
  239. unsigned char ucMpFmt;
  240. unsigned char ucMpHReSync;
  241. unsigned char ucMpVReSync;
  242. unsigned char ucMpClkDiv;
  243. unsigned char ucIntMask;
  244. };
  245. #if defined PANEL_RESOLUTION_1280x800_4LANE_24B
  246. struct PanelInfoStr sPInfo = { 0, 1280, DP_2_LANE, MIPI_4_LANE, H_Neg, V_Pos, 0, RGB_24b, H_ReSync, 0, 2, 0};
  247. #elif defined PANEL_RESOLUTION_1920x1080p60_4LANE_24B
  248. struct PanelInfoStr sPInfo = { 16, 1920, DP_2_LANE, MIPI_4_LANE, H_Pos, V_Pos, 0, RGB_24b, H_ReSync, 0, 2, 0};
  249. #elif defined PANEL_RESOLUTION_1920x1200_4LANE_24B
  250. struct PanelInfoStr sPInfo = { 0, 1920, DP_2_LANE, MIPI_4_LANE, H_Pos, V_Neg, 0, RGB_24b, H_ReSync, 0, 2, 0};
  251. #elif defined PANEL_RESOLUTION_2048x1536_4LANE_24B_UFO
  252. struct PanelInfoStr sPInfo = { 0, 2048, DP_4_LANE, MIPI_4_LANE, H_Neg, V_Pos, En_UFO, RGB_24b, 0, 0, 2, 0};
  253. #elif defined PANEL_RESOLUTION_2048x1536_4LANE_24B
  254. struct PanelInfoStr sPInfo = { 0, 2048, DP_4_LANE, MIPI_4_LANE, H_Neg, V_Pos, 0, RGB_24b, H_ReSync, 0, 2, 0};
  255. #elif defined PANEL_RESOLUTION_2048x1536_4LANE_18B
  256. struct PanelInfoStr sPInfo = { 0, 2048, DP_4_LANE, MIPI_4_LANE, H_Neg, V_Pos, 0, RGB_18b, H_ReSync, 0, 2, 0};
  257. #elif defined PANEL_RESULUTION_1536x2048_4LANE_24B
  258. struct PanelInfoStr sPInfo = { 0, 1536, DP_4_LANE, MIPI_4_LANE, H_Neg, V_Pos, 0, RGB_24b, H_ReSync, 0, 2, 0};
  259. #elif defined PANEL_RESULUTION_1536x2048_4LANE_24B_UFO
  260. struct PanelInfoStr sPInfo = { 0, 1536, DP_4_LANE, MIPI_4_LANE, H_Neg, V_Pos, En_UFO, RGB_24b, 0, 0, 2, 0};
  261. #elif defined PANEL_RESOLUTION_1366x768_4LANE_24B
  262. struct PanelInfoStr sPInfo = { 0, 1366, DP_2_LANE, MIPI_4_LANE, H_Neg, V_Neg, 0, RGB_18b, H_ReSync, 0, 3, 0x11};
  263. #elif defined PANEL_RESOLUTION_1366x768_2LANE_24B
  264. struct PanelInfoStr sPInfo = { 0, 1366, DP_2_LANE, MIPI_2_LANE, H_Neg, V_Neg, 0, RGB_24b, H_ReSync, 0, 5, 0x11};
  265. #elif defined PANEL_RESOLUTION_1368x768_4LANE_24B
  266. struct PanelInfoStr sPInfo = { 0, 1368, DP_2_LANE, MIPI_4_LANE, H_Neg, V_Neg, 0, RGB_24b, H_ReSync, 0, 2, 0};
  267. #endif
  268. /////////////////////////////////////////////////////////////////////
  269. /// for it6121 defines end /////////////////////////////////
  270. /////////////////////////////////////////////////////////////////////
  271. /////////////////////////////////////////////////////////
  272. // Function
  273. /////////////////////////////////////////////////////////
  274. ///////////////////////////////////////////////////////////////////////
  275. void it6121_MIPI_Init(void)
  276. {
  277. #ifndef BUILD_LK
  278. printk("[KE/LCM] it6121_MIPI_Init\n");
  279. #else
  280. printf("[LK/LCM] it6121_MIPI_Init\n");
  281. #endif
  282. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x05,0x33);
  283. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x05,0x40);
  284. if(sPInfo.ucIntMask){
  285. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x05,0x20);
  286. }else{
  287. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x05,0x00);
  288. }
  289. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x0c,(MP_LANE_SWAP<<7)|(MP_PN_SWAP<<6)|(sPInfo.ucMpLanes<<4));
  290. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x11,MP_MCLK_INV);
  291. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x19,(MP_CONTINUOUS_CLK<<1) | MP_LANE_DESKEW);
  292. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x4B,(FRAME_RESYNC<<4));
  293. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x4E,(sPInfo.ucMpVPol<<1)|(sPInfo.ucMpHPol));
  294. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x72,0x01);
  295. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x73,0x03);
  296. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x80,sPInfo.ucMpClkDiv);
  297. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC0,(HIGH_PCLK<< 4) | 0x0F);
  298. #if (LVDS_6BIT == 1)
  299. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC1,0x71);
  300. #else
  301. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC1,0x01);
  302. #endif
  303. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC2,0x25);
  304. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC3,0x37);
  305. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xC4,0x03);
  306. it6121_i2c_write_byte(MIPI_I2C_ADDR,0xCB,(LVDS_PN_SWAP<<5)|(LVDS_LANE_SWAP<<4)|(LVDS_6BIT<<2)|(LVDS_DC_BALANCE<<1)| VESA_MAP);
  307. #if (MIPI_EVENT_MODE == 1)
  308. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x33,0x80 | MIPI_HSYNC_W >> 8);
  309. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x32,MIPI_HSYNC_W);
  310. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x3D,0x80 | MIPI_VSYNC_W >> 8);
  311. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x3C,MIPI_VSYNC_W);
  312. #endif
  313. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x06,0xFF);
  314. it6121_i2c_write_byte(MIPI_I2C_ADDR,0x09,sPInfo.ucIntMask);
  315. }
  316. int it6121_init(void)
  317. {
  318. unsigned char VenID[2], DevID[2], RevID;
  319. it6121_i2c_read_byte(MIPI_I2C_ADDR, 0x00, &VenID[0]);
  320. it6121_i2c_read_byte(MIPI_I2C_ADDR, 0x01, &VenID[1]);
  321. it6121_i2c_read_byte(MIPI_I2C_ADDR, 0x02, &DevID[0]);
  322. it6121_i2c_read_byte(MIPI_I2C_ADDR, 0x03, &DevID[1]);
  323. it6121_i2c_read_byte(MIPI_I2C_ADDR, 0x04, &RevID);
  324. #ifndef BUILD_LK
  325. printk("Current MPDevID=%02X%02X\n", DevID[1], DevID[0]);
  326. printk("Current MPVenID=%02X%02X\n", VenID[1], VenID[0]);
  327. printk("Current MPRevID=%02X\n\n", RevID);
  328. printk(" Test 2 MIPI_I2C_ADDR=0x%x\n", MIPI_I2C_ADDR);
  329. #endif
  330. if(VenID[0]==0x54 && VenID[1]==0x49 && DevID[0]==0x21 && DevID[1]==0x61 ){
  331. it6121_MIPI_Init();
  332. return 1;
  333. }
  334. return -1;
  335. }
  336. static void lcm_get_params(LCM_PARAMS *params)
  337. {
  338. memset(params, 0, sizeof(LCM_PARAMS));
  339. params->type = LCM_TYPE_DSI;
  340. params->width = FRAME_WIDTH;
  341. params->height = FRAME_HEIGHT;
  342. #if (LCM_DSI_CMD_MODE)
  343. params->dsi.mode = CMD_MODE;
  344. #else
  345. params->dsi.mode = SYNC_EVENT_VDO_MODE; //SYNC_PULSE_VDO_MODE;
  346. #endif
  347. params->dsi.LANE_NUM = LCM_FOUR_LANE;
  348. params->dsi.data_format.color_order = LCM_COLOR_ORDER_RGB;
  349. params->dsi.data_format.trans_seq = LCM_DSI_TRANS_SEQ_MSB_FIRST;
  350. params->dsi.data_format.padding = LCM_DSI_PADDING_ON_LSB;
  351. params->dsi.data_format.format = LCM_DSI_FORMAT_RGB666;
  352. // Highly depends on LCD driver capability.
  353. params->dsi.packet_size=256;
  354. // Video mode setting
  355. params->dsi.intermediat_buffer_num = 0;
  356. params->dsi.PS=LCM_PACKED_PS_24BIT_RGB888;
  357. params->dsi.word_count=FRAME_WIDTH*3;
  358. params->dsi.vertical_sync_active = 8; // total 38
  359. params->dsi.vertical_backporch = 10;
  360. params->dsi.vertical_frontporch = 20;
  361. params->dsi.vertical_active_line = FRAME_HEIGHT;
  362. params->dsi.horizontal_sync_active = 5; // total 200
  363. params->dsi.horizontal_backporch = 85;
  364. params->dsi.horizontal_frontporch = 110;
  365. params->dsi.horizontal_active_pixel = FRAME_WIDTH;
  366. params->dsi.PLL_CLOCK = 240; // 76MHz * 3 *1.05
  367. params->dsi.cont_clock = 1;
  368. }
  369. static void lcm_power(void)
  370. {
  371. #ifdef BUILD_LK
  372. printf("[LK/LCM] lcm_power() enter\n");
  373. lcm_set_gpio_output(GPIO_LCD_RST_EN,GPIO_OUT_ONE);
  374. MDELAY(20);
  375. #else
  376. printk("[Kernel/LCM] lcm_power() enter\n");
  377. lcm_set_gpio_output(GPIO_LCD_RST_EN, GPIO_OUT_ONE);
  378. MDELAY(20);
  379. #endif
  380. }
  381. static void lcm_init(void)
  382. {
  383. #ifdef BUILD_LK
  384. printf("[LK/LCM] lcm_init() enter\n");
  385. #else
  386. printk("[Kernel/LCM] lcm_init() enter\n");
  387. #endif
  388. it6121_init();
  389. }
  390. static void lcm_suspend(void)
  391. {
  392. #ifdef BUILD_LK
  393. printf("[LK/LCM] lcm_suspend() enter\n");
  394. lcm_set_gpio_output(GPIO_LCD_RST_EN,GPIO_OUT_ZERO);
  395. MDELAY(20);
  396. #else
  397. printk("[Kernel/LCM] lcm_suspend() enter\n");
  398. lcm_set_gpio_output(GPIO_LCD_RST_EN,GPIO_OUT_ZERO);
  399. MDELAY(20);
  400. #endif
  401. }
  402. static void lcm_resume(void)
  403. {
  404. #ifdef BUILD_LK
  405. printf("[LK/LCM] lcm_resume() enter\n");
  406. lcm_set_gpio_output(GPIO_LCD_RST_EN,GPIO_OUT_ONE);
  407. MDELAY(20);
  408. #else
  409. printk("[Kernel/LCM] lcm_resume() enter\n");
  410. lcm_set_gpio_output(GPIO_LCD_RST_EN,GPIO_OUT_ONE);
  411. MDELAY(20);
  412. #endif
  413. lcm_init();
  414. }
  415. LCM_DRIVER it6121_g156xw01v1_lvds_vdo_lcm_drv =
  416. {
  417. .name = "it6121_g156xw01v1_lvds_vdo",
  418. .set_util_funcs = lcm_set_util_funcs,
  419. .get_params = lcm_get_params,
  420. .init = lcm_init,
  421. .suspend = lcm_suspend,
  422. .resume = lcm_resume,
  423. .init_power = lcm_power,
  424. };