diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/Makefile b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/Makefile index 6bba952480..142ce6ea93 100755 --- a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/Makefile +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/Makefile @@ -27,7 +27,7 @@ disp-objs += lcd/default_panel.o \ lcd/lt070me05000.o lcd/wtq05027d01.o lcd/t27p06.o \ lcd/dx0960be40a1.o lcd/tft720x1280.o lcd/S6D7AA0X01.o \ lcd/inet_dsi_panel.o lcd/cpu_gg1p4062utsw.o lcd/vr_sharp.o \ - lcd/he0801a068.o lcd/WilliamLcd.o + lcd/he0801a068.o lcd/WilliamLcd.o lcd/S070WV20_MIPI_RGB.o endif endif diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.c b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.c index f2343dc306..0017795a93 100755 --- a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.c +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.c @@ -660,6 +660,7 @@ static void lcd_get_sys_config(u32 disp, disp_lcd_cfg *lcd_cfg) ret = disp_sys_script_get_item(primary_key,"lcd_bl_en", (int *)gpio_info, 3); if (ret == 3) { + lcd_cfg->lcd_bl_hdl = disp_sys_gpio_request(gpio_info, 1); lcd_cfg->lcd_bl_en_used = 1; } @@ -1284,6 +1285,8 @@ s32 disp_lcd_set_bright(struct disp_device *lcd, u32 bright) } smbl = mgr->smbl; + printf("set_bright %d\n", bright); + spin_lock_irqsave(&lcd_data_lock, flags); backlight_bright = (backlight_bright > 255)? 255:backlight_bright; if (lcdp->lcd_cfg.backlight_bright != backlight_bright) { @@ -1506,6 +1509,8 @@ static s32 disp_lcd_post_enable(struct disp_device* lcd) unsigned bl; int ret = 0; + printf("%s\n", __func__); + if ((NULL == lcd) || (NULL == lcdp)) { DE_WRN("NULL hdl!\n"); return DIS_FAIL; @@ -1518,6 +1523,8 @@ static s32 disp_lcd_post_enable(struct disp_device* lcd) bl = disp_lcd_get_bright(lcd); disp_lcd_set_bright(lcd, bl); + disp_sys_gpio_set_value(lcdp->lcd_cfg.lcd_bl_hdl, 1, "lcd_bl_en"); + return ret; } diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.h b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.h index a54d899f82..5eb3202631 100755 --- a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.h +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/de/disp_lcd.h @@ -17,6 +17,7 @@ typedef struct bool lcd_bl_en_used; disp_gpio_set_t lcd_bl_en; + u32 lcd_bl_hdl; char lcd_bl_en_power[LCD_POWER_STR_LEN]; u32 lcd_power_used[LCD_POWER_NUM]; diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c new file mode 100755 index 0000000000..8845670b81 --- /dev/null +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c @@ -0,0 +1,232 @@ +#include "S070WV20_MIPI_RGB.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 Bist_mode (0) + +#define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 0, val) +#define power_en(val) sunxi_lcd_gpio_set_value(sel, 1, val) + +static void LCD_cfg_panel_info(panel_extend_para * info) +{ + 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; ilcd_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("[BPI]LCD_open_flow\n"); + + LCD_OPEN_FUNC(sel, LCD_power_on, 200); //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,500); + LCD_OPEN_FUNC(sel, LCD_bl_open, 0); //open lcd backlight, and delay 0ms + + return 0; +} + +static s32 LCD_close_flow(u32 sel) +{ + printf("[BPI]LCD_close_flow\n"); + LCD_CLOSE_FUNC(sel, LCD_bl_close, 0); //close lcd backlight, and delay 0ms + LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 0); //close lcd controller, and delay 0ms + LCD_CLOSE_FUNC(sel, LCD_panel_exit, 20); //open lcd power, than delay 200ms + LCD_CLOSE_FUNC(sel, LCD_power_off, 50); //close lcd power, and delay 500ms + + return 0; +} + +static void LCD_power_on(u32 sel) +{ + printf("[BPI]LCD_power_on\n"); + sunxi_lcd_pin_cfg(sel, 1); + power_en(0); + sunxi_lcd_delay_ms(10); + sunxi_lcd_power_enable(sel, 0);//config lcd_power pin to open lcd power + sunxi_lcd_delay_ms(10); + sunxi_lcd_power_enable(sel, 1);//config lcd_power pin to open lcd power0 + sunxi_lcd_delay_ms(10); + + power_en(1); + sunxi_lcd_delay_ms(50); + panel_reset(1); + sunxi_lcd_delay_ms(10); + panel_reset(0); + sunxi_lcd_delay_ms(30); + panel_reset(1); + sunxi_lcd_delay_ms(10); + + +} + +static void LCD_power_off(u32 sel) +{ + printf("[BPI]LCD_power_off\n"); + sunxi_lcd_pin_cfg(sel, 0); + sunxi_lcd_delay_ms(10); + power_en(0); + sunxi_lcd_delay_ms(10); + 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 +} + +static void LCD_bl_open(u32 sel) +{ + printf("[BPI]LCD_bl_open\n"); + sunxi_lcd_pwm_enable(sel); + sunxi_lcd_delay_ms(10); + sunxi_lcd_backlight_enable(sel);//config lcd_bl_en pin to open lcd backlight +} + +static void LCD_bl_close(u32 sel) +{ + printf("[BPI]LCD_bl_close\n"); + sunxi_lcd_backlight_disable(sel);//config lcd_bl_en pin to close lcd backlight + sunxi_lcd_pwm_disable(sel); +} + +static void LCD_panel_init(u32 sel) +{ + printf("[BPI]LCD_panel_init\n"); + sunxi_lcd_dsi_gen_write_1para(sel,0x7A,0xC1); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x20,0x20); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x21,0xE0); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x22,0x13); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x23,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x24,0x30); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x25,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x26,0x00); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x27,0x0D); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x28,0x03); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x29,0x1D); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x34,0x80); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x36,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0xB5,0xA0); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x5C,0xFF); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x2A,0x01); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x56,0x92); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x6B,0x71); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x69,0x2B);//2B + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x10,0x40); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x11,0x98); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0xB6,0x20); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x51,0x20); + sunxi_lcd_delay_ms(10); +#if Bist_mode + sunxi_lcd_dsi_gen_write_1para(sel,0x14,0x43); + sunxi_lcd_dsi_gen_write_1para(sel,0x2A,0x49); +#endif + sunxi_lcd_dsi_gen_write_1para(sel,0x09,0x10); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_clk_enable(sel); + + return; +} + +static void LCD_panel_exit(u32 sel) +{ + sunxi_lcd_dsi_clk_disable(sel); + + return ; +} + +//sel: 0:lcd0; 1:lcd1 +static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3) +{ + return 0; +} + +__lcd_panel_t S070WV20_MIPI_RGB_panel = { + /* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */ + .name = "S070WV20_MIPI_RGB", + .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, + }, +}; diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h new file mode 100755 index 0000000000..0af3f0a28d --- /dev/null +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h @@ -0,0 +1,8 @@ +#ifndef __S070WV20_MIPI_RGB_PANEL_H__ +#define __S070WV20_MIPI_RGB_PANEL_H__ + +#include "panels.h" + +extern __lcd_panel_t S070WV20_MIPI_RGB_panel; + +#endif diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.c b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.c index db98a39ff9..d4b3baa027 100755 --- a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.c +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.c @@ -36,6 +36,7 @@ __lcd_panel_t* panel_array[] = { &vr_sharp_panel, &he0801a068_panel, &WilliamLcd_panel, + &S070WV20_MIPI_RGB_panel, #endif #endif /*endif CONFIG_ARCH_SUN50IW3P1 */ /* add new panel below */ diff --git a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.h b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.h old mode 100644 new mode 100755 index 3b41089a29..b364be64ee --- a/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.h +++ b/lichee/brandy/u-boot-2014.07/drivers/video/sunxi/disp2/disp/lcd/panels.h @@ -91,6 +91,7 @@ extern __lcd_panel_t S6D7AA0X01_panel; extern __lcd_panel_t gg1p4062utsw_panel; extern __lcd_panel_t vr_sharp_panel; extern __lcd_panel_t he0801a068_panel; +extern __lcd_panel_t S070WV20_MIPI_RGB_panel; #endif /*endif CONFIG_ARCH_SUN8IW12P1 */ #endif /*endif CONFIG_ARCH_SUN50IW3P1 */ diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile index 98f8d07d90..a87eb9df3c 100644 --- a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile @@ -17,5 +17,6 @@ disp-objs += lcd/panels.o lcd/lcd_source.o lcd/default_panel.o \ lcd/lt070me05000.o lcd/wtq05027d01.o lcd/t27p06.o \ lcd/dx0960be40a1.o lcd/tft720x1280.o lcd/S6D7AA0X01.o \ lcd/default_eink.o lcd/cpu_gg1p4062utsw.o lcd/ls029b3sx02.o \ - lcd/he0801a068.o lcd/inet_dsi_panel.o lcd/lq101r1sx03.o lcd/WilliamLcd.o + lcd/he0801a068.o lcd/inet_dsi_panel.o lcd/lq101r1sx03.o \ + lcd/WilliamLcd.o lcd/S070WV20_MIPI_RGB.o disp-objs += $(obj_low) diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/de/disp_lcd.c b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/de/disp_lcd.c index 33795d739a..b01c275173 100644 --- a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/de/disp_lcd.c +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/de/disp_lcd.c @@ -847,8 +847,7 @@ static s32 disp_lcd_pin_cfg(struct disp_device *lcd, u32 bon) ((!strcmp(lcdp->lcd_cfg.lcd_pin_power[i], "")) || (!strcmp(lcdp->lcd_cfg.lcd_pin_power[i], "none")))) - disp_sys_power_enable(lcdp->lcd_cfg. - lcd_pin_power[i]); + disp_sys_power_enable(lcdp->lcd_cfg.lcd_pin_power[i]); } } @@ -865,8 +864,7 @@ static s32 disp_lcd_pin_cfg(struct disp_device *lcd, u32 bon) ((!strcmp(lcdp->lcd_cfg.lcd_pin_power[i], "")) || (!strcmp(lcdp->lcd_cfg.lcd_pin_power[i], "none")))) - disp_sys_power_disable(lcdp->lcd_cfg. - lcd_pin_power[i]); + disp_sys_power_disable(lcdp->lcd_cfg.lcd_pin_power[i]); } } @@ -1883,6 +1881,8 @@ static s32 disp_lcd_sw_enable(struct disp_device *lcd) struct disp_manager *mgr = NULL; struct disp_gpio_set_t gpio_info[1]; + pr_info("%s\n", __func__); + if ((lcd == NULL) || (lcdp == NULL)) { DE_WRN("NULL hdl!\n"); return DIS_FAIL; @@ -1893,6 +1893,7 @@ static s32 disp_lcd_sw_enable(struct disp_device *lcd) DE_WRN("mgr is NULL!\n"); return DIS_FAIL; } + if (mgr->sw_enable) mgr->sw_enable(mgr); @@ -1903,7 +1904,9 @@ static s32 disp_lcd_sw_enable(struct disp_device *lcd) ret = cal_real_frame_period(lcd); if (ret) DE_WRN("cal_real_frame_period fail:%d\n", ret); - + +/* bpi, vcc-pd and vcc-dsi-3v3 always on, no power control here */ +#if 0 /* init fix power */ for (i = 0; i < LCD_POWER_NUM; i++) { if (lcdp->lcd_cfg.lcd_fix_power_used[i] == 1) @@ -1953,6 +1956,7 @@ static s32 disp_lcd_sw_enable(struct disp_device *lcd) lcdp->lcd_cfg.lcd_bl_gpio_hdl = disp_sys_gpio_request(&lcdp->lcd_cfg.lcd_bl_en, 1); } +#endif spin_lock_irqsave(&lcd_data_lock, flags); lcdp->enabled = 1; diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c index bd40b662e0..9ec01f6029 100644 --- a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c @@ -1607,7 +1607,7 @@ static s32 disp_init(struct platform_device *pdev) g_disp_drv.disp_init.output_aspect_ratio[para->boot_info.disp]; if (para->boot_info.sync == 1) { - __wrn("smooth display screen:%d type:%d", para->boot_info.disp, + __wrn("smooth display screen:%d type:%d\n", para->boot_info.disp, para->boot_info.type); g_disp_drv.disp_init.disp_mode = para->boot_info.disp; g_disp_drv.disp_init.output_type[para->boot_info.disp] = diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c new file mode 100755 index 0000000000..18e017b9ae --- /dev/null +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.c @@ -0,0 +1,226 @@ +#include "S070WV20_MIPI_RGB.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 Bist_mode (0) + +#define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 0, val) +#define power_en(val) sunxi_lcd_gpio_set_value(sel, 1, val) + +static void LCD_cfg_panel_info(struct panel_extend_para * info) +{ + 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; ilcd_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) +{ + pr_info("[BPI2]LCD_open_flow\n"); + + LCD_OPEN_FUNC(sel, LCD_power_on, 200); //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,500); + LCD_OPEN_FUNC(sel, LCD_bl_open, 0); //open lcd backlight, and delay 0ms + + return 0; +} + +static s32 LCD_close_flow(u32 sel) +{ + pr_info("[BPI]LCD_close_flow\n"); + LCD_CLOSE_FUNC(sel, LCD_bl_close, 0); //close lcd backlight, and delay 0ms + LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 0); //close lcd controller, and delay 0ms + LCD_CLOSE_FUNC(sel, LCD_panel_exit, 20); //open lcd power, than delay 200ms + LCD_CLOSE_FUNC(sel, LCD_power_off, 50); //close lcd power, and delay 500ms + + return 0; +} + +static void LCD_power_on(u32 sel) +{ + pr_info("[BPI]LCD_power_on\n"); + sunxi_lcd_pin_cfg(sel, 1); + power_en(0); + sunxi_lcd_power_enable(sel, 0);//config lcd_power pin to open lcd power + sunxi_lcd_delay_ms(10); + sunxi_lcd_power_enable(sel, 1);//config lcd_power pin to open lcd power0 + sunxi_lcd_delay_ms(10); + power_en(1); + sunxi_lcd_delay_ms(50); + panel_reset(1); + sunxi_lcd_delay_ms(10); + panel_reset(0); + sunxi_lcd_delay_ms(30); + panel_reset(1); +} + +static void LCD_power_off(u32 sel) +{ + pr_info("[BPI]LCD_power_off\n"); + sunxi_lcd_pin_cfg(sel, 0); + power_en(0); + sunxi_lcd_delay_ms(10); + 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 +} + +static void LCD_bl_open(u32 sel) +{ + pr_info("[BPI]LCD_bl_open\n"); + sunxi_lcd_pwm_enable(sel); + sunxi_lcd_delay_ms(10); + sunxi_lcd_backlight_enable(sel);//config lcd_bl_en pin to open lcd backlight +} + +static void LCD_bl_close(u32 sel) +{ + pr_info("[BPI]LCD_bl_close\n"); + sunxi_lcd_backlight_disable(sel);//config lcd_bl_en pin to close lcd backlight + sunxi_lcd_pwm_disable(sel); +} + +static void LCD_panel_init(u32 sel) +{ + pr_info("[BPI]LCD_panel_init\n"); + sunxi_lcd_dsi_gen_write_1para(sel,0x7A,0xC1); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x20,0x20); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x21,0xE0); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x22,0x13); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x23,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x24,0x30); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x25,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x26,0x00); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x27,0x0D); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x28,0x03); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x29,0x1D); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x34,0x80); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x36,0x28); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0xB5,0xA0); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x5C,0xFF); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x2A,0x01); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x56,0x92); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x6B,0x71); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x69,0x2B);//2B + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x10,0x40); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x11,0x98); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0xB6,0x20); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_gen_write_1para(sel,0x51,0x20); + sunxi_lcd_delay_ms(10); +#if Bist_mode + sunxi_lcd_dsi_gen_write_1para(sel,0x14,0x43); + sunxi_lcd_dsi_gen_write_1para(sel,0x2A,0x49); +#endif + sunxi_lcd_dsi_gen_write_1para(sel,0x09,0x10); + sunxi_lcd_delay_ms(10); + sunxi_lcd_dsi_clk_enable(sel); + + return; +} + +static void LCD_panel_exit(u32 sel) +{ + sunxi_lcd_dsi_clk_disable(sel); + + return ; +} + +//sel: 0:lcd0; 1:lcd1 +static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3) +{ + return 0; +} + +struct __lcd_panel S070WV20_MIPI_RGB_panel = { + /* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */ + .name = "S070WV20_MIPI_RGB", + .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, + }, +}; diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h new file mode 100755 index 0000000000..a3cc2c259d --- /dev/null +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/S070WV20_MIPI_RGB.h @@ -0,0 +1,8 @@ +#ifndef __S070WV20_MIPI_RGB_PANEL_H__ +#define __S070WV20_MIPI_RGB_PANEL_H__ + +#include "panels.h" + +extern struct __lcd_panel S070WV20_MIPI_RGB_panel; + +#endif diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c index a9b11ab6cd..3f91eb09eb 100644 --- a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c @@ -28,6 +28,7 @@ struct __lcd_panel *panel_array[] = { &lq101r1sx03_panel, /* add new panel below */ &WilliamLcd_panel, + &S070WV20_MIPI_RGB_panel, NULL, }; diff --git a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h index 790d556d29..a1ef485da7 100644 --- a/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h +++ b/lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h @@ -89,5 +89,5 @@ extern struct __lcd_panel he0801a068_panel; extern struct __lcd_panel inet_dsi_panel; extern struct __lcd_panel lq101r1sx03_panel; extern struct __lcd_panel WilliamLcd_panel; - +extern struct __lcd_panel S070WV20_MIPI_RGB_panel; #endif diff --git a/lichee/tools/pack/chips/sun50iw1p1/bin/u-boot-sun50iw1p1.bin b/lichee/tools/pack/chips/sun50iw1p1/bin/u-boot-sun50iw1p1.bin index a574195c99..c84b689aa4 100755 Binary files a/lichee/tools/pack/chips/sun50iw1p1/bin/u-boot-sun50iw1p1.bin and b/lichee/tools/pack/chips/sun50iw1p1/bin/u-boot-sun50iw1p1.bin differ diff --git a/lichee/tools/pack/chips/sun50iw1p1/configs/m64/bootlogo.bmp b/lichee/tools/pack/chips/sun50iw1p1/configs/m64/bootlogo.bmp index df53493679..cf4bc5633b 100755 Binary files a/lichee/tools/pack/chips/sun50iw1p1/configs/m64/bootlogo.bmp and b/lichee/tools/pack/chips/sun50iw1p1/configs/m64/bootlogo.bmp differ diff --git a/lichee/tools/pack/chips/sun50iw1p1/configs/m64/sys_config_linux-4.9.fex b/lichee/tools/pack/chips/sun50iw1p1/configs/m64/sys_config_linux-4.9.fex index 43bc8440cd..93b6a408e8 100755 --- a/lichee/tools/pack/chips/sun50iw1p1/configs/m64/sys_config_linux-4.9.fex +++ b/lichee/tools/pack/chips/sun50iw1p1/configs/m64/sys_config_linux-4.9.fex @@ -57,6 +57,7 @@ eldo2_vol = 1800 eldo3_vol = 1500 fldo2_vol = 1001100 gpio0_vol = 3300 +dc1sw_vol = 1002500 [card_boot] logical_start = 40960 @@ -492,8 +493,8 @@ nand0_p3 = 0x55aaaa55 disp_init_enable = 1 disp_mode = 0 -screen0_output_type = 3 -screen0_output_mode = 5 +screen0_output_type = 1 +screen0_output_mode = 4 screen1_output_type = 3 screen1_output_mode = 5 @@ -540,27 +541,27 @@ fb1_height = 0 [lcd0] lcd_used = 1 -lcd_driver_name = "WilliamLcd" +lcd_driver_name = "S070WV20_MIPI_RGB" ;lcd_model_name= "LT080B21BA94" -lcd_backlight = 50 +lcd_backlight = 100 lcd_if = 4 lcd_x = 800 -lcd_y = 1280 -lcd_width = 108 -lcd_height = 172 -lcd_dclk_freq = 96 +lcd_y = 480 +lcd_width = 86 +lcd_height = 154 +lcd_dclk_freq = 30 lcd_pwm_used = 1 -lcd_pwm_ch = 0 -lcd_pwm_freq = 10000 -lcd_bl_0_percent = 10 +lcd_pwm_ch = 16 +lcd_pwm_freq = 50000 +lcd_bl_0_percent = 50 lcd_pwm_pol = 1 lcd_pwm_max_limit = 255 -lcd_hbp = 36 -lcd_ht = 1200 -lcd_hspw = 20 -lcd_vbp = 15 -lcd_vt = 1330 -lcd_vspw = 5 +lcd_hbp = 88 +lcd_ht = 928 +lcd_hspw = 48 +lcd_vbp = 32 +lcd_vt = 525 +lcd_vspw = 3 lcd_lvds_if = 0 lcd_lvds_colordepth = 0 lcd_lvds_mode = 0 @@ -575,15 +576,16 @@ lcd_gamma_en = 0 lcd_bright_curve_en = 0 lcd_cmap_en = 0 -lcd_gpio_0 = port:PD24<1><0><1> +;rst +lcd_gpio_0 = port:PD6<1><0><0> ;power enable -lcd_gpio_1 = port:PD21<1><0><1> -lcd_bl_en = port:PD23<1><0><1> +lcd_gpio_1 = port:PD7<1><0><0> +lcd_bl_en = port:PD5<1><0><0> -lcd_power = "vcc-mipi" -lcd_power1 = "vcc-lcd" -lcd_fix_power = "vcc-dsi-33" +lcd_power = "vcc-dsi-33" +;lcd_power1 = "vcc-lcd" +;lcd_fix_power = "vcc-dsi-33" lcd_pin_power = "vcc-pd" @@ -603,17 +605,17 @@ pwm_positive = port:PD22<2><0> [pwm0_suspend] pwm_positive = port:PD22<7><0> -[pwm16] -s_pwm0_used = 0 +[spwm0] +s_pwm_used = 1 pwm_positive = port:PL10<2><0> -[pwm16_suspend] +[spwm0_suspend] pwm_positive = port:PL10<7><0> [boot_disp] output_disp = 0 -output_type = 3 -output_mode = 5 +output_type = 1 +output_mode = 4 ;-------------------------------------------------------------------------------- ;csi (COMS Sensor Interface) configuration @@ -1440,7 +1442,7 @@ pmu_powkey_on_time = 1000 [regulator0] compatible = "axp803-regulator" regulator_count = 23 -regulator1 = "axp803_dcdc1 none vcc-nand vcc-emmc vcc-sdc vcc-usb-30 vcc-io vcc-pd vcc-emmcv vcc-emmcvq33 vcc-sdcvq33 vcc-sdcv vcc-sdcvd vcc-wifi" +regulator1 = "axp803_dcdc1 none vcc-nand vcc-emmc vcc-sdc vcc-usb-30 vcc-io vcc-emmcv vcc-emmcvq33 vcc-sdcvq33 vcc-sdcv vcc-sdcvd vcc-wifi" regulator2 = "axp803_dcdc2 none vdd-cpua" regulator3 = "axp803_dcdc3 none" regulator4 = "axp803_dcdc4 none" @@ -1456,13 +1458,13 @@ regulator13 = "axp803_dldo2 none vcc-lcd" regulator14 = "axp803_dldo3 none avdd-csi" regulator15 = "axp803_dldo4 none vcc-wifi-io vcc-pg" regulator16 = "axp803_eldo1 none vcc-cpvdd vcc-pc vcc-emmcvq18" -regulator17 = "axp803_eldo2 none vcc-mipi vcc-lcd-0" +regulator17 = "axp803_eldo2 none vcc-lcd-0" regulator18 = "axp803_eldo3 none dvdd-csi-18" regulator19 = "axp803_fldo1 none vcc-hsic-12" regulator20 = "axp803_fldo2 none vdd-cpus"; regulator21 = "axp803_gpio0ldo none vcc-ctp" regulator22 = "axp803_gpio1ldo none " -regulator23 = "axp803_dc1sw none" +regulator23 = "axp803_dc1sw none vcc-pd" ;-------------------------------------------------------------------------------------------------------- ;compatible ---axp_gpio0 name, support:axp803-gpio