1.屏幕信息

屏幕名称:SY101WXB65

屏幕参数:

android驱动LCD屏_数据

引脚描述:

android驱动LCD屏_sed_02

android驱动LCD屏_sed_03

上电时序:

android驱动LCD屏_引脚_04

2.board.dts   uboot-board.dts适配

board.dts 配置

首先:通过屏幕数据手册以及板卡原理图信息,修改&lcd0节点内和&disp节点内信息

lcd0内需要修改屏幕信息、接口、电源接口等管脚,结合屏幕数据手册上电时序图,需要配置power,复位、pinctrl三个,

在后续驱动代码实现中会体现到

&lcd0节点

&lcd0 {

		/*屏幕驱动选择----lcd0*/
        lcd_used            = <1>;
		status 				= "okay";
 		lcd_driver_name     = "SY101WXB65";

		/* 选择接口及模式*/
		lcd_if              = <4>;//MIPI接口就是DSI接口
       	lcd_dsi_if          = <0>;

		/* 配置屏时序*/
        lcd_x               = <800>;
        lcd_y               = <1280>;
		lcd_dclk_freq       = <67>;
		lcd_hbp             = <40>;
		lcd_ht              = <884>;//原值884---1348
		lcd_hspw            = <12>;
        lcd_vbp             = <40>;
        lcd_vt              = <1345>;
        lcd_vspw            = <4>;

		/*背光配置*/
		lcd_backlight       = <50>;
		lcd_pwm_used        = <1>;
        lcd_pwm_ch          = <4>;
        lcd_pwm_freq        = <50000>;
        lcd_pwm_pol         = <0>;
		//lcd_bl_en        = <&pio PI 2 GPIO_ACTIVE_HIGH>;//背光
		lcd_bl_0_percent    = <5>;

		/* 接口详细设置*/
		lcd_dsi_lane        = <4>;
		lcd_start_delay     = <5>;//显示前几行花屏,调此参数

		/*I/O管脚和电源配置*/
		lcd_power = "dcdc4";
		lcd_power1 = "dcdc4";
		lcd_pin_power = "dcdc4";
		lcd_gpio_0 = <&pio PI 2 GPIO_ACTIVE_HIGH>; //reset引脚

        pinctrl-0 = <&dsi0_4lane_pins_a>;
        pinctrl-1 = <&dsi0_4lane_pins_b>;
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.

&disp

disp中需要修改屏幕对应信息(注意屏幕的宽高要对应),pwms、pinctrl等

&disp {
        disp_init_enable         = <1>;
        disp_mode                = <0>;

        screen0_output_type      = <1>;
        screen0_output_mode      = <4>;
        screen0_to_lcd_index     = <0>;

        screen1_output_type      = <3>;
        screen1_output_mode      = <5>;
        screen1_to_lcd_index     = <2>;

        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>;

        display_device_num          = <3>;

        primary_display_type        = "LCD";
        primary_de_id               = <0>;
        primary_framebuffer_width   = <800>;
        primary_framebuffer_height  = <1280>;
        primary_dpix                = <213>;
        primary_dpiy                = <213>;

        extend0_display_type        = "HDMI";
        extend0_de_id               = <1>;
        extend0_framebuffer_width   = <1920>;
        extend0_framebuffer_height  = <1080>;
        extend0_dpix                = <160>;
        extend0_dpiy                = <160>;

        extend1_display_type        = "DP";
        extend1_de_id               = <1>;
        extend1_framebuffer_width   = <1920>;
        extend1_framebuffer_height  = <1080>;
        extend1_dpix                = <160>;
        extend1_dpiy                = <160>;

        fb_format                = <0>;
        fb_num                   = <2>;
        /*<disp channel layer zorder>*/
        fb0_map                  = <0 1 0 16>;
        fb0_width                = <800>;
        fb0_height               = <1280>;
        /*<disp channel layer zorder>*/
        fb1_map                  = <1 1 0 16>;
        fb1_width                = <1920>;
        fb1_height               = <1080>;
        /*<disp channel layer zorder>*/
        fb2_map                  = <1 0 0 16>;
        fb2_width                = <1280>;
        fb2_height               = <720>;
        /*<disp channel layer zorder>*/
        fb3_map                  = <1 1 0 16>;
        fb3_width                = <300>;
        fb3_height               = <300>;

        chn_cfg_mode             = <3>;
        disp_para_zone           = <1>;

        /* dual display clock constraints:
           1. two tcons cannot share a parent clock.
           2. when dsi uses ccu clock, combphy and corresponding tcon use the
            same parent clock.
        */
        assigned-clocks = <&ccu CLK_DE>,
                  <&ccu CLK_VO0_TCONLCD0>,
                  <&ccu CLK_VO0_TCONLCD1>,
                  <&ccu CLK_VO1_TCONLCD0>,
                  <&ccu CLK_TCONTV>,
                  <&ccu CLK_TCONTV1>,
                  <&ccu CLK_COMBPHY0>,
                  <&ccu CLK_COMBPHY1>,
                  <&ccu CLK_DSI0>,
                  <&ccu CLK_DSI1>,
                  <&ccu CLK_EDP>;
        assigned-clock-parents = <&ccu CLK_PLL_VIDEO3_4X>,
                         <&ccu CLK_PLL_VIDEO0_4X>,
                         <&ccu CLK_PLL_VIDEO1_4X>,
                         <&ccu CLK_PLL_VIDEO1_4X>,
                         <&ccu CLK_PLL_VIDEO1_4X>,
                         <&ccu CLK_PLL_VIDEO1_4X>,
                         <&ccu CLK_PLL_VIDEO0_4X>,
                         <&ccu CLK_PLL_VIDEO1_4X>,
                         <&ccu CLK_PLL_PERI0_150M>,
                         <&ccu CLK_PLL_PERI0_150M>,
                         <&ccu CLK_PLL_VIDEO1_4X>;
        assigned-clock-rates = <600000000>;

        cldo3-supply = <®_cldo3>;
        dcdc4-supply = <®_dcdc4>;
        cldo1-supply = <®_cldo1>;

	pwms = <&pwm0 4 5000000 0>, <&pwm0 5 5000000 0>,<&pwm0 4 5000000 0>;    //将具体所需的pwm添加到pwms中
  pwm-names = "lvds0_backlight", "lvds2_backlight","dsi0_backlight";    //添加上对应的dsi0_backlight


        power-domains = <&pd1 A523_PCK_DE>, <&pd1 A523_PCK_VO0>, <&pd1 A523_PCK_VO1>;
        power-domain-names = "pd_de", "pd_vo0", "pd_vo1";

	pinctrl-names = "active", "sleep";
	// pinctrl-0 = <&pwm0_0_pin_active>;
	// pinctrl-1 = <&pwm0_0_pin_sleep>;

	pinctrl-0 = <&pwm0_4_pin_active>;    //修改对应的pinctrl0    pinctrl1  
	pinctrl-1 = <&pwm0_4_pin_sleep>;  
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.

uboot-board.dts配置

&lcd0节点

注意需要修改屏幕对应的信息,以及各类引脚

&lcd0{
        /*屏幕驱动选择----lcd0*/
        lcd_used            = <1>;
		status 				= "okay";
 		lcd_driver_name     = "SY101WXB65";

		/* 选择接口及模式*/
		lcd_if              = <4>;//MIPI接口就是DSI接口
       	lcd_dsi_if          = <0>;

		/* 配置屏时序*/
        lcd_x               = <800>;
        lcd_y               = <1280>;
		lcd_dclk_freq       = <67>;
		lcd_hbp             = <40>;
		lcd_ht              = <884>;
		lcd_hspw            = <12>;
        lcd_vbp             = <40>;
        lcd_vt              = <1345>;
        lcd_vspw            = <4>;

		/*背光配置*/
		lcd_backlight       = <50>;
		lcd_pwm_used        = <1>;
        lcd_pwm_ch          = <4>;
        lcd_pwm_freq        = <50000>;
        lcd_pwm_pol         = <0>;
		//lcd_bl_en        = <&pio PI 2 1 0 3 1>;
		lcd_bl_0_percent    = <5>;

		/* 接口详细设置*/
		lcd_dsi_lane        = <4>;
		lcd_start_delay     = <5>;//显示前几行花屏,调此参数

		/*I/O管脚和电源配置*/
		lcd_power = "dcdc4";
		lcd_power1 = "dcdc4";
		lcd_pin_power = "dcdc4";
		lcd_gpio_0 = <&pio PI 2 1 0 3 1>; //reset引脚
        pinctrl-0 = <&dsi0_4lane_pins_a>;
        pinctrl-1 = <&dsi0_4lane_pins_b>;
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.

&disp节点

注意需要配置对应的屏幕参数信息---特别是尺寸问题

&disp {
        disp_init_enable         = <1>;
        disp_mode                = <0>;

        screen0_output_type      = <1>;
        screen0_output_mode      = <4>;
        screen0_to_lcd_index     = <0>;

        screen1_output_type      = <3>;
        screen1_output_mode      = <5>;

        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>;
        screen1_to_lcd_index     = <2>;

        dev_num                  = <2>;
        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>;
        fb0_rot_used		 = <0>;
        fb0_rot_degree		 = <0>;

        fb1_format               = <0>;
        fb1_width                = <1920>;
        fb1_height               = <1080>;
        fb1_rot_used		 = <0>;
        fb1_rot_degree		 = <0>;

        chn_cfg_mode             = <3>;

        disp_para_zone           = <1>;
        /*VCC-LCD*/
        dcdc4-supply = <®_dcdc4>;
        /*VCC-DSI*/
        cldo1-supply = <®_cldo1>;
        /*VCC-PD*/
        cldo3-supply = <®_cldo3>;
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.

3.适配屏幕信息

uboot目录::W:\T527_Android13_V1.0_20231205\android\longan\brandy\brandy-2.0\u-boot-2018\drivers\video\sunxi\disp2\disp\lcd\panels.c文件中,添加相应设备信息

panels.c

#ifdef CONFIG_LCD_SUPPORT_SY101WXB65
	&SY101WXB65_mipi_panel,
#endif
  • 1.
  • 2.
  • 3.

panels.h

#ifdef CONFIG_LCD_SUPPORT_SY101WXB65
extern __lcd_panel_t SY101WXB65_mipi_panel;
#endif
  • 1.
  • 2.
  • 3.

kconfig配置

config LCD_SUPPORT_SY101WXB65
	bool "LCD support SY101WXB65 panel"
	default y
	---help---
		If you want to support SY101WXB65 panel for display driver, select it.
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

内核目录:W:\T527_Android13_V1.0_20231205\android\longan\bsp\drivers\video\sunxi\disp2\disp\lcd\panels.c文件中,添加

相应设备信息

panels.c

#ifdef CONFIG_LCD_SUPPORT_SY101WXB65
	&SY101WXB65_mipi_panel,
#endif
  • 1.
  • 2.
  • 3.

panels.h

extern struct __lcd_panel SY101WXB65_mipi_panel;
  • 1.

kconfig配置

config LCD_SUPPORT_SY101WXB65
	bool "LCD support SY101WXB65 panel"
	default y
	help
		If you want to support SY101WXB65 panel for display driver, select it.
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

t527目录:W:\T527_Android13_V1.0_20231205\android\device\softwinner\saturn\t527-demo\display\dispconfigs\t527-demo.json文件中,修改相应节点信息,主要修改屏幕尺寸对应的信息

"Display0": {
        /* Available interface type: LCD/HDMI/CVBS */
        "InterfaceType": "LCD",
        "DisplayEnginePortId": 0,
        "OverrideFramebufferSize": 1,
        "FramebufferWidth": 800,
        "FramebufferHeight": 1280,
        "DpiX": 213,
        "DpiY": 213,
        "HotplugSupported": 0,
        "AfbcSupported": 0,
        "HardwareRotateSupported": 0,
        "BandwidthLimited": 338800,
        "DefaultOutputMode": 0
    },
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.

4.编写驱动代码

驱动代码需要在内核和uboot都有对应的驱动代码(.c   .h文件)

注意:虽说两个不同地方的.c  .h文件内代码基本上一样,但是也不能原样复制,不然会报一大堆错,一定要细细甄别两者的区别

uboot中

路径:W:\T527_Android13_V1.0_20231205\android\longan\brandy\brandy-2.0\u-boot-2018\drivers\video\sunxi\disp2\disp\lcd\SY101WXB65.c

SY101WXB65.c

#include "SY101WXB65.h"
#include "panels.h"

//获取屏幕screen_id  info 是一个指向用于存储面板信息的结构体的指针
//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);

  
//lcd屏幕参数设计
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; 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, 5);   
	LCD_OPEN_FUNC(sel, LCD_panel_init, 5);  
	LCD_OPEN_FUNC(sel, sunxi_lcd_tcon_enable, 210);   
	LCD_OPEN_FUNC(sel, LCD_bl_open, 1);   
	printk("********uboot注册开屏代码********\r\n");  
   return 0;
}

//注册关屏函数
static s32 LCD_close_flow(u32 sel)
{
    LCD_CLOSE_FUNC(sel, LCD_bl_close, 5);      
	LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 5);         
	LCD_CLOSE_FUNC(sel, LCD_panel_exit,	5);   
	LCD_CLOSE_FUNC(sel, LCD_power_off, 5); 
	printk("********uboot注册关屏代码********\r\n"); 
    return 0;
}

//打开lcd电源  
static void LCD_power_on(u32 sel)
{
	//1.电源--   2.复位引脚电平---   3.pinctrl引脚电平----
    //一上电,低电平
	sunxi_lcd_power_disable(sel,0);
	sunxi_lcd_power_disable(sel,1);
    sunxi_lcd_gpio_set_value(sel,0,0);
    sunxi_lcd_pin_cfg(sel, 0);
        //延迟500us
    sunxi_lcd_delay_us(10);
    //VCC电源打开
    sunxi_lcd_power_enable(sel,0); 
	sunxi_lcd_power_enable(sel,1); 
    //延迟500us
    sunxi_lcd_delay_us(500);
    sunxi_lcd_pin_cfg(sel, 1);
    //延迟500us
    sunxi_lcd_delay_us(500);
    //高电平复位
    sunxi_lcd_gpio_set_value(sel,0,1);
    sunxi_lcd_delay_us(500);
    //低电平复位
    sunxi_lcd_gpio_set_value(sel,0,0);
    sunxi_lcd_delay_us(20);
    //高电平复位
    sunxi_lcd_gpio_set_value(sel,0,1);
	printk("********uboot打开电源********\r\n");
}

//关闭lcd电源
static void LCD_power_off(u32 sel)
{
	//1.关电源   2.设置复位低电平   3.pinctrl拉低
	sunxi_lcd_gpio_set_value(sel, 0, 0);
	//关闭背光后40ms关闭mipi传输
    //关闭mipi传输后持续1ms拉低复位电平
	sunxi_lcd_delay_ms(1);
	sunxi_lcd_pin_cfg(sel, 0);
	//之后设为低电平持续500ms之后再将电平拉高
	sunxi_lcd_power_disable(sel, 0);
	sunxi_lcd_power_disable(sel, 1);
	sunxi_lcd_delay_ms(500);
	sunxi_lcd_power_enable(sel, 0);
	sunxi_lcd_power_enable(sel, 1);
	printk("********uboot关闭电源********\r\n");
}

//开启屏幕背光
static void LCD_bl_open(u32 sel)
{
    sunxi_lcd_pwm_enable(sel);
	//sunxi_lcd_delay_ms(50);
	//sunxi_lcd_backlight_enable(sel);
	printk("********uboot开启屏幕背光********\r\n");
}
//关闭屏幕背光
static void LCD_bl_close(u32 sel)
{
	sunxi_lcd_pwm_disable(sel);
	//sunxi_lcd_delay_ms(20);
    //sunxi_lcd_backlight_disable(sel);
	printk("********uboot关闭屏幕背光********\r\n");
}


#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];
// };


// static struct LCM_setting_table lcm_initialization_setting[] = {
//   {0xFF,    3,     {0x98, 0x81, 0x03} },

// //GIP_1

//   {0x01,    1,     {0x00} },
//   {0x02,    1,     {0x00} },
//   {0x03,    1,     {0x73} },     //STA Width 4H
//   {0x04,    1,     {0x00} },
//   {0x05,    1,     {0x00} },
//   {0x06,    1,     {0x0A} },     //STVA Rise start
//   {0x07,    1,     {0x00} },
//   {0x08,    1,     {0x00} },
//   {0x09,    1,     {0x20} },     //Detail A&B 3.5-4.0us
//   {0x0A,    1,     {0x20} },     //Detail A&B 3.5-4.0us
//   {0x0B,    1,     {0x00} },
//   {0x0C,    1,     {0x00} },
//   {0x0D,    1,     {0x00} },
//   {0x0E,    1,     {0x00} },
//   {0x0F,    1,     {0x20} },     //Detail A&B 3.5-4.0us
//   {0x10,    1,     {0x20} },     //Detail A&B 3.5-4.0us
//   {0x11,    1,     {0x00} },
//   {0x12,    1,     {0x00} },
//   {0x13,    1,     {0x00} },
//   {0x14,    1,     {0x00} },
//   {0x15,    1,     {0x00} },
//   {0x16,    1,     {0x00} },
//   {0x17,    1,     {0x00} },
//   {0x18,    1,     {0x00} },
//   {0x19,    1,     {0x00} },
//   {0x1A,    1,     {0x00} },
//   {0x1B,    1,     {0x00} },
//   {0x1C,    1,     {0x00} },
//   {0x1D,    1,     {0x00} },
//   {0x1E,    1,     {0x40} },
//   {0x1F,    1,     {0x80} },
//   {0x20,    1,     {0x06} },    //CLKA Rise START
//   {0x21,    1,     {0x01} },    //CLKA FALL END
//   {0x22,    1,     {0x00} },
//   {0x23,    1,     {0x00} },
//   {0x24,    1,     {0x00} },
//   {0x25,    1,     {0x00} },
//   {0x26,    1,     {0x00} },
//   {0x27,    1,     {0x00} },
//   {0x28,    1,     {0x33} },    //CLK_x_Numb[2:0]  Phase_CLK[2:0]
//   {0x29,    1,     {0x03} },    //Overlap_CLK[3:0]
//   {0x2A,    1,     {0x00} },
//   {0x2B,    1,     {0x00} },
//   {0x2C,    1,     {0x00} },
//   {0x2D,    1,     {0x00} },
//   {0x2E,    1,     {0x00} },
//   {0x2F,    1,     {0x00} },
//   {0x30,    1,     {0x00} },
//   {0x31,    1,     {0x00} },
//   {0x32,    1,     {0x00} },
//   {0x33,    1,     {0x00} },
//   {0x34,    1,     {0x04} },     //04 GPWR1/2 non overlap time 2.62us
//   {0x35,    1,     {0x00} },
//   {0x36,    1,     {0x00} },
//   {0x37,    1,     {0x00} },
//   {0x38,    1,     {0x3C} },     //78 FOR GPWR1/2 cycle 2 s
//   {0x39,    1,     {0x00} },
//   {0x3A,    1,     {0x00} },
//   {0x3B,    1,     {0x00} },
//   {0x3C,    1,     {0x00} },
//   {0x3D,    1,     {0x00} },
//   {0x3E,    1,     {0x00} },
//   {0x3F,    1,     {0x00} },
//   {0x40,    1,     {0x00} },
//   {0x41,    1,     {0x00} },
//   {0x42,    1,     {0x00} },
//   {0x43,    1,     {0x00} },
//   {0x44,    1,     {0x00} },


// //GIP_2
//   {0x50,    1,     {0x10} },
//   {0x51,    1,     {0x32} },
//   {0x52,    1,     {0x54} },
//   {0x53,    1,     {0x76} },
//   {0x54,    1,     {0x98} },
//   {0x55,    1,     {0xba} },
//   {0x56,    1,     {0x10} },
//   {0x57,    1,     {0x32} },
//   {0x58,    1,     {0x54} },
//   {0x59,    1,     {0x76} },
//   {0x5A,    1,     {0x98} },
//   {0x5B,    1,     {0xba} },
//   {0x5C,    1,     {0xdc} },
//   {0x5D,    1,     {0xfe} },

// //G0xIP_3
//   {0x5E,    1,     {0x00} },
//   {0x5F,    1,     {0x01} },      //GOUT1_FW
//   {0x60,    1,     {0x00} },      //GOUT2_BW
//   {0x61,    1,     {0x15} },      //GOUT3_GPWR1
//   {0x62,    1,     {0x14} },      //GOUT4_GPWR2
//   {0x63,    1,     {0x0E} },      //GOUT5_CLK1_R
//   {0x64,    1,     {0x0F} },      //GOUT6_CLK2_R
//   {0x65,    1,     {0x0C} },      //GOUT7_CLK3_R
//   {0x66,    1,     {0x0D} },      //GOUT8_CLK4_R
//   {0x67,    1,     {0x06} },      //GOUT9_STV1_R
//   {0x68,    1,     {0x02} },
//   {0x69,    1,     {0x02} },
//   {0x6A,    1,     {0x02} },
//   {0x6B,    1,     {0x02} },
//   {0x6C,    1,     {0x02} },
//   {0x6D,    1,     {0x02} },
//   {0x6E,    1,     {0x07} },       //GOUT16_STV2_R
//   {0x6F,    1,     {0x02} },       //GOUT17_VGL
//   {0x70,    1,     {0x02} },       //GOUT18_VGL
//   {0x71,    1,     {0x02} },       //GOUT19_VGL
//   {0x72,    1,     {0x02} },
//   {0x73,    1,     {0x02} },
//   {0x74,    1,     {0x02} },

//   {0x75,    1,     {0x01} },       //FW
//   {0x76,    1,     {0x00} },       //BW
//   {0x77,    1,     {0x14} },       //GPWR1
//   {0x78,    1,     {0x15} },       //GPWR2
//   {0x79,    1,     {0x0E} },       //CLK1_R
//   {0x7A,    1,     {0x0F} },       //CLK2_R
//   {0x7B,    1,     {0x0C} },       //CLK3_R
//   {0x7C,    1,     {0x0D} },       //CLK4_R
//   {0x7D,    1,     {0x06} },       //STV1_R
//   {0x7E,    1,     {0x02} },
//   {0x7F,    1,     {0x02} },
//   {0x80,    1,     {0x02} },
//   {0x81,    1,     {0x02} },
//   {0x82,    1,     {0x02} },
//   {0x83,    1,     {0x02} },
//   {0x84,    1,     {0x07} },       //STV2_R
//   {0x85,    1,     {0x02} },       //VGL
//   {0x86,    1,     {0x02} },       //VGL
//   {0x87,    1,     {0x02} },       //VGL
//   {0x88,    1,     {0x02} },
//   {0x89,    1,     {0x02} },
//   {0x8A,    1,     {0x02} },

// //CMD_Page 4
//   {0xFF,    3,     {0x98, 0x81, 0x04} },
//   {0x6C,    1,     {0x15} },        //Set VCORE voltage =1.5V
//   {0x6E,    1,     {0x2A} },        //di_pwr_reg=0 for power mode 2A //VGH clamp 15V
//   {0x6F,    1,     {0x33} },        // reg vcl + pumping ratio VGH=3x VGL=-2.5x
//   {0x3A,    1,     {0x92} },        //POWER SAVING
//   {0x8D,    1,     {0x1A} },        //VGL clamp -11V
//   {0x87,    1,     {0xBA} },        //ESD
//   {0x26,    1,     {0x76} },
//   {0xB2,    1,     {0xD1} },
//   {0xB5,    1,     {0x27} },        //GMA BIAS
//   {0x31,    1,     {0x75} },        //SRC BIAS
//   {0x30,    1,     {0x03} },        //SRC OUTPUT BIAS
//   {0x3B,    1,     {0x98} },        //PUMP SHIFT CLK
//   {0x35,    1,     {0x17} },        //HZ_opt
//   {0x33,    1,     {0x14} },        //Blanking frame 設定為GND
//   {0x38,    1,     {0x01} },
//   {0x39,    1,     {0x00} },


// //CMD_Page 1
//   {0xFF,    3,     {0x98, 0x81, 0x01} },
//   {0x22,    1,     {0x0A} },		//BGR, SS
//   {0x31,    1,     {0x00} },		//column inversion
//   {0x53,    1,     {0x3C} },		//VCOM1
//   {0x55,    1,     {0x8F} },		//VCOM2
//   {0x50,    1,     {0xC0} },		//VREG1OUT=5V
//   {0x51,    1,     {0xC0} },		//VREG2OUT=-5V
//   {0x60,    1,     {0x14} },               //SDT



//   {0xA0,    1,     {0x08} },		//VP255	Gamma P
//   {0xA1,    1,     {0x10} },               //VP251
//   {0xA2,    1,     {0x25} },               //VP247
//   {0xA3,    1,     {0x00} },               //VP243
//   {0xA4,    1,     {0x24} },               //VP239
//   {0xA5,    1,     {0x19} },               //VP231
//   {0xA6,    1,     {0x12} },               //VP219
//   {0xA7,    1,     {0x1B} },               //VP203
//   {0xA8,    1,     {0x77} },               //VP175
//   {0xA9,    1,     {0x19} },               //VP144
//   {0xAA,    1,     {0x25} },               //VP111
//   {0xAB,    1,     {0x6E} },               //VP80
//   {0xAC,    1,     {0x20} },               //VP52
//   {0xAD,    1,     {0x17} },               //VP36
//   {0xAE,    1,     {0x54} },               //VP24
//   {0xAF,    1,     {0x24} },               //VP16
//   {0xB0,    1,     {0x27} },               //VP12
//   {0xB1,    1,     {0x52} },               //VP8
//   {0xB2,    1,     {0x63} },               //VP4
//   {0xB3,    1,     {0x39} },               //VP0

//   {0xC0,    1,     {0x08} },		//VN255 GAMMA N
//   {0xC1,    1,     {0x20} },               //VN251
//   {0xC2,    1,     {0x23} },               //VN247
//   {0xC3,    1,     {0x22} },               //VN243
//   {0xC4,    1,     {0x06} },               //VN239
//   {0xC5,    1,     {0x34} },               //VN231
//   {0xC6,    1,     {0x25} },               //VN219
//   {0xC7,    1,     {0x20} },               //VN203
//   {0xC8,    1,     {0x86} },               //VN175
//   {0xC9,    1,     {0x1F} },               //VN144
//   {0xCA,    1,     {0x2B} },               //VN111
//   {0xCB,    1,     {0x74} },               //VN80
//   {0xCC,    1,     {0x16} },               //VN52
//   {0xCD,    1,     {0x1B} },               //VN36
//   {0xCE,    1,     {0x46} },               //VN24
//   {0xCF,    1,     {0x21} },               //VN16
//   {0xD0,    1,     {0x29} },               //VN12
//   {0xD1,    1,     {0x54} },               //VN8
//   {0xD2,    1,     {0x65} },               //VN4
//   {0xD3,    1,     {0x39} },               //VN0

// //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)
{
	printk("********uboot的init执行********\r\n");
	sunxi_lcd_dsi_clk_enable(sel);
	sunxi_lcd_delay_ms(20);
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_EXIT_SLEEP_MODE);//退出睡眠   0x11 在de_dsi.h中
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SET_DISPLAY_ON);//打开显示    0x29
	sunxi_lcd_delay_ms(10);
	return;
}
//执行关屏代码
static void LCD_panel_exit(u32 sel)
{
	printk("********uboot的exit执行********\r\n");
    sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SET_DISPLAY_OFF);//0x28   退出显示
	sunxi_lcd_delay_ms(20);
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_ENTER_SLEEP_MODE);//0x10   进入睡眠
	sunxi_lcd_delay_ms(80);
	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 SY101WXB65_mipi_panel = {
	/* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */
	.name = "SY101WXB65",
	.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, */
	},
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.
  • 202.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207.
  • 208.
  • 209.
  • 210.
  • 211.
  • 212.
  • 213.
  • 214.
  • 215.
  • 216.
  • 217.
  • 218.
  • 219.
  • 220.
  • 221.
  • 222.
  • 223.
  • 224.
  • 225.
  • 226.
  • 227.
  • 228.
  • 229.
  • 230.
  • 231.
  • 232.
  • 233.
  • 234.
  • 235.
  • 236.
  • 237.
  • 238.
  • 239.
  • 240.
  • 241.
  • 242.
  • 243.
  • 244.
  • 245.
  • 246.
  • 247.
  • 248.
  • 249.
  • 250.
  • 251.
  • 252.
  • 253.
  • 254.
  • 255.
  • 256.
  • 257.
  • 258.
  • 259.
  • 260.
  • 261.
  • 262.
  • 263.
  • 264.
  • 265.
  • 266.
  • 267.
  • 268.
  • 269.
  • 270.
  • 271.
  • 272.
  • 273.
  • 274.
  • 275.
  • 276.
  • 277.
  • 278.
  • 279.
  • 280.
  • 281.
  • 282.
  • 283.
  • 284.
  • 285.
  • 286.
  • 287.
  • 288.
  • 289.
  • 290.
  • 291.
  • 292.
  • 293.
  • 294.
  • 295.
  • 296.
  • 297.
  • 298.
  • 299.
  • 300.
  • 301.
  • 302.
  • 303.
  • 304.
  • 305.
  • 306.
  • 307.
  • 308.
  • 309.
  • 310.
  • 311.
  • 312.
  • 313.
  • 314.
  • 315.
  • 316.
  • 317.
  • 318.
  • 319.
  • 320.
  • 321.
  • 322.
  • 323.
  • 324.
  • 325.
  • 326.
  • 327.
  • 328.
  • 329.
  • 330.
  • 331.
  • 332.
  • 333.
  • 334.
  • 335.
  • 336.
  • 337.
  • 338.
  • 339.
  • 340.
  • 341.
  • 342.
  • 343.
  • 344.
  • 345.
  • 346.
  • 347.
  • 348.
  • 349.
  • 350.
  • 351.
  • 352.
  • 353.
  • 354.
  • 355.
  • 356.
  • 357.
  • 358.
  • 359.
  • 360.
  • 361.
  • 362.
  • 363.
  • 364.
  • 365.
  • 366.
  • 367.
  • 368.
  • 369.
  • 370.
  • 371.
  • 372.
  • 373.
  • 374.
  • 375.
  • 376.
  • 377.
  • 378.
  • 379.
  • 380.
  • 381.
  • 382.
  • 383.
  • 384.
  • 385.
  • 386.
  • 387.
  • 388.
  • 389.
  • 390.
  • 391.
  • 392.
  • 393.
  • 394.
  • 395.
  • 396.
  • 397.
  • 398.
  • 399.
  • 400.
  • 401.
  • 402.
  • 403.
  • 404.
  • 405.
  • 406.
  • 407.
  • 408.
  • 409.
  • 410.
  • 411.
  • 412.
  • 413.
  • 414.
  • 415.
  • 416.
  • 417.
  • 418.
  • 419.
  • 420.
  • 421.
  • 422.
  • 423.
  • 424.
  • 425.
  • 426.
  • 427.
  • 428.
  • 429.
  • 430.
  • 431.
  • 432.
  • 433.
  • 434.
  • 435.
  • 436.
  • 437.
  • 438.
  • 439.
  • 440.
  • 441.
  • 442.
  • 443.

