From e0c033f30287744d392a8d700693b1c0b78afc7c Mon Sep 17 00:00:00 2001 From: lin <lin@kickpi.com> Date: Mon, 14 Apr 2025 07:18:20 +0000 Subject: [PATCH] feat(mipi): add lcd-mipi-10-800-1280_AT101DS40I support --- longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts | 1 longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h | 20 + longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.h | 1 longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/Makefile | 1 longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/lcd-mipi-10-800-1280_AT101DS40I.dtsi | 226 ++++++++++++ longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile | 2 longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c | 1 longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c | 391 +++++++++++++++++++++ longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.c | 1 longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h | 23 + longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c | 389 +++++++++++++++++++++ longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h | 1 longan/device/config/chips/a133/configs/c3/kickpi-k5.dts | 1 13 files changed, 1,057 insertions(+), 1 deletions(-) diff --git a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/Makefile b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/Makefile index 067fce1..21232f9 100644 --- a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/Makefile +++ b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/Makefile @@ -53,6 +53,7 @@ disp-$(CONFIG_LCD_SUPPORT_K101_IM2BYL02_L_800X1280) += lcd/K101_IM2BYL02_L_800X1280.o disp-y += lcd/mipi_8_800x1280.o disp-y += lcd/mipi_10_800x1280.o +disp-y += lcd/mipi_10_800x1280_AT101DS40I.o disp-y += lcd/mipi_5_720x1280.o ifeq ($(CONFIG_MACH_SUN8IW6),y) diff --git a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c new file mode 100755 index 0000000..28f5ccc --- /dev/null +++ b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c @@ -0,0 +1,391 @@ +#include "mipi_10_800x1280_AT101DS40I.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(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) +{ + sunxi_lcd_pin_cfg(sel, 1); + sunxi_lcd_delay_ms(50); + panel_reset(sel, 1); + sunxi_lcd_delay_ms(5); + panel_reset(sel, 0); + sunxi_lcd_delay_ms(10); + panel_reset(sel, 1); + sunxi_lcd_delay_ms(120); + +} + +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); +} + +#define REGFLAG_DELAY 0XFC +#define REGFLAG_END_OF_TABLE 0xFD /* END OF REGISTERS MARKER */ + +struct LCM_setting_table { + u8 cmd; + u32 count; + u8 para_list[32]; +}; + +static struct LCM_setting_table jd9365[] = { + + { 0xE0, 1, {0x00} }, + { 0xE1, 1, {0x93} }, + { 0xE2, 1, {0x65} }, + { 0xE3, 1, {0xF8} }, + { 0x80, 1, {0x03} }, + { 0xE0, 1, {0x01} }, + { 0x00, 1, {0x00} }, + { 0x01, 1, {0x5C} }, + { 0x17, 1, {0x00} }, + { 0x18, 1, {0xD7} }, + { 0x19, 1, {0x01} }, + { 0x1A, 1, {0x00} }, + { 0x1B, 1, {0xD7} }, + { 0x1C, 1, {0x01} }, + { 0x1F, 1, {0x70} }, + { 0x20, 1, {0x2D} }, + { 0x21, 1, {0x2D} }, + { 0x22, 1, {0x7E} }, + { 0x24, 1, {0xFD} }, + { 0x37, 1, {0x19} }, + { 0x35, 1, {0x28} }, + { 0x38, 1, {0x05} }, + { 0x39, 1, {0x08} }, + { 0x3A, 1, {0x12} }, + { 0x3C, 1, {0x7E} }, + { 0x3D, 1, {0xFF} }, + { 0x3E, 1, {0xFF} }, + { 0x3F, 1, {0x7F} }, + { 0x40, 1, {0x06} }, + { 0x41, 1, {0xA0} }, + { 0x43, 1, {0x1E} }, + { 0x44, 1, {0x0B} }, + { 0x55, 1, {0x01} }, + { 0x56, 1, {0x01} }, + { 0x57, 1, {0x6A} }, + { 0x58, 1, {0x09} }, + { 0x59, 1, {0x0A} }, + { 0x5A, 1, {0x2E} }, + { 0x5B, 1, {0x1A} }, + { 0x5C, 1, {0x15} }, + { 0x5D, 1, {0x7F} }, + { 0x5E, 1, {0x5A} }, + { 0x5F, 1, {0x47} }, + { 0x60, 1, {0x3A} }, + { 0x61, 1, {0x34} }, + { 0x62, 1, {0x24} }, + { 0x63, 1, {0x28} }, + { 0x64, 1, {0x12} }, + { 0x65, 1, {0x2A} }, + { 0x66, 1, {0x29} }, + { 0x67, 1, {0x29} }, + { 0x68, 1, {0x46} }, + { 0x69, 1, {0x34} }, + { 0x6A, 1, {0x37} }, + { 0x6B, 1, {0x28} }, + { 0x6C, 1, {0x25} }, + { 0x6D, 1, {0x1B} }, + { 0x6E, 1, {0x12} }, + { 0x6F, 1, {0x02} }, + { 0x70, 1, {0x7F} }, + { 0x71, 1, {0x5A} }, + { 0x72, 1, {0x47} }, + { 0x73, 1, {0x3A} }, + { 0x74, 1, {0x34} }, + { 0x75, 1, {0x24} }, + { 0x76, 1, {0x28} }, + { 0x77, 1, {0x12} }, + { 0x78, 1, {0x2A} }, + { 0x79, 1, {0x29} }, + { 0x7A, 1, {0x29} }, + { 0x7B, 1, {0x46} }, + { 0x7C, 1, {0x34} }, + { 0x7D, 1, {0x37} }, + { 0x7E, 1, {0x28} }, + { 0x7F, 1, {0x25} }, + { 0x80, 1, {0x1B} }, + { 0x81, 1, {0x12} }, + { 0x82, 1, {0x02} }, + { 0xE0, 1, {0x02} }, + { 0x00, 1, {0x52} }, + { 0x01, 1, {0x55} }, + { 0x02, 1, {0x55} }, + { 0x03, 1, {0x50} }, + { 0x04, 1, {0x77} }, + { 0x05, 1, {0x57} }, + { 0x06, 1, {0x55} }, + { 0x07, 1, {0x4E} }, + { 0x08, 1, {0x4C} }, + { 0x09, 1, {0x5F} }, + { 0x0A, 1, {0x4A} }, + { 0x0B, 1, {0x48} }, + { 0x0C, 1, {0x55} }, + { 0x0D, 1, {0x46} }, + { 0x0E, 1, {0x44} }, + { 0x0F, 1, {0x40} }, + { 0x10, 1, {0x55} }, + { 0x11, 1, {0x55} }, + { 0x12, 1, {0x55} }, + { 0x13, 1, {0x55} }, + { 0x14, 1, {0x55} }, + { 0x15, 1, {0x55} }, + { 0x16, 1, {0x53} }, + { 0x17, 1, {0x55} }, + { 0x18, 1, {0x55} }, + { 0x19, 1, {0x51} }, + { 0x1A, 1, {0x77} }, + { 0x1B, 1, {0x57} }, + { 0x1C, 1, {0x55} }, + { 0x1D, 1, {0x4F} }, + { 0x1E, 1, {0x4D} }, + { 0x1F, 1, {0x5F} }, + { 0x20, 1, {0x4B} }, + { 0x21, 1, {0x49} }, + { 0x22, 1, {0x55} }, + { 0x23, 1, {0x47} }, + { 0x24, 1, {0x45} }, + { 0x25, 1, {0x41} }, + { 0x26, 1, {0x55} }, + { 0x27, 1, {0x55} }, + { 0x28, 1, {0x55} }, + { 0x29, 1, {0x55} }, + { 0x2A, 1, {0x55} }, + { 0x2B, 1, {0x55} }, + { 0x2C, 1, {0x13} }, + { 0x2D, 1, {0x15} }, + { 0x2E, 1, {0x15} }, + { 0x2F, 1, {0x01} }, + { 0x30, 1, {0x37} }, + { 0x31, 1, {0x17} }, + { 0x32, 1, {0x15} }, + { 0x33, 1, {0x0D} }, + { 0x34, 1, {0x0F} }, + { 0x35, 1, {0x15} }, + { 0x36, 1, {0x05} }, + { 0x37, 1, {0x07} }, + { 0x38, 1, {0x15} }, + { 0x39, 1, {0x09} }, + { 0x3A, 1, {0x0B} }, + { 0x3B, 1, {0x11} }, + { 0x3C, 1, {0x15} }, + { 0x3D, 1, {0x15} }, + { 0x3E, 1, {0x15} }, + { 0x3F, 1, {0x15} }, + { 0x40, 1, {0x15} }, + { 0x41, 1, {0x15} }, + { 0x42, 1, {0x12} }, + { 0x43, 1, {0x15} }, + { 0x44, 1, {0x15} }, + { 0x45, 1, {0x00} }, + { 0x46, 1, {0x37} }, + { 0x47, 1, {0x17} }, + { 0x48, 1, {0x15} }, + { 0x49, 1, {0x0C} }, + { 0x4A, 1, {0x0E} }, + { 0x4B, 1, {0x15} }, + { 0x4C, 1, {0x04} }, + { 0x4D, 1, {0x06} }, + { 0x4E, 1, {0x15} }, + { 0x4F, 1, {0x08} }, + { 0x50, 1, {0x0A} }, + { 0x51, 1, {0x10} }, + { 0x52, 1, {0x15} }, + { 0x53, 1, {0x15} }, + { 0x54, 1, {0x15} }, + { 0x55, 1, {0x15} }, + { 0x56, 1, {0x15} }, + { 0x57, 1, {0x15} }, + { 0x58, 1, {0x40} }, + { 0x5B, 1, {0x10} }, + { 0x5C, 1, {0x06} }, + { 0x5D, 1, {0x40} }, + { 0x5E, 1, {0x00} }, + { 0x5F, 1, {0x00} }, + { 0x60, 1, {0x40} }, + { 0x61, 1, {0x03} }, + { 0x62, 1, {0x04} }, + { 0x63, 1, {0x6C} }, + { 0x64, 1, {0x6C} }, + { 0x65, 1, {0x75} }, + { 0x66, 1, {0x08} }, + { 0x67, 1, {0xB4} }, + { 0x68, 1, {0x08} }, + { 0x69, 1, {0x6C} }, + { 0x6A, 1, {0x6C} }, + { 0x6B, 1, {0x0C} }, + { 0x6D, 1, {0x00} }, + { 0x6E, 1, {0x00} }, + { 0x6F, 1, {0x88} }, + { 0x75, 1, {0xBB} }, + { 0x76, 1, {0x00} }, + { 0x77, 1, {0x05} }, + { 0x78, 1, {0x2A} }, + { 0xE0, 1, {0x04} }, + { 0x09, 1, {0x11} }, + { 0x0E, 1, {0x48} }, + + { 0x37, 1, {0x58} }, + + { 0x2D, 1, {0x03} }, + { 0xE0, 1, {0x00} }, + { 0xE6, 1, {0x02} }, + { 0xE7, 1, {0x06} }, + + + { 0x11, 0, { 0x00 } }, // SLPOUT + { REGFLAG_DELAY, REGFLAG_DELAY, { 120 } }, + + //DISP ON + { 0x29, 0, { 0x00 } }, // DSPON + { REGFLAG_DELAY, REGFLAG_DELAY, { 20 } }, + { REGFLAG_END_OF_TABLE, REGFLAG_END_OF_TABLE, {} } + +}; + +static void lcd_panel_init(u32 sel) +{ + __u32 i; + sunxi_lcd_dsi_clk_enable(sel); + sunxi_lcd_delay_ms(100); + for (i = 0;; i++) { + if (jd9365[i].count == REGFLAG_END_OF_TABLE) + break; + else if (jd9365[i].count == REGFLAG_DELAY) { + sunxi_lcd_delay_ms(jd9365[i].para_list[0]); + } else { + dsi_gen_wr(sel, jd9365[i].cmd, + jd9365[i].para_list, + jd9365[i].count); + } + /* break; */ + } +} + +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; +} + +__lcd_panel_t mipi_10_800x1280_AT101DS40I_panel = { + .name = "mipi_10_800x1280_AT101DS40I", + .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/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h new file mode 100644 index 0000000..8075e36 --- /dev/null +++ b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h @@ -0,0 +1,20 @@ +/* drivers/video/sunxi/disp2/disp/lcd/k101im2qa04.h + * + * Copyright (c) 2017 Allwinnertech Co., Ltd. + * Author: zhengxiaobin <zhengxiaobin@allwinnertech.com> + * + * k101im2qa04 panel driver + * + * 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. +*/ + +#ifndef _MIPI_10_800X1280_H +#define _MIPI_10_800X1280_H + +#include "panels.h" + +extern __lcd_panel_t mipi_10_800x1280_AT101DS40I_panel; + +#endif /*End of file*/ diff --git a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.c b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.c index 00f46da..9c7ae6a 100644 --- a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.c +++ b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.c @@ -137,6 +137,7 @@ &mipi_8_800x1280_panel, &mipi_10_800x1280_panel, + &mipi_10_800x1280_AT101DS40I_panel, /* add new panel below */ &mipi_5_720x1280_panel, NULL, diff --git a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.h b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.h index 2acdd3a..6b97c3d 100644 --- a/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.h +++ b/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd/panels.h @@ -240,5 +240,6 @@ extern __lcd_panel_t mipi_8_800x1280_panel; extern __lcd_panel_t mipi_10_800x1280_panel; extern __lcd_panel_t mipi_5_720x1280_panel; +extern __lcd_panel_t mipi_10_800x1280_AT101DS40I_panel; #endif diff --git a/longan/device/config/chips/a133/configs/c3/kickpi-k5.dts b/longan/device/config/chips/a133/configs/c3/kickpi-k5.dts index d9bc9cd..75dcbaa 100755 --- a/longan/device/config/chips/a133/configs/c3/kickpi-k5.dts +++ b/longan/device/config/chips/a133/configs/c3/kickpi-k5.dts @@ -1443,4 +1443,5 @@ //#include "lcd-lvds-21-1920-1080.dtsi" #include "lcd-lvds-7-1024-600.dtsi" //#include "lcd-mipi-10-800-1280.dtsi" +//#include "lcd-mipi-10-800-1280_AT101DS40I.dtsi" //#include "lcd-mipi-8-800-1280.dtsi" diff --git a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts index d41312c..0c402bd 100755 --- a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts +++ b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts @@ -1448,5 +1448,6 @@ //#include "lcd-lvds-21-1920-1080.dtsi" #include "lcd-lvds-7-1024-600.dtsi" //#include "lcd-mipi-10-800-1280.dtsi" +//#include "lcd-mipi-10-800-1280_AT101DS40I.dtsi" //#include "lcd-mipi-8-800-1280.dtsi" //#include "lcd-mipi-5-720-1280.dtsi" diff --git a/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/lcd-mipi-10-800-1280_AT101DS40I.dtsi b/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/lcd-mipi-10-800-1280_AT101DS40I.dtsi new file mode 100644 index 0000000..108436e --- /dev/null +++ b/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/lcd-mipi-10-800-1280_AT101DS40I.dtsi @@ -0,0 +1,226 @@ +&soc { +/*---------------------------------------------------------------------------------- +disp init configuration + +disp_mode (0:screen0<screen0,fb0>) +screenx_output_type (0:none; 1:lcd; 2:tv; 3:hdmi;5:vdpo) +screenx_output_mode (used for hdmi output, 0:480i 1:576i 2:480p 3:576p 4:720p50) + (5:720p60 6:1080i50 7:1080i60 8:1080p24 9:1080p50 10:1080p60) +screenx_output_format (for hdmi, 0:RGB 1:yuv444 2:yuv422 3:yuv420) +screenx_output_bits (for hdmi, 0:8bit 1:10bit 2:12bit 2:16bit) +screenx_output_eotf (for hdmi, 0:reserve 4:SDR 16:HDR10 18:HLG) +screenx_output_cs (for hdmi, 0:undefined 257:BT709 260:BT601 263:BT2020) +screenx_output_dvi_hdmi (for hdmi, 0:undefined 1:dvi mode 2:hdmi mode) +screen0_output_range (for hdmi, 0:default 1:full 2:limited) +screen0_output_scan (for hdmi, 0:no data 1:overscan 2:underscan) +screen0_output_aspect_ratio (for hdmi, 8-same as original picture 9-4:3 10-16:9 11-14:9) +fbx format (4:RGB655 5:RGB565 6:RGB556 7:ARGB1555 8:RGBA5551 9:RGB888 10:ARGB8888 12:ARGB4444) +fbx pixel sequence (0:ARGB 1:BGRA 2:ABGR 3:RGBA) +fb0_scaler_mode_enable(scaler mode enable, used FE) +fbx_width,fbx_height (framebuffer horizontal/vertical pixels, fix to output resolution while equal 0) +lcdx_backlight (lcd init backlight,the range:[0,256],default:197 +lcdx_yy (lcd init screen bright/contrast/saturation/hue, value:0~100, default:50/50/57/50) +lcd0_contrast (LCD contrast, 0~100) +lcd0_saturation (LCD saturation, 0~100) +lcd0_hue (LCD hue, 0~100) +framebuffer software rotation setting: +disp_rotation_used: (0:disable; 1:enable,you must set fbX_width to lcd_y, +set fbX_height to lcd_x) +degreeX: (X:screen index; 0:0 degree; 1:90 degree; 3:270 degree) +degreeX_Y: (X:screen index; Y:layer index 0~15; 0:0 degree; 1:90 degree; 3:270 degree) +devX_output_type : config output type in bootGUI framework in UBOOT-2018. + (0:none; 1:lcd; 2:tv; 4:hdmi;) +devX_output_mode : config output resolution(see include/video/sunxi_display2.h) of bootGUI framework in UBOOT-2018 +devX_screen_id : config display index of bootGUI framework in UBOOT-2018 +devX_do_hpd : whether do hpd detectation or not in UBOOT-2018 +chn_cfg_mode : Hardware DE channel allocation config. 0:single display with 6 + channel, 1:dual display with 4 channel in main display and 2 channel in second + display, 2:dual display with 3 channel in main display and 3 channel in second + in display. +----------------------------------------------------------------------------------*/ + disp: disp@06000000 { + disp_init_enable = <1>; + disp_mode = <0>; + + screen0_output_type = <1>; + screen0_output_mode = <4>; + + screen1_output_type = <1>; + 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>; + + fb0_format = <0>; + fb0_width = <800>; + fb0_height = <1280>; + + fb1_format = <0>; + fb1_width = <0>; + fb1_height = <0>; + chn_cfg_mode = <1>; + + disp_para_zone = <1>; + dc1sw-supply = <®_dc1sw>; + eldo3-supply = <®_eldo3>; + dldo2-supply = <®_dldo2>; + dcdc1-supply = <®_dcdc1>; + }; +/*---------------------------------------------------------------------------------- +;lcd0 configuration + +;lcd_if: 0:hv(sync+de); 1:8080; 2:ttl; 3:lvds; 4:dsi; 5:edp; 6:extend dsi +;lcd_hv_if 0:Parallel RGB; 8:Serial RGB; 10:Dummy RGB; 11: RGB Dummy;12:CCIR656 +;lcd_hv_clk_phase 0:0 degree;1:90 degree;2:180 degree;3:270 degree +;lcd_hv_sync_polarity 0:vs low,hs low; 1:vs high,hslow; 2:vs low,hs high; 3:vs high,hs high +;lcd_hv_syuv_seq 0:YUYV; 1:YVYU; 2:UYVY; 3:VYUY +;lcd_cpu_if 0:18bit/1 cycle parallel(RGB666); 4:16bit/1cycle parallel (RGB565) +; 6:18bit/3 cycle parallel(RGB666); 7:16bit/2cycle parallel (RGB565) +;lcd_cpu_te 0:frame auto trigger; 1:frame triggered by te rising edge; 2:frame triggered by te falling edge; +;lcd_dsi_if 0:video mode; 1: Command mode; 2:video burst mode +;lcd_dsi_te 0:frame auto trigger; 1:frame triggered by te rising edge; 2:frame triggered by te falling edge; +;lcd_x: lcd horizontal resolution +;lcd_y: lcd vertical resolution +;lcd_width: width of lcd in mm +;lcd_height: height of lcd in mm +;lcd_dclk_freq: in MHZ unit +;lcd_pwm_freq: in HZ unit +;lcd_pwm_pol: lcd backlight PWM polarity +;lcd_pwm_max_limit lcd backlight PWM max limit(<=255) +;lcd_hbp: hsync back porch(pixel) + hsync plus width(pixel); +;lcd_ht: hsync total cycle(pixel) +;lcd_vbp: vsync back porch(line) + vysnc plus width(line) +;lcd_vt: vysnc total cycle(line) +;lcd_hspw: hsync plus width(pixel) +;lcd_vspw: vysnc plus width(pixel) +;lcd_lvds_if: 0:single link; 1:dual link +;lcd_lvds_colordepth: 0:8bit; 1:6bit +;lcd_lvds_mode: 0:NS mode; 1:JEIDA mode +;lcd_frm: 0:disable; 1:enable rgb666 dither; 2:enable rgb656 dither +;lcd_io_phase: 0:noraml; 1:intert phase(0~3bit: vsync phase; 4~7bit:hsync phase; +; 8~11bit:dclk phase; 12~15bit:de phase) +;lcd_gamma_en lcd gamma correction enable +;lcd_bright_curve_en lcd bright curve correction enable +;lcd_cmap_en lcd color map function enable +;deu_mode 0:smoll lcd screen; 1:large lcd screen(larger than 10inch) +;lcdgamma4iep: Smart Backlight parameter, lcd gamma vale * 10; +; decrease it while lcd is not bright enough; increase while lcd is too bright +;smart_color 90:normal lcd screen 65:retina lcd screen(9.7inch) +;Pin setting for special function ie.LVDS, RGB data or vsync +; name(donot care) = port:PD12<pin function><pull up or pull down><drive ability><output level> +;Pin setting for gpio: +; lcd_gpio_X = port:PD12<pin function><pull up or pull down><drive ability><output level> +;Pin setting for backlight enable pin +; lcd_bl_en = port:PD12<pin function><pull up or pull down><drive ability><output level> +;fsync setting, pulse to csi +;lcd_fsync_en (0:disable fsync,1:enable) +;lcd_fsync_act_time (active time of fsync, unit:pixel) +;lcd_fsync_dis_time (disactive time of fsync, unit:pixel) +;lcd_fsync_pol (0:positive;1:negative) +;gpio config: <&pio for cpu or &r_pio for cpus, port, port num, pio function, +pull up or pull down(default 0), driver level(default 1), data> +;For dual link lvds: use lvds2link_pins_a and lvds2link_pins_b instead +;For rgb24: use rgb24_pins_a and rgb24_pins_b instead +;For lvds1: use lvds1_pins_a and lvds1_pins_b instead +;For lvds0: use lvds0_pins_a and lvds0_pins_b instead +;----------------------------------------------------------------------------------*/ + lcd0: lcd0@01c0c000 { + lcd_used = <1>; + status = "okay"; + lcd_driver_name = "mipi_10_800x1280_AT101DS40I"; + lcd_backlight = <255>; + 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 = <2>; + 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_pin_power2 = "dldo2"; + + lcd_power = "dc1sw"; + // lcd_bl_en = <&pio PD 21 1 0 3 1>; + + // reset + lcd_gpio_0 = <&pio PE 5 1 0 3 1>; + + // power + lcd_gpio_1 = <&pio PD 21 1 0 3 1>; + + pinctrl-0 = <&dsi4lane_pins_a>; + pinctrl-1 = <&dsi4lane_pins_b>; + //pinctrl-0 = <&lvds0_pins_a>; + //pinctrl-1 = <&lvds0_pins_b>; + }; + }; + +&twi0 { + ctp { + compatible = "gt9xx_ts"; + ctp_used = <1>; + device_type = "ctp"; + status = "okay"; + ctp_twi_id = <0x0>; + ctp_name = "gt9xx"; + reg = <0x5D>; + ctp_screen_max_x = <1280>; + ctp_screen_max_y = <800>; + ctp_revert_x_flag = <0x1>; + ctp_revert_y_flag = <0x0>; + ctp_exchange_x_y_flag = <0x1>; + ctp_int_port = <&pio PE 3 6 0xffffffff 0xffffffff 0>; + ctp_wakeup = <&pio PE 4 1 0xffffffff 0xffffffff 1>; + ctp_power_ldo = <3300>; + ctp_power_ldo_vol = <3300>; + ctp_power = <3300>; + }; +}; \ No newline at end of file diff --git a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile index 5ee479b..f69775d 100644 --- a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile +++ b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/Makefile @@ -27,7 +27,7 @@ lcd/he0801a068.o lcd/inet_dsi_panel.o lcd/lq101r1sx03.o \ lcd/WilliamLcd.o lcd/fx070.o lcd/FX070_DHM18BOEL2_1024X600.o \ lcd/bp101wx1-206.o lcd/m133x56-105.o lcd/m133x56-105-two.o lcd/k101im2qa04.o lcd/k101im2byl02l.o \ - conver_chips/lt8911ex.o lcd/K101_IM2BYL02_L_800X1280.o lcd/mipi_8_800x1280.o lcd/mipi_10_800x1280.o + conver_chips/lt8911ex.o lcd/K101_IM2BYL02_L_800X1280.o lcd/mipi_8_800x1280.o lcd/mipi_10_800x1280.o lcd/mipi_10_800x1280_AT101DS40I.o disp-objs += $(obj_low) disp-objs += lcd/mipi_5_720x1280.o diff --git a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c new file mode 100755 index 0000000..6ed2abd --- /dev/null +++ b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.c @@ -0,0 +1,389 @@ +#include "mipi_10_800x1280_AT101DS40I.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) +{ + sunxi_lcd_pin_cfg(sel, 1); + sunxi_lcd_delay_ms(50); + panel_reset(sel, 1); + sunxi_lcd_delay_ms(5); + panel_reset(sel, 0); + sunxi_lcd_delay_ms(10); + panel_reset(sel, 1); + sunxi_lcd_delay_ms(120); + +} + +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); +} + +#define REGFLAG_DELAY 0XFC +#define REGFLAG_END_OF_TABLE 0xFD /* END OF REGISTERS MARKER */ + +struct LCM_setting_table { + u8 cmd; + u32 count; + u8 para_list[32]; +}; + +static struct LCM_setting_table jd9365[] = { + { 0xE0, 1, {0x00} }, + { 0xE1, 1, {0x93} }, + { 0xE2, 1, {0x65} }, + { 0xE3, 1, {0xF8} }, + { 0x80, 1, {0x03} }, + { 0xE0, 1, {0x01} }, + { 0x00, 1, {0x00} }, + { 0x01, 1, {0x5C} }, + { 0x17, 1, {0x00} }, + { 0x18, 1, {0xD7} }, + { 0x19, 1, {0x01} }, + { 0x1A, 1, {0x00} }, + { 0x1B, 1, {0xD7} }, + { 0x1C, 1, {0x01} }, + { 0x1F, 1, {0x70} }, + { 0x20, 1, {0x2D} }, + { 0x21, 1, {0x2D} }, + { 0x22, 1, {0x7E} }, + { 0x24, 1, {0xFD} }, + { 0x37, 1, {0x19} }, + { 0x35, 1, {0x28} }, + { 0x38, 1, {0x05} }, + { 0x39, 1, {0x08} }, + { 0x3A, 1, {0x12} }, + { 0x3C, 1, {0x7E} }, + { 0x3D, 1, {0xFF} }, + { 0x3E, 1, {0xFF} }, + { 0x3F, 1, {0x7F} }, + { 0x40, 1, {0x06} }, + { 0x41, 1, {0xA0} }, + { 0x43, 1, {0x1E} }, + { 0x44, 1, {0x0B} }, + { 0x55, 1, {0x01} }, + { 0x56, 1, {0x01} }, + { 0x57, 1, {0x6A} }, + { 0x58, 1, {0x09} }, + { 0x59, 1, {0x0A} }, + { 0x5A, 1, {0x2E} }, + { 0x5B, 1, {0x1A} }, + { 0x5C, 1, {0x15} }, + { 0x5D, 1, {0x7F} }, + { 0x5E, 1, {0x5A} }, + { 0x5F, 1, {0x47} }, + { 0x60, 1, {0x3A} }, + { 0x61, 1, {0x34} }, + { 0x62, 1, {0x24} }, + { 0x63, 1, {0x28} }, + { 0x64, 1, {0x12} }, + { 0x65, 1, {0x2A} }, + { 0x66, 1, {0x29} }, + { 0x67, 1, {0x29} }, + { 0x68, 1, {0x46} }, + { 0x69, 1, {0x34} }, + { 0x6A, 1, {0x37} }, + { 0x6B, 1, {0x28} }, + { 0x6C, 1, {0x25} }, + { 0x6D, 1, {0x1B} }, + { 0x6E, 1, {0x12} }, + { 0x6F, 1, {0x02} }, + { 0x70, 1, {0x7F} }, + { 0x71, 1, {0x5A} }, + { 0x72, 1, {0x47} }, + { 0x73, 1, {0x3A} }, + { 0x74, 1, {0x34} }, + { 0x75, 1, {0x24} }, + { 0x76, 1, {0x28} }, + { 0x77, 1, {0x12} }, + { 0x78, 1, {0x2A} }, + { 0x79, 1, {0x29} }, + { 0x7A, 1, {0x29} }, + { 0x7B, 1, {0x46} }, + { 0x7C, 1, {0x34} }, + { 0x7D, 1, {0x37} }, + { 0x7E, 1, {0x28} }, + { 0x7F, 1, {0x25} }, + { 0x80, 1, {0x1B} }, + { 0x81, 1, {0x12} }, + { 0x82, 1, {0x02} }, + { 0xE0, 1, {0x02} }, + { 0x00, 1, {0x52} }, + { 0x01, 1, {0x55} }, + { 0x02, 1, {0x55} }, + { 0x03, 1, {0x50} }, + { 0x04, 1, {0x77} }, + { 0x05, 1, {0x57} }, + { 0x06, 1, {0x55} }, + { 0x07, 1, {0x4E} }, + { 0x08, 1, {0x4C} }, + { 0x09, 1, {0x5F} }, + { 0x0A, 1, {0x4A} }, + { 0x0B, 1, {0x48} }, + { 0x0C, 1, {0x55} }, + { 0x0D, 1, {0x46} }, + { 0x0E, 1, {0x44} }, + { 0x0F, 1, {0x40} }, + { 0x10, 1, {0x55} }, + { 0x11, 1, {0x55} }, + { 0x12, 1, {0x55} }, + { 0x13, 1, {0x55} }, + { 0x14, 1, {0x55} }, + { 0x15, 1, {0x55} }, + { 0x16, 1, {0x53} }, + { 0x17, 1, {0x55} }, + { 0x18, 1, {0x55} }, + { 0x19, 1, {0x51} }, + { 0x1A, 1, {0x77} }, + { 0x1B, 1, {0x57} }, + { 0x1C, 1, {0x55} }, + { 0x1D, 1, {0x4F} }, + { 0x1E, 1, {0x4D} }, + { 0x1F, 1, {0x5F} }, + { 0x20, 1, {0x4B} }, + { 0x21, 1, {0x49} }, + { 0x22, 1, {0x55} }, + { 0x23, 1, {0x47} }, + { 0x24, 1, {0x45} }, + { 0x25, 1, {0x41} }, + { 0x26, 1, {0x55} }, + { 0x27, 1, {0x55} }, + { 0x28, 1, {0x55} }, + { 0x29, 1, {0x55} }, + { 0x2A, 1, {0x55} }, + { 0x2B, 1, {0x55} }, + { 0x2C, 1, {0x13} }, + { 0x2D, 1, {0x15} }, + { 0x2E, 1, {0x15} }, + { 0x2F, 1, {0x01} }, + { 0x30, 1, {0x37} }, + { 0x31, 1, {0x17} }, + { 0x32, 1, {0x15} }, + { 0x33, 1, {0x0D} }, + { 0x34, 1, {0x0F} }, + { 0x35, 1, {0x15} }, + { 0x36, 1, {0x05} }, + { 0x37, 1, {0x07} }, + { 0x38, 1, {0x15} }, + { 0x39, 1, {0x09} }, + { 0x3A, 1, {0x0B} }, + { 0x3B, 1, {0x11} }, + { 0x3C, 1, {0x15} }, + { 0x3D, 1, {0x15} }, + { 0x3E, 1, {0x15} }, + { 0x3F, 1, {0x15} }, + { 0x40, 1, {0x15} }, + { 0x41, 1, {0x15} }, + { 0x42, 1, {0x12} }, + { 0x43, 1, {0x15} }, + { 0x44, 1, {0x15} }, + { 0x45, 1, {0x00} }, + { 0x46, 1, {0x37} }, + { 0x47, 1, {0x17} }, + { 0x48, 1, {0x15} }, + { 0x49, 1, {0x0C} }, + { 0x4A, 1, {0x0E} }, + { 0x4B, 1, {0x15} }, + { 0x4C, 1, {0x04} }, + { 0x4D, 1, {0x06} }, + { 0x4E, 1, {0x15} }, + { 0x4F, 1, {0x08} }, + { 0x50, 1, {0x0A} }, + { 0x51, 1, {0x10} }, + { 0x52, 1, {0x15} }, + { 0x53, 1, {0x15} }, + { 0x54, 1, {0x15} }, + { 0x55, 1, {0x15} }, + { 0x56, 1, {0x15} }, + { 0x57, 1, {0x15} }, + { 0x58, 1, {0x40} }, + { 0x5B, 1, {0x10} }, + { 0x5C, 1, {0x06} }, + { 0x5D, 1, {0x40} }, + { 0x5E, 1, {0x00} }, + { 0x5F, 1, {0x00} }, + { 0x60, 1, {0x40} }, + { 0x61, 1, {0x03} }, + { 0x62, 1, {0x04} }, + { 0x63, 1, {0x6C} }, + { 0x64, 1, {0x6C} }, + { 0x65, 1, {0x75} }, + { 0x66, 1, {0x08} }, + { 0x67, 1, {0xB4} }, + { 0x68, 1, {0x08} }, + { 0x69, 1, {0x6C} }, + { 0x6A, 1, {0x6C} }, + { 0x6B, 1, {0x0C} }, + { 0x6D, 1, {0x00} }, + { 0x6E, 1, {0x00} }, + { 0x6F, 1, {0x88} }, + { 0x75, 1, {0xBB} }, + { 0x76, 1, {0x00} }, + { 0x77, 1, {0x05} }, + { 0x78, 1, {0x2A} }, + { 0xE0, 1, {0x04} }, + { 0x09, 1, {0x11} }, + { 0x0E, 1, {0x48} }, + + { 0x37, 1, {0x58} }, + + { 0x2D, 1, {0x03} }, + { 0xE0, 1, {0x00} }, + { 0xE6, 1, {0x02} }, + { 0xE7, 1, {0x06} }, + + + { 0x11, 0, { 0x00 } }, // SLPOUT + { REGFLAG_DELAY, REGFLAG_DELAY, { 120 } }, + + //DISP ON + { 0x29, 0, { 0x00 } }, // DSPON + { REGFLAG_DELAY, REGFLAG_DELAY, { 20 } }, + { REGFLAG_END_OF_TABLE, REGFLAG_END_OF_TABLE, {} } +}; + +static void lcd_panel_init(u32 sel) +{ + __u32 i; + sunxi_lcd_dsi_clk_enable(sel); + sunxi_lcd_delay_ms(100); + for (i = 0;; i++) { + if (jd9365[i].count == REGFLAG_END_OF_TABLE) + break; + else if (jd9365[i].count == REGFLAG_DELAY) { + sunxi_lcd_delay_ms(jd9365[i].para_list[0]); + } else { + dsi_gen_wr(sel, jd9365[i].cmd, + jd9365[i].para_list, + jd9365[i].count); + } + /* break; */ + } +} + +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; +} + +__lcd_panel_t mipi_10_800x1280_AT101DS40I_panel = { + .name = "mipi_10_800x1280_AT101DS40I", + .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/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h new file mode 100644 index 0000000..aa84e7a --- /dev/null +++ b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/mipi_10_800x1280_AT101DS40I.h @@ -0,0 +1,23 @@ +/* drivers/video/sunxi/disp2/disp/lcd/k101im2qa04.h + * + * Copyright (c) 2017 Allwinnertech Co., Ltd. + * Author: zhengxiaobin <zhengxiaobin@allwinnertech.com> + * + * k101im2qa04 panel driver + * + * 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. +*/ + +#ifndef _MIPI_10_800X1280_H +#define _MIPI_10_800X1280_H + +#include "panels.h" + +typedef struct __lcd_panel __lcd_panel_t; + +extern struct __lcd_panel mipi_10_800x1280_AT101DS40I_panel; +extern s32 bsp_disp_get_panel_info(u32 screen_id, struct disp_panel_para *info); + +#endif /*End of file*/ diff --git a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c index c24899f..5f5c533 100644 --- a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c +++ b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.c @@ -41,6 +41,7 @@ &K101_IM2BYL02_L_800X1280_mipi_panel, &mipi_8_800x1280_panel, &mipi_10_800x1280_panel, + &mipi_10_800x1280_AT101DS40I_panel, &mipi_5_720x1280_panel, NULL, }; diff --git a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h index 4d8f0ac..0964e6e 100644 --- a/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h +++ b/longan/kernel/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/lcd/panels.h @@ -100,5 +100,6 @@ extern struct __lcd_panel K101_IM2BYL02_L_800X1280_mipi_panel; extern struct __lcd_panel mipi_8_800x1280_panel; extern struct __lcd_panel mipi_10_800x1280_panel; +extern struct __lcd_panel mipi_10_800x1280_AT101DS40I_panel; extern struct __lcd_panel mipi_5_720x1280_panel; #endif -- Gitblit v1.6.2