当前位置:   article > 正文

全志 mipi屏幕和触摸驱动调试记录_sunxi_lcd_dsi_dcs_read

sunxi_lcd_dsi_dcs_read

第一步 查看原理图、全志硬件手册、屏幕手册

这个就不全部贴出来了

第二步 配置屏

路径:/root/workspace/allwinner/lichee/tools/pack/chips/sun8iw11p1/configs/a40-OKA40i_C/sys_config1024x600mipi.fex

  1. ;disp init configuration
  2. fb0_width = 800
  3. fb0_height = 1280
  1. ;lcd0 configuration
  2. lcd_used = 1
  3. lcd_driver_name = "tft720x1280" ;与驱动名称一致,我没有新增,直接用已支持的驱动改的
  4. lcd_backlight = 255
  5. lcd_if = 4
  6. lcd_x = 800 ;根据屏幕厂家提供的填写,有些屏幕x与y是反过来的
  7. lcd_y = 1280 ;根据屏幕厂家提供的填写,有些屏幕x与y是反过来的
  8. ctp_touch_panel_max_x = 800
  9. ctp_touch_panel_max_y = 480
  10. lcd_width =
  11. lcd_height =
  12. lcd_dclk_freq = 72 ;传输像素传送频率。单位为MHz。lcd_dclk_freq=lcd_htlcd_vt,算出来的值再稍微大一些,我这边算出来是69左右,我用了72
  13. lcd_pwm_used = 1 ;此参数标识是否使用pwm 用以背光亮度的控制。我这边使用pwm进行控制背光,也定义了对应的lcd_bl_en来控制背光
  14. lcd_pwm_ch = 1 ; 此参数标识使用的Pwm 通道,这里是指使用SoC 哪个pwm 通道,通过查看原理图连接可知。我这边使用了1通道
  15. lcd_pwm_freq = 50000
  16. lcd_pwm_pol = 0
  17. lcd_pwm_max_limit = 255
  18. lcd_hbp = 56 ;根据如上图屏幕手册Input Timing定义对应值计算:THS+THB得出
  19. lcd_ht = 908 ;lcd_x+HS+HBP+HFP,如果屏幕手册已经有HT则直接填就行
  20. lcd_hspw = 8 ;根据如上图屏幕手册Input Timing定义填写
  21. lcd_vbp = 22 ;根据如上图屏幕手册Input Timing定义对应值计算:TVS+TVB得出
  22. lcd_vt = 1317 ;lcd_y+VS+VBP+VFP,如果屏幕手册已经有VT则直接填就行
  23. lcd_vspw = 6 ;根据如上图屏幕手册Input Timing定义填写
  24. lcd_lvds_if = 0
  25. lcd_lvds_colordepth = 1
  26. lcd_lvds_mode = 0
  27. lcd_frm = 0
  28. lcd_hv_clk_phase = 0
  29. lcd_hv_sync_polarity= 0
  30. lcd_gamma_en = 0
  31. lcd_bright_curve_en = 0
  32. lcd_cmap_en = 0
  33. lcd_dsi_if = 0 ;0:Video mode 1:Command mode 2:video burst mode ,我当时没有在意这个参数,我设置了1,然后一直背光亮,屏幕黑,后面改成0后,屏幕正常点亮
  34. lcd_dsi_lane = 4 ;屏幕支持的通道数,从1开始,11 data lane 22 data lane 33 data lane 44 data lane
  35. lcd_dsi_format = 0 ;0:Package Pixel Stream, 24bit RGB 1:Loosely Package Pixel Stream, 18bit RGB 2:Package Pixel Stream, 18bit RGB 3:Package Pixel Stream, 16bit RGB
  36. lcd_dsi_te = 1 ;0:frame trigged automatically 1:frame trigged by te rising edge 2:frame trigged by te falling edge
  37. deu_mode = 0
  38. lcdgamma4iep = 22
  39. smart_color = 90
  40. lcd_bl_en = port:PB3<1><0><default><1> ;根据原理图和全志硬件手册填写背光引脚
  41. lcd_gpio_0 = port:PH11<1><0><default><1> ;根据原理图和全志硬件手册填写电源使能(复位)引脚
  42. lcd_power = "vcc-lcd" ;3.3v屏幕供电
  43. lcd_power1 = "vcc-lcd"