SY101WXB65.h

#ifndef __SY101WXB65
#define __SY101WXB65
#include "panels.h"

extern __lcd_panel_t SY101WXB65_mipi_panel;
#endif // !_SY101WXB65
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

内核中

路径:W:\T527_Android13_V1.0_20231205\android\longan\bsp\drivers\video\sunxi\disp2\disp\lcd\SY101WXB65.c

SY101WXB65.c

#include "SY101WXB65.h"
#include "panels.h"

//获取屏幕screen_id  info 是一个指向用于存储面板信息的结构体的指针
//extern s32 bsp_disp_get_panel_info(u32 screen_id, struct 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_init(u32 sel);
static void LCD_panel_exit(u32 sel);



//#define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 15, val)   //复用引脚  PH15
//#define panel_mipi(val) sunxi_lcd_gpio_set_value(sel,,val);      //MIPI引脚     
//#define power_bl(val) sunxi_lcd_gpio_set_value(sel, 2, val)      //背光引脚   PI2
//#define power_pin(val) sunxi_lcd_gpio_set_value(sel, , val)      //供电引脚   长供电   
//lcd屏幕参数设计
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; 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, 10);   
	LCD_OPEN_FUNC(sel, LCD_bl_open, 0);   
	printk("********内核执行开屏函数********\r\n");  
    return 0;
}

