D1s i80 接 ST7789V uboot有显示进入 Linux 没显示黑屏了
-
D1s i80 接 ST7789V uboot有显示进入 Linux 没显示黑屏了
设备树这样配置的
&disp { disp_init_enable = <1>; disp_mode = <0>; screen0_output_type = <1>; screen0_output_mode = <4>; screen1_output_type = <3>; screen1_output_mode = <4>; screen1_output_format = <0>; screen1_output_bits = <0>; screen1_output_eotf = <4>; screen1_output_cs = <257>; screen1_output_dvi_hdmi = <2>; screen1_output_range = <2>; screen1_output_scan = <0>; screen1_output_aspect_ratio = <8>; dev0_output_type = <1>; dev0_output_mode = <4>; dev0_screen_id = <0>; dev0_do_hpd = <0>; dev1_output_type = <4>; dev1_output_mode = <10>; dev1_screen_id = <1>; dev1_do_hpd = <1>; def_output_dev = <0>; hdmi_mode_check = <1>; disp_rotation_used = <1>; degree0 = <0>; fb0_format = <0>; fb0_buffer_num = <1>; /*fb0_width = <800>;*/ /*fb0_height = <480>;*/ /*read from lcd*/ fb1_format = <0>; fb1_width = <0>; fb1_height = <0>; chn_cfg_mode = <1>; disp_para_zone = <1>; /*VCC-LCD*/ /* dc1sw-supply = <®_dc1sw>;*/ /*VCC-DSI*/ /* eldo3-supply = <®_eldo3>;*/ /*VCC-PD*/ /* dcdc1-supply = <®_dcdc1>;*/ }; &lcd0 { lcd_used = <1>; lcd_driver_name = "st7789v_cpu2"; /* part 2 */ lcd_if = <1>; lcd_cpu_if = <8>; /* part 3 */ lcd_width = <23>; lcd_height = <43>; lcd_x = <320>; lcd_y = <240>; lcd_dclk_freq = <6>; lcd_hbp = <34>; lcd_ht = <384>; lcd_hspw = <10>; lcd_vbp = <14>; lcd_vt = <260>; lcd_vspw = <4>; /* part 4 */ lcd_backlight = <50>; lcd_pwm_used = <1>; lcd_pwm_ch = <7>; lcd_pwm_freq = <20000>; lcd_pwm_pol = <1>; lcd_bright_curve_en = <1>; /* part 5 */ lcd_cpu_mode= <1>; lcd_cpu_te= <0>; lcd_frm = <1>; lcd_gamma_en = <0>; lcd_cmap_en = <0>; /* part 6 */ lcd_gpio_0 = <&pio PD 0 GPIO_ACTIVE_LOW>; pinctrl-0 = <&cpu16_pins_a>; pinctrl-1 = <&cpu16_pins_b>; };
驱动
/* * Copyright (c) 2021 Allwinnertech Co., Ltd. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include "st7789v_cpu2.h" 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_init(u32 sel); static void lcd_panel_exit(u32 sel); #define panel_reset(sel, val) sunxi_lcd_gpio_set_value(sel, 0, val) static void lcd_cfg_panel_info(struct panel_extend_para *info) { u32 i = 0, j = 0; u32 items; u8 lcd_gamma_tbl[][2] = { {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) { LCD_OPEN_FUNC(sel, lcd_power_on, 10); LCD_OPEN_FUNC(sel, lcd_panel_init, 10); LCD_OPEN_FUNC(sel, sunxi_lcd_tcon_enable, 50); LCD_OPEN_FUNC(sel, lcd_bl_open, 0); return 0; } static s32 lcd_close_flow(u32 sel) { LCD_CLOSE_FUNC(sel, lcd_bl_close, 0); LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 0); LCD_CLOSE_FUNC(sel, lcd_panel_exit, 200); LCD_CLOSE_FUNC(sel, lcd_power_off, 500); return 0; } static void lcd_power_on(u32 sel) { panel_reset(sel, 1); sunxi_lcd_delay_ms(100); panel_reset(sel, 0); sunxi_lcd_delay_ms(20); panel_reset(sel, 1); sunxi_lcd_delay_ms(100); sunxi_lcd_pin_cfg(sel, 1); } static void lcd_power_off(u32 sel) { sunxi_lcd_pin_cfg(sel, 0); sunxi_lcd_delay_ms(20); panel_reset(sel, 0); sunxi_lcd_delay_ms(5); } static void lcd_bl_open(u32 sel) { sunxi_lcd_pwm_enable(sel); } static void lcd_bl_close(u32 sel) { sunxi_lcd_pwm_disable(sel); } static void lcd_panel_init(u32 sel) { sunxi_lcd_cpu_write_index(sel, 0xbb); sunxi_lcd_cpu_write_data(sel, 0x1e); sunxi_lcd_cpu_write_index(sel, 0xc0); sunxi_lcd_cpu_write_data(sel, 0x2c); sunxi_lcd_cpu_write_index(sel, 0xc2); sunxi_lcd_cpu_write_data(sel, 0x01); sunxi_lcd_cpu_write_index(sel, 0xc3); sunxi_lcd_cpu_write_data(sel, 0x0b); sunxi_lcd_cpu_write_index(sel, 0xc4); sunxi_lcd_cpu_write_data(sel, 0x20); //sunxi_lcd_cpu_write_index(sel, 0xc6);// frame rate control //sunxi_lcd_cpu_write_data(sel, 0x04); sunxi_lcd_cpu_write_index(sel, 0xd0); sunxi_lcd_cpu_write_data(sel, 0xa4); sunxi_lcd_cpu_write_data(sel, 0xa1); sunxi_lcd_cpu_write_index(sel, 0xd6); sunxi_lcd_cpu_write_data(sel, 0xa1); sunxi_lcd_cpu_write_index(sel, 0xbb); sunxi_lcd_cpu_write_data(sel, 0x1a); #endif /*ST7789V gamma setting */ sunxi_lcd_cpu_write_index(sel, 0xe0); sunxi_lcd_cpu_write_data(sel, 0xd0); sunxi_lcd_cpu_write_data(sel, 0x06); sunxi_lcd_cpu_write_data(sel, 0x0b); sunxi_lcd_cpu_write_data(sel, 0x07); sunxi_lcd_cpu_write_data(sel, 0x07); sunxi_lcd_cpu_write_data(sel, 0x24); sunxi_lcd_cpu_write_data(sel, 0x2e); sunxi_lcd_cpu_write_data(sel, 0x32); sunxi_lcd_cpu_write_data(sel, 0x46); sunxi_lcd_cpu_write_data(sel, 0x37); sunxi_lcd_cpu_write_data(sel, 0x13); sunxi_lcd_cpu_write_data(sel, 0x13); sunxi_lcd_cpu_write_data(sel, 0x2d); sunxi_lcd_cpu_write_data(sel, 0x33); sunxi_lcd_cpu_write_index(sel, 0xe1); sunxi_lcd_cpu_write_data(sel, 0xd0); sunxi_lcd_cpu_write_data(sel, 0x02); sunxi_lcd_cpu_write_data(sel, 0x06); sunxi_lcd_cpu_write_data(sel, 0x09); sunxi_lcd_cpu_write_data(sel, 0x08); sunxi_lcd_cpu_write_data(sel, 0x05); sunxi_lcd_cpu_write_data(sel, 0x29); sunxi_lcd_cpu_write_data(sel, 0x44); sunxi_lcd_cpu_write_data(sel, 0x42); sunxi_lcd_cpu_write_data(sel, 0x38); sunxi_lcd_cpu_write_data(sel, 0x14); sunxi_lcd_cpu_write_data(sel, 0x14); sunxi_lcd_cpu_write_data(sel, 0x2a); sunxi_lcd_cpu_write_data(sel, 0x30); sunxi_lcd_cpu_write_index(sel, 0x21); sunxi_lcd_cpu_write_index(sel, 0x11);//sleep out sunxi_lcd_delay_ms(120); sunxi_lcd_cpu_write_index(sel, 0x36);//data access control sunxi_lcd_cpu_write_data(sel, 0xb0); sunxi_lcd_cpu_write_index(sel, 0x2a);// column address set sunxi_lcd_cpu_write_data(sel, 0x00); sunxi_lcd_cpu_write_data(sel, 0x00); sunxi_lcd_cpu_write_data(sel, 0x01); sunxi_lcd_cpu_write_data(sel, 0x3f); sunxi_lcd_cpu_write_index(sel, 0x2b);// row address set sunxi_lcd_cpu_write_data(sel, 0x00); sunxi_lcd_cpu_write_data(sel, 0x00); sunxi_lcd_cpu_write_data(sel, 0x00); sunxi_lcd_cpu_write_data(sel, 0xef); sunxi_lcd_cpu_write_index(sel, 0x3a);// cpu mode sunxi_lcd_cpu_write_data(sel, 0x55); sunxi_lcd_cpu_write_index(sel, 0x29);//display on sunxi_lcd_cpu_write_index(sel, 0x2c);//memory write printk(KERN_ERR "st7789v3 init over!"); } static void lcd_panel_exit(u32 sel) { //sunxi_lcd_dsi_dcs_write_0para(sel, 0x10); sunxi_lcd_delay_ms(80); //sunxi_lcd_dsi_dcs_write_0para(sel, 0x28); sunxi_lcd_delay_ms(50); } /*sel: 0:lcd0; 1:lcd1*/ static s32 lcd_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3) { return 0; } struct __lcd_panel st7789v_cpu2_panel = { /* panel driver name, must mach the name of * lcd_drv_name in sys_config.fex */ .name = "st7789v_cpu2", .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, }, };
-
@awwwwa 在 D1s i80 接 ST7789V uboot有显示进入 Linux 没显示黑屏了 中说:
lcd_gpio_0 = <&pio PD 0 GPIO_ACTIVE_LOW>;
配置成 lcd_gpio_0 = <&pio PD 0 GPIO_ACTIVE_HIGH>; 解决,Uboot 初始化后又拉低了rst脚
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号