第三步  增加屏幕驱动

注意:如果是新增文件则需要在panel、makefile等文件中按要求新增

1.关注是否需要初始化屏幕的指令序列,我这边是需要的,问屏幕厂家要即可

2.关注屏幕的打开电源与关闭电源的时序,从屏幕手册可以查到,如第一步的图2

3.关注屏幕背光打开与关闭

4.如果需要在boot启动过程中就要显示,需要在u-boot源码中修改对应驱动,和内核保持一致。

驱动源码如下:

u-boot路径:/root/workspace/allwinner/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/tft720x1280.c

内核路径:/root/workspace/allwinner/lichee/linux-3.10/drivers/video/sunxi/disp2/disp/lcd/tft720x1280.c

  1. #include "tft720x1280.h"
  2. extern s32 bsp_disp_get_panel_info(u32 screen_id, disp_panel_para *info);
  3. static void LCD_power_on(u32 sel);
  4. static void LCD_power_off(u32 sel);
  5. static void LCD_bl_open(u32 sel);
  6. static void LCD_bl_close(u32 sel);
  7. static void LCD_panel_init(u32 sel);
  8. static void LCD_panel_exit(u32 sel);
  9. #define dsi_dcs_wr_0para sunxi_lcd_dsi_dcs_write_0para
  10. #define dsi_dcs_wr_1para sunxi_lcd_dsi_dcs_write_1para
  11. #define dsi_dcs_wr_2para sunxi_lcd_dsi_dcs_write_2para
  12. #define dsi_dcs_wr_3para sunxi_lcd_dsi_dcs_write_3para
  13. #define dsi_dcs_wr_4para sunxi_lcd_dsi_dcs_write_4para
  14. #define dsi_dcs_wr_5para sunxi_lcd_dsi_dcs_write_5para
  15. #define delayms sunxi_lcd_delay_ms
  16. #define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 0, val)
  17. #define power_en(val) sunxi_lcd_gpio_set_value(sel, 1, val)
  18. #define REGFLAG_DELAY 0xFE
  19. #define REGFLAG_END_OF_TABLE 0xFD // END OF REGISTERS MARKER
  20. struct LCM_setting_table {
  21. unsigned cmd;
  22. unsigned char count;
  23. unsigned char para_list[64];
  24. };
  25. static struct LCM_setting_table lcm_initialization_setting[] = {
  26. //Page0
  27. {0xFF, 3, {0x98, 0x81, 0x03} },
  28. {0x01, 1, {0x00}},
  29. {0x02, 1, {0x00}},
  30. {0x03, 1, {0x53}},
  31. {0x04, 1, {0x53}},
  32. {0x05, 1, {0x13}},
  33. {0x06, 1, {0x04}},
  34. {0x07, 1, {0x02}},
  35. {0x08, 1, {0x02}},
  36. {0x09, 1,{0x00}},
  37. {0x0A, 1,{0x00}},
  38. {0x0B, 1,{0x00}},
  39. {0x0C, 1,{0x00}},
  40. {0x0D, 1,{0x00}},
  41. {0x0E, 1,{0x00}},
  42. {0x0F, 1,{0x00}},
  43. {0x10, 1,{0x00}},
  44. {0x11, 1,{0x00}},
  45. {0x12, 1,{0x00}},
  46. {0x13, 1,{0x00}},
  47. {0x14, 1,{0x00}},
  48. {0x15, 1,{0x00}},
  49. {0x16, 1,{0x00}},
  50. {0x17, 1,{0x00}},
  51. {0x18, 1,{0x00}},
  52. {0x19, 1,{0x00}},
  53. {0x1A, 1,{0x00}},
  54. {0x1B, 1,{0x00}},
  55. {0x1C, 1,{0x00}},
  56. {0x1D, 1,{0x00}},
  57. {0x1E, 1,{0xc0}},
  58. {0x1F, 1,{0x00}},
  59. {0x20, 1,{0x02}},
  60. {0x21, 1,{0x09}},
  61. {0x22, 1,{0x00}},
  62. {0x23, 1,{0x00}},
  63. {0x24, 1,{0x00}},
  64. {0x25, 1,{0x00}},
  65. {0x26, 1,{0x00}},
  66. {0x27, 1,{0x00}},
  67. {0x28, 1,{0x55}},
  68. {0x29, 1,{0x03}},
  69. {0x2A, 1,{0x00}},
  70. {0x2B, 1,{0x00}},
  71. {0x2C, 1,{0x00}},
  72. {0x2D, 1,{0x00}},
  73. {0x2E, 1,{0x00}},
  74. {0x2F, 1,{0x00}},
  75. {0x30, 1,{0x00}},
  76. {0x31, 1,{0x00}},
  77. {0x32, 1,{0x00}},
  78. {0x33, 1,{0x00}},
  79. {0x34, 1,{0x00}}, // GPWR1/2 non overlap time 2.62us
  80. {0x35, 1,{0x00}},
  81. {0x36, 1,{0x00}},
  82. {0x37, 1,{0x00}},
  83. {0x38, 1,{0x3c}},
  84. {0x39, 1,{0x00}},
  85. {0x3A, 1,{0x00}},
  86. {0x3B, 1,{0x00}},
  87. {0x3C, 1,{0x00}},
  88. {0x3D, 1,{0x00}},
  89. {0x3E, 1,{0x00}},
  90. {0x3F, 1,{0x00}},
  91. {0x40, 1,{0x00}},
  92. {0x41, 1,{0x00}},
  93. {0x42, 1,{0x00}},
  94. {0x43, 1,{0x00}},
  95. {0x44, 1,{0x00}},
  96. //{0x45, 1,{0x00}},
  97. {0x50, 1, {0x01} },
  98. {0x51, 1, {0x23} },
  99. {0x52, 1, {0x45} },
  100. {0x53, 1, {0x67} },
  101. {0x54, 1, {0x89} },
  102. {0x55, 1, {0xAB} },
  103. {0x56, 1, {0x01} },
  104. {0x57, 1, {0x23} },
  105. {0x58, 1, {0x45} },
  106. {0x59, 1, {0x67} },
  107. {0x5A, 1, {0x89} },
  108. {0x5B, 1, {0xAB} },
  109. {0x5C, 1, {0xCD} },
  110. {0x5D, 1, {0xEF} },
  111. {0x5E, 1, {0x01} },
  112. {0x5F, 1, {0x0A} },
  113. {0x60, 1, {0x02} },
  114. {0x61, 1, {0x02} },
  115. {0x62, 1, {0x08} },
  116. {0x63, 1, {0x15} },
  117. {0x64, 1, {0x14} },
  118. {0x65, 1, {0x02} },
  119. {0x66, 1, {0x11} },
  120. {0x67, 1, {0x10} },
  121. {0x68, 1, {0x02} },
  122. {0x69, 1, {0x0F} },
  123. {0x6A, 1, {0x0E} },
  124. {0x6B, 1, {0x02} },
  125. {0x6C, 1, {0x0D} },
  126. {0x6D, 1, {0x0C} },
  127. {0x6E, 1, {0x06} },
  128. {0x6F, 1, {0x02} },
  129. {0x70, 1, {0x02} },
  130. {0x71, 1, {0x02} },
  131. {0x72, 1, {0x02} },
  132. {0x73, 1, {0x02} },
  133. {0x74, 1, {0x02} },
  134. {0x75, 1, {0x0A} },
  135. {0x76, 1, {0x02} },
  136. {0x77, 1, {0x02} },
  137. {0x78, 1, {0x06} },
  138. {0x79, 1, {0x15} },
  139. {0x7A, 1, {0x14} },
  140. {0x7B, 1, {0x02} },
  141. {0x7C, 1, {0x10} },
  142. {0x7D, 1, {0x11} },
  143. {0x7E, 1, {0x02} },
  144. {0x7F, 1, {0x0C} },
  145. {0x80, 1, {0x0D} },
  146. {0x81, 1, {0x02} },
  147. {0x82, 1, {0x0E} },
  148. {0x83, 1, {0x0F} },
  149. {0x84, 1, {0x08} },
  150. {0x85, 1, {0x02} },
  151. {0x86, 1, {0x02} },
  152. {0x87, 1, {0x02} },
  153. {0x88, 1, {0x02} },
  154. {0x89, 1, {0x02} },
  155. {0x8A, 1, {0x02} },
  156. //Page 4 command;
  157. {0xFF, 3,{0x98,0x81,0x04}},
  158. // {0x00, 1,{0x00}},//3L
  159. {0x3B, 1,{0xC0}}, // ILI4003D sel
  160. {0x6C, 1,{0x15}}, //Set VCORE voltage =1.5V
  161. {0x6E, 1,{0x30}}, //2A di_pwr_reg=0 for power mode 2A //VGH clamp 18V
  162. {0x6F, 1,{0x55}}, //45 //pumping ratio VGH=5x VGL=-3x
  163. {0x3A, 1,{0x24}},
  164. {0x8D, 1, {0x1F} },
  165. {0x87, 1, {0xBA} },
  166. //{0x3A, 1, {0x24} },
  167. {0x26, 1,{0x76}},
  168. {0xB2, 1,{0xD1}},
  169. {0xB5, 1,{0x07}},
  170. {0x35, 1,{0x1F}},
  171. {0x88, 1,{0x0B}},
  172. {0x21, 1,{0x30}},
  173. //TEST
  174. // {0x2D, 1,{0xFF}},
  175. // {0x2F, 1,{0x01}},
  176. // Page 1 command
  177. {0xFF, 3,{0x98,0x81,0x01}},
  178. {0x22, 1,{0x0A}}, //BGR, SS
  179. // {0x53, 1,{0x40}},
  180. // {0x55, 1,{0x40}},
  181. {0x31, 1,{0x09}}, //Zigzag type3 inversion
  182. {0x40, 1,{0x33}}, // ILI4003D sel
  183. // {0x43, 1,{0x66}},
  184. {0x53, 1,{0x37}},//4C
  185. {0x55, 1, {0x38} },
  186. {0x50, 1, {0x95} },
  187. {0x51, 1, {0x95} },
  188. {0x60, 1, {0x30} },
  189. // {0x61, 1, {0x01} },
  190. // {0x62, 1, {0x0C} },
  191. // {0x63, 1, {0x00} },
  192. {0xA0, 1, {0x0f} },
  193. {0xA1, 1, {0x17} },
  194. {0xA2, 1, {0x22} },
  195. {0xA3, 1, {0x19} },
  196. {0xA4, 1, {0x15} },
  197. {0xA5, 1, {0x28} },
  198. {0xA6, 1, {0x1c} },
  199. {0xA7, 1, {0x1c} },
  200. {0xA8, 1, {0x78} },
  201. {0xA9, 1, {0x1c} },
  202. {0xAA, 1, {0x28} },
  203. {0xAB, 1, {0x69} },
  204. {0xAC, 1, {0x1a} },
  205. {0xAD, 1, {0x19}}, //VP36
  206. {0xAE, 1, {0x4B}}, //VP24
  207. {0xAF, 1, {0x22} },
  208. {0xB0, 1, {0x2a} },
  209. {0xB1, 1, {0x4b} },
  210. {0xB2, 1, {0x6b} },
  211. {0xB3, 1, {0x3F} },
  212. {0xC0, 1, {0x01} },
  213. {0xC1, 1, {0x17} },
  214. {0xC2, 1, {0x22} },
  215. {0xC3, 1, {0x19} },
  216. {0xC4, 1, {0x15} },
  217. {0xC5, 1, {0x28} },
  218. {0xC6, 1, {0x1c} },
  219. {0xC7, 1, {0x1D} },
  220. {0xC8, 1, {0x78} },
  221. {0xC9, 1, {0x1c} },
  222. {0xCA, 1, {0x28} },
  223. {0xCB, 1, {0x69} },
  224. {0xCC, 1, {0x1a} },
  225. {0xCD, 1, {0x19}}, //VN36
  226. {0xCE, 1, {0x4B}}, //VN24
  227. {0xCF, 1, {0x22}}, //VN16
  228. {0xD0, 1, {0x2a}}, //VN12
  229. {0xD1, 1, {0x4b}}, //VN8
  230. {0xD2, 1, {0x6b}}, //VN4
  231. {0xD3, 1, {0x3F}}, //VN0
  232. // Page 0 command
  233. {0xFF,3,{0x98,0x81,0x00}},
  234. //{0x35,1,{0x00}}, // TE On
  235. //{0x36,1,{0x03}},
  236. {0x11,0,{0x00}}, // Sleep Out
  237. {REGFLAG_DELAY, 130, {}},
  238. {0x29,0,{0x00}}, // Display On
  239. {REGFLAG_DELAY, 30, {}},
  240. {REGFLAG_END_OF_TABLE, 0x00, {}}
  241. };
  242. static void LCD_cfg_panel_info(panel_extend_para * info)
  243. {
  244. u32 i = 0, j=0;
  245. u32 items;
  246. u8 lcd_gamma_tbl[][2] =
  247. {
  248. //{input value, corrected value}
  249. {0, 0},
  250. {15, 15},
  251. {30, 30},
  252. {45, 45},
  253. {60, 60},
  254. {75, 75},
  255. {90, 90},
  256. {105, 105},
  257. {120, 120},
  258. {135, 135},
  259. {150, 150},
  260. {165, 165},
  261. {180, 180},
  262. {195, 195},
  263. {210, 210},
  264. {225, 225},
  265. {240, 240},
  266. {255, 255},
  267. };
  268. u32 lcd_cmap_tbl[2][3][4] = {
  269. {
  270. {LCD_CMAP_G0,LCD_CMAP_B1,LCD_CMAP_G2,LCD_CMAP_B3},
  271. {LCD_CMAP_B0,LCD_CMAP_R1,LCD_CMAP_B2,LCD_CMAP_R3},
  272. {LCD_CMAP_R0,LCD_CMAP_G1,LCD_CMAP_R2,LCD_CMAP_G3},
  273. },
  274. {
  275. {LCD_CMAP_B3,LCD_CMAP_G2,LCD_CMAP_B1,LCD_CMAP_G0},
  276. {LCD_CMAP_R3,LCD_CMAP_B2,LCD_CMAP_R1,LCD_CMAP_B0},
  277. {LCD_CMAP_G3,LCD_CMAP_R2,LCD_CMAP_G1,LCD_CMAP_R0},
  278. },
  279. };
  280. items = sizeof(lcd_gamma_tbl)/2;
  281. for (i=0; i<items-1; i++) {
  282. u32 num = lcd_gamma_tbl[i+1][0] - lcd_gamma_tbl[i][0];
  283. for (j=0; j<num; j++) {
  284. u32 value = 0;
  285. value = lcd_gamma_tbl[i][1] + ((lcd_gamma_tbl[i+1][1] - lcd_gamma_tbl[i][1]) * j)/num;
  286. info->lcd_gamma_tbl[lcd_gamma_tbl[i][0] + j] = (value<<16) + (value<<8) + value;
  287. }
  288. }
  289. info->lcd_gamma_tbl[255] = (lcd_gamma_tbl[items-1][1]<<16) + (lcd_gamma_tbl[items-1][1]<<8) + lcd_gamma_tbl[items-1][1];
  290. memcpy(info->lcd_cmap_tbl, lcd_cmap_tbl, sizeof(lcd_cmap_tbl));
  291. printf("[disp]lcd720:%s\r\n",__func__);
  292. }
  293. static s32 LCD_open_flow(u32 sel)
  294. {
  295. printf("[disp]lcd720:%s\r\n",__func__);
  296. LCD_OPEN_FUNC(sel, LCD_power_on, 120); //open lcd power, and delay 50ms
  297. LCD_OPEN_FUNC(sel, LCD_panel_init, 1); //open lcd power, than delay 200ms
  298. LCD_OPEN_FUNC(sel, sunxi_lcd_tcon_enable, 5); //open lcd controller, and delay 100ms
  299. LCD_OPEN_FUNC(sel, LCD_bl_open, 0); //open lcd backlight, and delay 0ms
  300. return 0;
  301. }
  302. static s32 LCD_close_flow(u32 sel)
  303. {
  304. printf("[disp]lcd720:%s\r\n",__func__);
  305. LCD_CLOSE_FUNC(sel, LCD_bl_close, 0); //close lcd backlight, and delay 0ms
  306. LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 1); //close lcd controller, and delay 0ms
  307. LCD_CLOSE_FUNC(sel, LCD_panel_exit, 10); //open lcd power, than delay 200ms
  308. LCD_CLOSE_FUNC(sel, LCD_power_off, 0); //close lcd power, and delay 500ms
  309. return 0;
  310. }
  311. static void LCD_power_on(u32 sel)
  312. {
  313. /* set lcd-rst to 0 */
  314. panel_reset(0);
  315. /* vcc18-lcd */
  316. sunxi_lcd_power_enable(sel, 0);
  317. sunxi_lcd_delay_ms(50);
  318. /* vcc33-lcd */
  319. sunxi_lcd_power_enable(sel, 1);
  320. sunxi_lcd_delay_ms(100);
  321. sunxi_lcd_pin_cfg(sel, 1);
  322. sunxi_lcd_delay_ms(20);
  323. panel_reset(1);
  324. sunxi_lcd_delay_ms(50);
  325. panel_reset(0);
  326. sunxi_lcd_delay_ms(35);
  327. panel_reset(1);
  328. sunxi_lcd_delay_ms(50);
  329. }
  330. static void LCD_power_off(u32 sel)
  331. {
  332. printf("[disp]lcd720:%s\r\n",__func__);
  333. sunxi_lcd_delay_ms(20);
  334. panel_reset(0);
  335. sunxi_lcd_delay_ms(5);
  336. power_en(0);
  337. sunxi_lcd_delay_ms(10);
  338. sunxi_lcd_power_disable(sel, 1);
  339. sunxi_lcd_delay_ms(5);
  340. sunxi_lcd_power_disable(sel, 0);
  341. sunxi_lcd_pin_cfg(sel, 0);
  342. }
  343. static void LCD_bl_open(u32 sel)
  344. {
  345. printf("[disp]lcd720:%s\r\n",__func__);
  346. sunxi_lcd_backlight_enable(sel);//config lcd_bl_en pin to open lcd backlight
  347. sunxi_lcd_pwm_enable(sel);
  348. }
  349. static void LCD_bl_close(u32 sel)
  350. {
  351. printf("[disp]lcd720:%s\r\n",__func__);
  352. sunxi_lcd_backlight_disable(sel);//config lcd_bl_en pin to close lcd backlight
  353. }
  354. static void LCD_panel_init(u32 sel)
  355. {
  356. u32 i = 0;
  357. printf("[disp]lcd720:%s\r\n",__func__);
  358. sunxi_lcd_dsi_clk_enable(sel);
  359. sunxi_lcd_delay_ms(10);
  360. //sunxi_lcd_pin_cfg(sel, 1);
  361. //sunxi_lcd_delay_ms(20);
  362. //panel_reset(1);
  363. //sunxi_lcd_delay_ms(50);
  364. //panel_reset(0);
  365. //sunxi_lcd_delay_ms(35);
  366. //panel_reset(1);
  367. //sunxi_lcd_delay_ms(50);
  368. for (i = 0;; i++) {
  369. if (lcm_initialization_setting[i].cmd == REGFLAG_END_OF_TABLE)
  370. break;
  371. else if (lcm_initialization_setting[i].cmd == REGFLAG_DELAY)
  372. sunxi_lcd_delay_ms(lcm_initialization_setting[i].count);
  373. else {
  374. dsi_dcs_wr(0, lcm_initialization_setting[i].cmd,
  375. lcm_initialization_setting[i].para_list,
  376. lcm_initialization_setting[i].count);
  377. }
  378. }
  379. //sunxi_lcd_dsi_clk_enable(sel);
  380. //sunxi_lcd_delay_ms(10);
  381. return;
  382. }
  383. static void LCD_panel_exit(u32 sel)
  384. {
  385. printf("[disp]lcd720:%s\r\n",__func__);
  386. sunxi_lcd_dsi_dcs_write_0para(sel,DSI_DCS_SET_DISPLAY_OFF);
  387. sunxi_lcd_delay_ms(50);
  388. sunxi_lcd_dsi_dcs_write_0para(sel,DSI_DCS_ENTER_SLEEP_MODE);
  389. sunxi_lcd_delay_ms(20);
  390. return ;
  391. }
  392. //sel: 0:lcd0; 1:lcd1
  393. static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3)
  394. {
  395. printf("[disp]lcd720:%s\r\n",__func__);
  396. return 0;
  397. }
  398. __lcd_panel_t tft720x1280_panel = {
  399. /* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */
  400. .name = "tft720x1280",
  401. .func = {
  402. .cfg_panel_info = LCD_cfg_panel_info,
  403. .cfg_open_flow = LCD_open_flow,
  404. .cfg_close_flow = LCD_close_flow,
  405. .lcd_user_defined_func = LCD_user_defined_func,
  406. },
  407. };