//注册关屏函数
static s32 LCD_close_flow(u32 sel)
{
	
    LCD_CLOSE_FUNC(sel, LCD_bl_close, 10);      
	LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 10);         
	LCD_CLOSE_FUNC(sel, LCD_panel_exit,	10);   
	LCD_CLOSE_FUNC(sel, LCD_power_off, 0); 
	printk("********内核执行关屏函数********\r\n");
    return 0;
}

//打开lcd电源  
static void LCD_power_on(u32 sel)
{
	
	//1.电源--   2.复位引脚电平---   3.pinctrl引脚电平----
    //一上电,低电平
	sunxi_lcd_power_disable(sel,0);
	sunxi_lcd_power_disable(sel,1);
    sunxi_lcd_gpio_set_value(sel,0,0);
    sunxi_lcd_pin_cfg(sel, 0);
        //延迟500us
    sunxi_lcd_delay_us(10);
    //VCC电源打开
    sunxi_lcd_power_enable(sel,0); 
	sunxi_lcd_power_enable(sel,1); 
    //延迟500us
    sunxi_lcd_delay_us(500);
    //IOVCC
    sunxi_lcd_pin_cfg(sel, 1);
    //延迟500us
    sunxi_lcd_delay_us(500);
    //高电平复位
    sunxi_lcd_gpio_set_value(sel,0,1);
    sunxi_lcd_delay_us(500);
    //低电平复位
    sunxi_lcd_gpio_set_value(sel,0,0);
    sunxi_lcd_delay_us(20);
    //高电平复位
    sunxi_lcd_gpio_set_value(sel,0,1);
	printk("********内核执行打开电源********\r\n");
}

