SongTao 发布的最新帖子
-
回复: 【已解决】D1s 调试 MIPI LCD 不亮
@wyljkl 在 【已解决】D1s 调试 MIPI LCD 不亮 中说:
现在uboot部分都没有进入到LCD_open_flow 这个函数中,对比了驱动文件和设备树的名字也是一一致的:
驱动:
/* * drivers/video/sunxi/disp2/disp/lcd/K080_IM2HYL802R_800X1280.c * * Copyright (c) 2007-2018 Allwinnertech Co., Ltd. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "K080_IM2HYL802R_800X1280.h" //#include <mach/sys_config.h> #include "panels.h" /* &lcd0 { lcd_used = <1>; status = "okay"; lcd_driver_name = "K080_IM2HYL802R_800X1280"; lcd_backlight = <50>; lcd_if = <4>; lcd_x = <800>; lcd_y = <1280>; lcd_width = <135>; lcd_height = <216>; lcd_dclk_freq = <75>; lcd_pwm_used = <1>; lcd_pwm_ch = <0>; lcd_pwm_freq = <50000>; lcd_pwm_pol = <1>; lcd_pwm_max_limit = <255>; lcd_hbp = <88>; lcd_ht = <960>; lcd_hspw = <4>; lcd_vbp = <12>; lcd_vt = <1300>; lcd_vspw = <4>; lcd_frm = <0>; lcd_gamma_en = <0>; lcd_bright_curve_en = <0>; lcd_cmap_en = <0>; deu_mode = <0>; lcdgamma4iep = <22>; smart_color = <90>; lcd_dsi_if = <0>; lcd_dsi_lane = <4>; lcd_dsi_format = <0>; lcd_dsi_te = <0>; lcd_dsi_eotp = <0>; lcd_pin_power = "dcdc1"; lcd_pin_power1 = "eldo3"; lcd_power = "eldo3"; lcd_power1 = "dcdc1"; lcd_power2 = "dc1sw"; lcd_gpio_1 = <&pio PD 22 1 0 3 1>; pinctrl-0 = <&dsi4lane_pins_a>; pinctrl-1 = <&dsi4lane_pins_b>; lcd_bl_en = <&pio PB 8 1 0 3 1>; lcd_bl_0_percent = <15>; lcd_bl_100_percent = <100>; }; */ extern s32 bsp_disp_get_panel_info(u32 screen_id, disp_panel_para *info); static void LCD_power_on(u32 sel); static void LCD_power_off(u32 sel); static void LCD_bl_open(u32 sel); static void LCD_bl_close(u32 sel); //static void LCD_panel_try_switch(u32 sel); static void LCD_panel_init(u32 sel); static void LCD_panel_exit(u32 sel); //static u8 const mipi_dcs_pixel_format[4] = {0x77,0x66,0x66,0x55}; #define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 1, val) #define power_en(val) sunxi_lcd_gpio_set_value(sel, 0, val) static void LCD_cfg_panel_info(panel_extend_para *info) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); u32 i = 0, j = 0; u32 items; u8 lcd_gamma_tbl[][2] = { //{input value, corrected value} {0, 0}, {15, 15}, {30, 30}, {45, 45}, {60, 60}, {75, 75}, {90, 90}, {105, 105}, {120, 120}, {135, 135}, {150, 150}, {165, 165}, {180, 180}, {195, 195}, {210, 210}, {225, 225}, {240, 240}, {255, 255}, }; u32 lcd_cmap_tbl[2][3][4] = { { {LCD_CMAP_G0, LCD_CMAP_B1, LCD_CMAP_G2, LCD_CMAP_B3}, {LCD_CMAP_B0, LCD_CMAP_R1, LCD_CMAP_B2, LCD_CMAP_R3}, {LCD_CMAP_R0, LCD_CMAP_G1, LCD_CMAP_R2, LCD_CMAP_G3}, }, { {LCD_CMAP_B3, LCD_CMAP_G2, LCD_CMAP_B1, LCD_CMAP_G0}, {LCD_CMAP_R3, LCD_CMAP_B2, LCD_CMAP_R1, LCD_CMAP_B0}, {LCD_CMAP_G3, LCD_CMAP_R2, LCD_CMAP_G1, LCD_CMAP_R0}, }, }; items = sizeof(lcd_gamma_tbl) / 2; for (i = 0; i < items - 1; i++) { u32 num = lcd_gamma_tbl[i + 1][0] - lcd_gamma_tbl[i][0]; for (j = 0; j < num; j++) { u32 value = 0; value = lcd_gamma_tbl[i][1] + ((lcd_gamma_tbl[i + 1][1] - lcd_gamma_tbl[i][1]) * j) / num; info->lcd_gamma_tbl[lcd_gamma_tbl[i][0] + j] = (value << 16) + (value << 8) + value; } } 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]; memcpy(info->lcd_cmap_tbl, lcd_cmap_tbl, sizeof(lcd_cmap_tbl)); } static s32 LCD_open_flow(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); LCD_OPEN_FUNC(sel, LCD_power_on, 100); //open lcd power, and delay 50ms LCD_OPEN_FUNC(sel, LCD_panel_init, 200); //open lcd power, than delay 200ms LCD_OPEN_FUNC(sel, sunxi_lcd_tcon_enable, 50); //open lcd controller, and delay 100ms LCD_OPEN_FUNC(sel, LCD_bl_open, 0); //open lcd backlight, and delay 0ms printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); return 0; } static s32 LCD_close_flow(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); LCD_CLOSE_FUNC(sel, LCD_bl_close, 200); //close lcd backlight, and delay 0ms LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 20); //close lcd controller, and delay 0ms LCD_CLOSE_FUNC(sel, LCD_panel_exit, 10); //open lcd power, than delay 200ms LCD_CLOSE_FUNC(sel, LCD_power_off, 500); //close lcd power, and delay 500ms printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); return 0; } static void LCD_power_on(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); panel_reset(0); sunxi_lcd_power_enable(sel, 0);//config lcd_power pin to open lcd power sunxi_lcd_delay_ms(5); sunxi_lcd_power_enable(sel, 1);//config lcd_power pin to open lcd power1 sunxi_lcd_delay_ms(5); sunxi_lcd_power_enable(sel, 2);//config lcd_power pin to open lcd power2 sunxi_lcd_delay_ms(5); power_en(1); sunxi_lcd_delay_ms(20); //panel_reset(1); sunxi_lcd_delay_ms(40); panel_reset(1); //sunxi_lcd_delay_ms(10); //panel_reset(0); //sunxi_lcd_delay_ms(5); //panel_reset(1); sunxi_lcd_delay_ms(120); //sunxi_lcd_delay_ms(5); sunxi_lcd_pin_cfg(sel, 1); printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); } static void LCD_power_off(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); sunxi_lcd_pin_cfg(sel, 0); power_en(0); sunxi_lcd_delay_ms(20); panel_reset(0); sunxi_lcd_delay_ms(5); sunxi_lcd_power_disable(sel, 2);//config lcd_power pin to close lcd power2 sunxi_lcd_delay_ms(5); sunxi_lcd_power_disable(sel, 1);//config lcd_power pin to close lcd power1 sunxi_lcd_delay_ms(5); sunxi_lcd_power_disable(sel, 0);//config lcd_power pin to close lcd power printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); } static void LCD_bl_open(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); sunxi_lcd_pwm_enable(sel); sunxi_lcd_delay_ms(50); sunxi_lcd_backlight_enable(sel);//config lcd_bl_en pin to open lcd backlight printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); } static void LCD_bl_close(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); sunxi_lcd_backlight_disable(sel);//config lcd_bl_en pin to close lcd backlight sunxi_lcd_delay_ms(20); sunxi_lcd_pwm_disable(sel); printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); } #define REGFLAG_DELAY 0XFE #define REGFLAG_END_OF_TABLE 0xFD // END OF REGISTERS MARKER struct LCM_setting_table { u8 cmd; u32 count; u8 para_list[64]; }; /*add panel initialization below*/ static struct LCM_setting_table lcm_initialization_setting[] = { {0x80, 1, {0x65} }, //GIP_1 {0x81, 1, {0x99} }, {0x82, 1, {0x15} }, {0x83, 1, {0xD1} }, //STA Width 4H {0x84, 1, {0x40} }, {0x85, 1, {0xDD} }, //STA Width 4H {0x86, 1, {0xE8} }, //CMD_Page 0 {0xFF, 3, {0x98, 0x81, 0x00} }, //SLP OUT {0x11, 0, {0x00} }, // SLPOUT {REGFLAG_DELAY, REGFLAG_DELAY, {120} }, //DISP ON {0x29, 0, {0x00} }, // DSPON {REGFLAG_DELAY, REGFLAG_DELAY, {5} }, //TE ON {0x35, 0, {0x00} }, // TE {REGFLAG_DELAY, REGFLAG_DELAY, {5} }, {REGFLAG_END_OF_TABLE, REGFLAG_END_OF_TABLE, {} } }; static void LCD_panel_init(u32 sel) { __u32 i; char model_name[25]; printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); disp_sys_script_get_item("lcd0", "lcd_model_name", (int *)model_name, 25); sunxi_lcd_dsi_clk_enable(sel); sunxi_lcd_delay_ms(20); sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SOFT_RESET); sunxi_lcd_delay_ms(10); for (i = 0; ; i++) { if (lcm_initialization_setting[i].count == REGFLAG_END_OF_TABLE) break; else if (lcm_initialization_setting[i].count == REGFLAG_DELAY) sunxi_lcd_delay_ms(lcm_initialization_setting[i].para_list[0]); #ifdef SUPPORT_DSI else dsi_dcs_wr(sel, lcm_initialization_setting[i].cmd, lcm_initialization_setting[i].para_list, lcm_initialization_setting[i].count); #endif //break; } printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); return; } static void LCD_panel_exit(u32 sel) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SET_DISPLAY_OFF); sunxi_lcd_delay_ms(20); sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_ENTER_SLEEP_MODE); sunxi_lcd_delay_ms(80); printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); return ; } //sel: 0:lcd0; 1:lcd1 static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3) { printf("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); return 0; } //sel: 0:lcd0; 1:lcd1 /*static s32 LCD_set_bright(u32 sel, u32 bright) { sunxi_lcd_dsi_dcs_write_1para(sel,0x51,bright); return 0; }*/ __lcd_panel_t K080_IM2HYL802R_800X1280_mipi_panel = { /* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */ .name = "K080_IM2HYL802R_800X1280", .func = { .cfg_panel_info = LCD_cfg_panel_info, .cfg_open_flow = LCD_open_flow, .cfg_close_flow = LCD_close_flow, .lcd_user_defined_func = LCD_user_defined_func, //.set_bright = LCD_set_bright, }, };
设备树:
&lcd0 { lcd_used = <1>; lcd_driver_name = "K080_IM2HYL802R_800X1280"; lcd_backlight = <50>; lcd_if = <4>; /* lcd_x = <1200>; lcd_y = <1920>; */ lcd_x = <1024>; lcd_y = <600>; lcd_width = <135>; lcd_height = <216>; lcd_dclk_freq = <156>; lcd_pwm_used = <0>; lcd_pwm_ch = <7>; lcd_pwm_freq = <50000>; lcd_pwm_pol = <0>; lcd_hbp = <160>; lcd_ht = <1354>; lcd_hspw = <10>; lcd_vbp = <23>; lcd_vt = <636>; lcd_vspw = <1>; lcd_lvds_if = <0>; lcd_lvds_colordepth = <1>; lcd_lvds_mode = <0>; lcd_frm = <0>; lcd_io_phase = <0x0000>; lcd_gamma_en = <0>; lcd_bright_curve_en = <0>; lcd_cmap_en = <0>; deu_mode = <0>; lcdgamma4iep = <22>; smart_color = <90>; lcd_dsi_if = <0>; lcd_dsi_lane = <4>; lcd_dsi_format = <0>; lcd_dsi_eotp = <0>; lcd_dsi_port_num = <0>; /*lcd_gpio_1 = <&pio PB 8 GPIO_ACTIVE_HIGH>;*/ /*lcd_bl_en = <&pio PD 20 GPIO_ACTIVE_HIGH>;*/ pinctrl-0 = <&dsi4lane_pins_a>; pinctrl-1 = <&dsi4lane_pins_b>; };
启动logo:
mtdids : nand0=nand
mtdparts: mtdparts=nand:1024k@0(boot0)ro,3072k@1048576(uboot)ro,1024k@4194304(secure_storage)ro,-(sys)
[00.600]ubi0: attaching mtd4
[00.713]ubi0: scanning is finished
[00.719]ubi0: attached mtd4 (name "sys", size 123 MiB)
[00.724]ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[00.730]ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048
[00.736]ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[00.743]ubi0: good PEBs: 492, bad PEBs: 0, corrupted PEBs: 0
[00.748]ubi0: user volume: 10, internal volumes: 1, max. volumes count: 128
[00.755]ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[00.763]ubi0: available PEBs: 0, total reserved PEBs: 492, PEBs reserved for bad PEB handling: 20
[00.771]sunxi flash init ok
[00.774]line:703 init_clocks
[00.777]drv_disp_init
lcd_x = 1024 drv_disp_check_spec
lcd_y = 600 drv_disp_check_spec
drivers/video/sunxi/disp2/disp/de/disp_display.c 23 bsp_disp_init
drivers/video/sunxi/disp2/disp/de/lowlevel_v2x/disp_al.c 1242 disp_init_al
drivers/video/sunxi/disp2/disp/de/lowlevel_v2x/disp_al.c 1323 disp_init_al
drivers/video/sunxi/disp2/disp/de/disp_lcd.c 2892 disp_init_lcd
drivers/video/sunxi/disp2/disp/de/disp_display.c 65 bsp_disp_init
drivers/video/sunxi/disp2/disp/lcd/panels.c 184 lcd_init
drivers/video/sunxi/disp2/disp/dev_disp.c 720 sunxi_disp_get_source_ops
drivers/video/sunxi/disp2/disp/dev_disp.c 749 sunxi_disp_get_source_ops
drivers/video/sunxi/disp2/disp/lcd/panels.c 174 lcd_set_panel_funs
drivers/video/sunxi/disp2/disp/lcd/panels.c 178 lcd_set_panel_funs
drivers/video/sunxi/disp2/disp/lcd/panels.c 187 lcd_init
[00.856]drv_disp_init finish
[00.975]Loading Environment from SUNXI_FLASH... OK
[00.997]Item0 (Map) magic is bad大佬可以问一下这个问题你解决了吗,我也碰到了无法进入到LCD_open_flow 这个函数的情况,能否指点一下,非常感谢