第四步  配置触摸

  1. [ctp]
  2. compatible = "allwinner,sun50i-ctp-para"
  3. ctp_used = 1
  4. ctp_name = "gt9xx_ts" ;根据使用触摸芯片选择对应驱动,我这里用的是gt927
  5. ctp_twi_id = 4 ;根据原理图确认使用的那组twi,我这里用的twi4
  6. ctp_twi_addr = 0x14
  7. ctp_screen_max_x = 800 ;根据屏幕手册填写
  8. ctp_screen_max_y = 1280 ;根据屏幕手册填写
  9. ctp_touch_panel_max_x = 800
  10. ctp_touch_panel_max_y = 480
  11. ctp_revert_x_flag = 0
  12. ctp_revert_y_flag = 0
  13. ctp_exchange_x_y_flag = 0
  14. ctp_power_ldo = "vcc-ctp"
  15. ctp_power_ldo_vol = 3300
  16. ctp_int_port = port:PH09<6><default><default><default> ;根据原理图和全志硬件手册进行填写
  17. ctp_wakeup = port:PH10<1><default><default><0> ;根据原理图和全志硬件手册进行填写
  18. [ctp_list]
  19. compatible = "allwinner,sun50i-ctp-list"
  20. ctp_list_used = 1 ;使用ctp list
  21. ;ft5x_ts = 1
  22. ;gt82x = 1
  23. gt9xx_ts = 1 ;对应驱动使能
  24. ;根据原理图和全志硬件手册进行填写
  25. [twi4]
  26. twi4_used = 1
  27. twi4_scl = port:PI2<3><default><default><default>
  28. twi4_sda = port:PI3<3><default><default><default>

第五步 其他说明或调试方法

1.查看显示信息

这是vsync 中断的次数,每加1 都代表刷新了一帧,正常来说是一秒60(期望的fps)次,重复cat sys,如果无变化,则异常。

这个里面的irq、vsync等信息,正常情况下是会一直变化的,如果一直不动,就要检查fex中的相关配置参数是否正确,我这边就是因为lcd_dsi_if参数配置错误,irq等信息都不会变化,现象就是一直黑屏,背光亮。

2.查看电源信息

可确认屏幕电源与触屏电源是否存在

3.设置默认横屏或者竖屏

方式一(可行)

vim device/softwinner/a40-OKA40i_C/a40_OKA40i_C.mk

PRODUCT_PROPERTY_OVERRIDES += \

    ro.sf.lcd_density=160 \

    ro.display.sdcard=1 \

    ro.part.sdcard=1 \

    ro.sf.rotation=90     //增加角度来旋转

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/330299
推荐阅读
相关标签
  

闽ICP备14008679号