//关闭lcd电源
static void LCD_power_off(u32 sel)
{
	
	//1.关电源   2.设置复位低电平   3.pinctrl拉低
	sunxi_lcd_gpio_set_value(sel, 0, 0);
	//关闭背光后40ms关闭mipi传输
    //关闭mipi传输后持续1ms拉低复位电平
	sunxi_lcd_delay_ms(1);
	sunxi_lcd_pin_cfg(sel, 0);
	//之后设为低电平持续500ms之后再将电平拉高
	sunxi_lcd_power_disable(sel, 0);
	sunxi_lcd_power_disable(sel, 1);
	sunxi_lcd_delay_ms(500);
	sunxi_lcd_power_enable(sel, 0);
	sunxi_lcd_power_enable(sel, 1);
	printk("********内核执行关闭电源********\r\n");
}

//开启屏幕背光
static void LCD_bl_open(u32 sel)
{
    sunxi_lcd_pwm_enable(sel);
	//sunxi_lcd_delay_ms(50);
	//sunxi_lcd_backlight_enable(sel);
	printk("********内核执行开启背光********\r\n");
}
//关闭屏幕背光
static void LCD_bl_close(u32 sel)
{
	sunxi_lcd_pwm_disable(sel);
   // sunxi_lcd_delay_ms(20);
	//sunxi_lcd_backlight_disable(sel);
	printk("********内核执行关闭背光********\r\n");
}


#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];
// };

// static struct LCM_setting_table lcm_initialization_setting[] = {
// 	{0xFF,    3,     {0x98, 0x81, 0x03} },

// /* GIP_1 */

// 	{0x01,    1,     {0x00} },
// 	{0x02,    1,     {0x00} },
// 	{0x03,    1,     {0x73} },     /* STA Width 4H */
// 	{0x04,    1,     {0x00} },
// 	{0x05,    1,     {0x00} },
// 	{0x06,    1,     {0x0A} },     /* STVA Rise start */
// 	{0x07,    1,     {0x00} },
// 	{0x08,    1,     {0x00} },
// 	{0x09,    1,     {0x20} },     /* Detail A&B 3.5-4.0us */
// 	{0x0A,    1,     {0x20} },     /* Detail A&B 3.5-4.0us */
// 	{0x0B,    1,     {0x00} },
// 	{0x0C,    1,     {0x00} },
// 	{0x0D,    1,     {0x00} },
// 	{0x0E,    1,     {0x00} },
// 	{0x0F,    1,     {0x20} },     /* Detail A&B 3.5-4.0us */
// 	{0x10,    1,     {0x20} },     /* Detail A&B 3.5-4.0us */
// 	{0x11,    1,     {0x00} },
// 	{0x12,    1,     {0x00} },
// 	{0x13,    1,     {0x00} },
// 	{0x14,    1,     {0x00} },
// 	{0x15,    1,     {0x00} },
// 	{0x16,    1,     {0x00} },
// 	{0x17,    1,     {0x00} },
// 	{0x18,    1,     {0x00} },
// 	{0x19,    1,     {0x00} },
// 	{0x1A,    1,     {0x00} },
// 	{0x1B,    1,     {0x00} },
// 	{0x1C,    1,     {0x00} },
// 	{0x1D,    1,     {0x00} },
// 	{0x1E,    1,     {0x40} },
// 	{0x1F,    1,     {0x80} },
// 	{0x20,    1,     {0x06} },    /* CLKA Rise START */
// 	{0x21,    1,     {0x01} },    /* CLKA FALL END */
// 	{0x22,    1,     {0x00} },
// 	{0x23,    1,     {0x00} },
// 	{0x24,    1,     {0x00} },
// 	{0x25,    1,     {0x00} },
// 	{0x26,    1,     {0x00} },
// 	{0x27,    1,     {0x00} },
// 	{0x28,    1,     {0x33} },    /* CLK_x_Numb[2:0]  Phase_CLK[2:0] */
// 	{0x29,    1,     {0x03} },    /* Overlap_CLK[3:0] */
// 	{0x2A,    1,     {0x00} },
// 	{0x2B,    1,     {0x00} },
// 	{0x2C,    1,     {0x00} },
// 	{0x2D,    1,     {0x00} },
// 	{0x2E,    1,     {0x00} },
// 	{0x2F,    1,     {0x00} },
// 	{0x30,    1,     {0x00} },
// 	{0x31,    1,     {0x00} },
// 	{0x32,    1,     {0x00} },
// 	{0x33,    1,     {0x00} },
// 	{0x34,    1,     {0x04} },     /* 04 GPWR1/2 non overlap time 2.62us */
// 	{0x35,    1,     {0x00} },
// 	{0x36,    1,     {0x00} },
// 	{0x37,    1,     {0x00} },
// 	{0x38,    1,     {0x3C} },     /* 78 FOR GPWR1/2 cycle 2 s */
// 	{0x39,    1,     {0x00} },
// 	{0x3A,    1,     {0x00} },
// 	{0x3B,    1,     {0x00} },
// 	{0x3C,    1,     {0x00} },
// 	{0x3D,    1,     {0x00} },
// 	{0x3E,    1,     {0x00} },
// 	{0x3F,    1,     {0x00} },
// 	{0x40,    1,     {0x00} },
// 	{0x41,    1,     {0x00} },
// 	{0x42,    1,     {0x00} },
// 	{0x43,    1,     {0x00} },
// 	{0x44,    1,     {0x00} },


// /* GIP_2 */
// 	{0x50,    1,     {0x10} },
// 	{0x51,    1,     {0x32} },
// 	{0x52,    1,     {0x54} },
// 	{0x53,    1,     {0x76} },
// 	{0x54,    1,     {0x98} },
// 	{0x55,    1,     {0xba} },
// 	{0x56,    1,     {0x10} },
// 	{0x57,    1,     {0x32} },
// 	{0x58,    1,     {0x54} },
// 	{0x59,    1,     {0x76} },
// 	{0x5A,    1,     {0x98} },
// 	{0x5B,    1,     {0xba} },
// 	{0x5C,    1,     {0xdc} },
// 	{0x5D,    1,     {0xfe} },

// /* G0xIP_3 */
// 	{0x5E,    1,     {0x00} },
// 	{0x5F,    1,     {0x01} },      /* GOUT1_FW */
// 	{0x60,    1,     {0x00} },      /* GOUT2_BW */
// 	{0x61,    1,     {0x15} },      /* GOUT3_GPWR1 */
// 	{0x62,    1,     {0x14} },      /* GOUT4_GPWR2 */
// 	{0x63,    1,     {0x0E} },      /* GOUT5_CLK1_R */
// 	{0x64,    1,     {0x0F} },      /* GOUT6_CLK2_R */
// 	{0x65,    1,     {0x0C} },      /* GOUT7_CLK3_R */
// 	{0x66,    1,     {0x0D} },      /* GOUT8_CLK4_R */
// 	{0x67,    1,     {0x06} },      /* GOUT9_STV1_R */
// 	{0x68,    1,     {0x02} },
// 	{0x69,    1,     {0x02} },
// 	{0x6A,    1,     {0x02} },
// 	{0x6B,    1,     {0x02} },
// 	{0x6C,    1,     {0x02} },
// 	{0x6D,    1,     {0x02} },
// 	{0x6E,    1,     {0x07} },       /* GOUT16_STV2_R */
// 	{0x6F,    1,     {0x02} },       /* GOUT17_VGL */
// 	{0x70,    1,     {0x02} },       /* GOUT18_VGL */
// 	{0x71,    1,     {0x02} },       /* GOUT19_VGL */
// 	{0x72,    1,     {0x02} },
// 	{0x73,    1,     {0x02} },
// 	{0x74,    1,     {0x02} },

// 	{0x75,    1,     {0x01} },       /* FW */
// 	{0x76,    1,     {0x00} },       /* BW */
// 	{0x77,    1,     {0x14} },       /* GPWR1 */
// 	{0x78,    1,     {0x15} },       /* GPWR2 */
// 	{0x79,    1,     {0x0E} },       /* CLK1_R */
// 	{0x7A,    1,     {0x0F} },       /* CLK2_R */
// 	{0x7B,    1,     {0x0C} },       /* CLK3_R */
// 	{0x7C,    1,     {0x0D} },       /* CLK4_R */
// 	{0x7D,    1,     {0x06} },       /* STV1_R */
// 	{0x7E,    1,     {0x02} },
// 	{0x7F,    1,     {0x02} },
// 	{0x80,    1,     {0x02} },
// 	{0x81,    1,     {0x02} },
// 	{0x82,    1,     {0x02} },
// 	{0x83,    1,     {0x02} },
// 	{0x84,    1,     {0x07} },       /* STV2_R */
// 	{0x85,    1,     {0x02} },       /* VGL */
// 	{0x86,    1,     {0x02} },       /* VGL */
// 	{0x87,    1,     {0x02} },       /* VGL */
// 	{0x88,    1,     {0x02} },
// 	{0x89,    1,     {0x02} },
// 	{0x8A,    1,     {0x02} },

// /* CMD_Page 4 */
// 	{0xFF,    3,     {0x98, 0x81, 0x04} },
// 	{0x6C,    1,     {0x15} },        /* Set VCORE voltage =1.5V */
// 	{0x6E,    1,     {0x2A} },        /* di_pwr_reg=0 for power mode 2A //VGH clamp 15V */
// 	{0x6F,    1,     {0x33} },        /* reg vcl + pumping ratio VGH=3x VGL=-2.5x */
// 	{0x3A,    1,     {0x92} },        /* POWER SAVING */
// 	{0x8D,    1,     {0x1A} },        /* VGL clamp -11V */
// 	{0x87,    1,     {0xBA} },        /* ESD */
// 	{0x26,    1,     {0x76} },
// 	{0xB2,    1,     {0xD1} },
// 	{0xB5,    1,     {0x27} },        /* GMA BIAS */
// 	{0x31,    1,     {0x75} },        /* SRC BIAS */
// 	{0x30,    1,     {0x03} },        /* SRC OUTPUT BIAS */
// 	{0x3B,    1,     {0x98} },        /* PUMP SHIFT CLK */
// 	{0x35,    1,     {0x17} },        /* HZ_opt */
// 	{0x33,    1,     {0x14} },        /* Blanking frame set GND */
// 	{0x38,    1,     {0x01} },
// 	{0x39,    1,     {0x00} },


// /* CMD_Page 1 */
// 	{0xFF,    3,     {0x98, 0x81, 0x01} },
// 	{0x22,    1,     {0x0A} },		/* BGR, SS */
// 	{0x31,    1,     {0x00} },		/* column inversion */
// 	{0x53,    1,     {0x3C} },		/* VCOM1 */
// 	{0x55,    1,     {0x8F} },		/* VCOM2 */
// 	{0x50,    1,     {0xC0} },		/* VREG1OUT=5V */
// 	{0x51,    1,     {0xC0} },		/* VREG2OUT=-5V */
// 	{0x60,    1,     {0x14} },               /* SDT */



// 	{0xA0,    1,     {0x08} },		/* VP255	Gamma P */
// 	{0xA1,    1,     {0x10} },               /* VP251 */
// 	{0xA2,    1,     {0x25} },               /* VP247 */
// 	{0xA3,    1,     {0x00} },               /* VP243 */
// 	{0xA4,    1,     {0x24} },               /* VP239 */
// 	{0xA5,    1,     {0x19} },               /* VP231 */
// 	{0xA6,    1,     {0x12} },               /* VP219 */
// 	{0xA7,    1,     {0x1B} },               /* VP203 */
// 	{0xA8,    1,     {0x77} },               /* VP175 */
// 	{0xA9,    1,     {0x19} },               /* VP144 */
// 	{0xAA,    1,     {0x25} },               /* VP111 */
// 	{0xAB,    1,     {0x6E} },               /* VP80 */
// 	{0xAC,    1,     {0x20} },               /* VP52 */
// 	{0xAD,    1,     {0x17} },               /* VP36 */
// 	{0xAE,    1,     {0x54} },               /* VP24 */
// 	{0xAF,    1,     {0x24} },               /* VP16 */
// 	{0xB0,    1,     {0x27} },               /* VP12 */
// 	{0xB1,    1,     {0x52} },               /* VP8 */
// 	{0xB2,    1,     {0x63} },               /* VP4 */
// 	{0xB3,    1,     {0x39} },               /* VP0 */

// 	{0xC0,    1,     {0x08} },		/* VN255 GAMMA N */
// 	{0xC1,    1,     {0x20} },               /* VN251 */
// 	{0xC2,    1,     {0x23} },               /* VN247 */
// 	{0xC3,    1,     {0x22} },               /* VN243 */
// 	{0xC4,    1,     {0x06} },               /* VN239 */
// 	{0xC5,    1,     {0x34} },               /* VN231 */
// 	{0xC6,    1,     {0x25} },               /* VN219 */
// 	{0xC7,    1,     {0x20} },               /* VN203 */
// 	{0xC8,    1,     {0x86} },               /* VN175 */
// 	{0xC9,    1,     {0x1F} },               /* VN144 */
// 	{0xCA,    1,     {0x2B} },               /* VN111 */
// 	{0xCB,    1,     {0x74} },               /* VN80 */
// 	{0xCC,    1,     {0x16} },               /* VN52 */
// 	{0xCD,    1,     {0x1B} },               /* VN36 */
// 	{0xCE,    1,     {0x46} },               /* VN24 */
// 	{0xCF,    1,     {0x21} },               /* VN16 */
// 	{0xD0,    1,     {0x29} },               /* VN12 */
// 	{0xD1,    1,     {0x54} },               /* VN8 */
// 	{0xD2,    1,     {0x65} },               /* VN4 */
// 	{0xD3,    1,     {0x39} },               /* VN0 */

// /* 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)
{
    char model_name[25];
    disp_sys_script_get_item("lcd0", "SY101WXB65", (int *)model_name, 25);
    sunxi_lcd_dsi_clk_enable(sel);
    sunxi_lcd_delay_ms(20);
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_EXIT_SLEEP_MODE);//退出睡眠   0x11 在de_dsi.h中
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SET_DISPLAY_ON);//打开显示    0x29
	sunxi_lcd_delay_ms(10);

	printk("********内核执行init代码********\r\n");
    return ;
}
//执行关屏代码
static void LCD_panel_exit(u32 sel)
{
    sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_SET_DISPLAY_OFF);//0x28   退出显示
	sunxi_lcd_delay_ms(20);
	sunxi_lcd_dsi_dcs_write_0para(sel, DSI_DCS_ENTER_SLEEP_MODE);//0x10   进入睡眠
    sunxi_lcd_delay_ms(80);
	printk("********内核执行exit代码********\r\n");
}

static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3)
{

	return 0;
}

struct __lcd_panel SY101WXB65_mipi_panel = {
	/* panel driver name, must mach the name of lcd_drv_name in sys_config.fex */
	.name = "SY101WXB65",
	.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, */
	},
};
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.
  • 202.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207.
  • 208.
  • 209.
  • 210.
  • 211.
  • 212.
  • 213.
  • 214.
  • 215.
  • 216.
  • 217.
  • 218.
  • 219.
  • 220.
  • 221.
  • 222.
  • 223.
  • 224.
  • 225.
  • 226.
  • 227.
  • 228.
  • 229.
  • 230.
  • 231.
  • 232.
  • 233.
  • 234.
  • 235.
  • 236.
  • 237.
  • 238.
  • 239.
  • 240.
  • 241.
  • 242.
  • 243.
  • 244.
  • 245.
  • 246.
  • 247.
  • 248.
  • 249.
  • 250.
  • 251.
  • 252.
  • 253.
  • 254.
  • 255.
  • 256.
  • 257.
  • 258.
  • 259.
  • 260.
  • 261.
  • 262.
  • 263.
  • 264.
  • 265.
  • 266.
  • 267.
  • 268.
  • 269.
  • 270.
  • 271.
  • 272.
  • 273.
  • 274.
  • 275.
  • 276.
  • 277.
  • 278.
  • 279.
  • 280.
  • 281.
  • 282.
  • 283.
  • 284.
  • 285.
  • 286.
  • 287.
  • 288.
  • 289.
  • 290.
  • 291.
  • 292.
  • 293.
  • 294.
  • 295.
  • 296.
  • 297.
  • 298.
  • 299.
  • 300.
  • 301.
  • 302.
  • 303.
  • 304.
  • 305.
  • 306.
  • 307.
  • 308.
  • 309.
  • 310.
  • 311.
  • 312.
  • 313.
  • 314.
  • 315.
  • 316.
  • 317.
  • 318.
  • 319.
  • 320.
  • 321.
  • 322.
  • 323.
  • 324.
  • 325.
  • 326.
  • 327.
  • 328.
  • 329.
  • 330.
  • 331.
  • 332.
  • 333.
  • 334.
  • 335.
  • 336.
  • 337.
  • 338.
  • 339.
  • 340.
  • 341.
  • 342.
  • 343.
  • 344.
  • 345.
  • 346.
  • 347.
  • 348.
  • 349.
  • 350.
  • 351.
  • 352.
  • 353.
  • 354.
  • 355.
  • 356.
  • 357.
  • 358.
  • 359.
  • 360.
  • 361.
  • 362.
  • 363.
  • 364.
  • 365.
  • 366.
  • 367.
  • 368.
  • 369.
  • 370.
  • 371.
  • 372.
  • 373.
  • 374.
  • 375.
  • 376.
  • 377.
  • 378.
  • 379.
  • 380.
  • 381.
  • 382.
  • 383.
  • 384.
  • 385.
  • 386.
  • 387.
  • 388.
  • 389.
  • 390.
  • 391.
  • 392.
  • 393.
  • 394.
  • 395.
  • 396.
  • 397.
  • 398.
  • 399.
  • 400.
  • 401.
  • 402.
  • 403.
  • 404.
  • 405.
  • 406.
  • 407.
  • 408.
  • 409.
  • 410.
  • 411.
  • 412.
  • 413.
  • 414.
  • 415.
  • 416.
  • 417.
  • 418.
  • 419.
  • 420.
  • 421.
  • 422.
  • 423.
  • 424.
  • 425.
  • 426.
  • 427.
  • 428.
  • 429.
  • 430.
  • 431.
  • 432.
  • 433.
  • 434.
  • 435.
  • 436.
  • 437.
  • 438.
  • 439.
  • 440.
  • 441.
  • 442.
  • 443.
  • 444.
  • 445.
  • 446.
  • 447.
  • 448.
  • 449.
  • 450.

SY101WXB65.h

#ifndef _SY101WXB65
#define _SY101WXB65
#include "panels.h"


extern struct __lcd_panel SY101WXB65_mipi_panel;
#endif // !_SY101WXB65
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.