触摸显示屏 panel 1、属性值配置:
power-supply: 配置电源
compatible: 可以配置成以下值: “simple-panel”; “simple-panel-dsi”;
ddc-i2c-bus: 给DDC EDID配置I2C控制器;
enable-gpios: 配置panel的使能脚;
reset-gpios: 配置panel的复位脚;
backlight: 指向背光的dts配置节点;
reset-delay-ms: 配置reset的脉冲时延;
enable-delay-ms: 配置panel显示前的延时值;
prepare-delay-ms: 配置panel接收图像数据前的延时值;
disable-delay-ms: 配置panel关闭前的延时值;
unprepare-delay-ms: 配置panel黑屏前的延时值;
width-mm: 配置panel的物理宽度尺寸[mm];
height-mm: 配置panel的物理高度尺寸[mm];
bpc: 配置像素点位深;
display-timings: 配置timing节点;
dsi,flags: 配置panel的使用的模式;
dsi,format: 配置panel像素格式;
dsi,lanes: 配置panel使用的lane数;
init-delay-ms: 配置panel在初始化前的延时值;
panel-init-sequence: byte 0: dcs 数据类型 byte 1: 指令发送之后的延时 byte 2: 指令长度 byte 3:数据
panel-exit-sequence: byte 0: dcs 数据类型 byte 1: 指令发送之后的延时 byte 2: 指令长度 byte 3:数据
power-invert:配置电源反转 if power-invert exist the panel power need to disable ldo when power on and enable ldo when power off otherwise it’s opposite.
2、实例:
Example:
1 2 3 4 5 6 7 8 9 panel: panel { compatible = "cptt,claa101wb01"; ddc-i2c-bus = <&panelddc>; power-supply = <&vdd_pnl_reg>; enable-gpios = <&gpio 90 0>; backlight = <&backlight>; };
Or:
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 &dsi { panel@0 { compatible = "simple-panel-dsi"; reg = <0>; backlight = <&backlight>; power-supply = <&vcc_lcd>; enable-gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; reset-delay-ms = <120>; init-delay-ms = <120>; enable-delay-ms = <120>; prepare-delay-ms = <120>; disable-delay-ms = <120>; unprepare-delay-ms = <120>; dsi,flags = <MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET>; dsi,format = <MIPI_DSI_FMT_RGB888>; dsi,lanes = <4>; panel-init-sequence = [ 39 00 10 b1 6c 15 15 24 E4 11 f1 80 e4 d7 23 80 c0 d2 58 ... 05 78 01 11 05 78 01 29 ]; panel-exit-sequence = [ 05 00 01 28 05 78 01 10 ]; display-timings { native-mode = <&timing0>; timing0: timing0 { clock-frequency = <160000000>; hactive = <1200>; vactive = <1920>; hback-porch = <21>; hfront-porch = <120>; vback-porch = <18>; vfront-porch = <21>; hsync-len = <20>; vsync-len = <3>; hsync-active = <0>; vsync-active = <0>; de-active = <0>; pixelclk-active = <0>; }; }; }; };
display 1、display-timing 参数说明如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +----------+-------------------------------------+----------+-------+ | | ↑ | | | | | |vback_porch | | | | | ↓ | | | +----------#######################################----------+-------+ | # ↑ # | | | # | # | | | hback # | # hfront | hsync | | porch # | hactive # porch | len | |<-------->#<-------+--------------------------->#<-------->|<----->| | # | # | | | # |vactive # | | | # | # | | | # ↓ # | | +----------#######################################----------+-------+ | | ↑ | | | | | |vfront_porch | | | | | ↓ | | | +----------+-------------------------------------+----------+-------+ | | ↑ | | | | | |vsync_len | | | | | ↓ | | | +----------+-------------------------------------+----------+-------+
2、display-timing 节点属性值配置:
native-mode: The native mode for the display, in case multiple modes are provided. When omitted, assume the first node is the native.
3、timing 子节点属性值配置:
hactive, vactive: 显示器的分辨率;
hfront-porch, hback-porch, hsync-len: 配置水平display-timing参数,以像素为单位; vfront-porch, vback-porch, vsync-len: 配置垂直display-timing参数,以像素为单位;
clock-frequency: 配置显示时钟,以HZ为单位;
hsync-active: 配置 hsync 脉冲有效极性,low/high/ignored
vsync-active: 配置 vsync 脉冲有效极性,low/high/ignored
de-active: 配置 data-enable 脉冲有效极性 low/high/ignored
pixelclk-active: with - active high = drive pixel data on rising edge/ sample data on falling edge - active low = drive pixel data on falling edge/ sample data on rising edge - ignored = ignored
interlaced (bool): boolean to enable interlaced mode
doublescan (bool): boolean to enable doublescan mode
doubleclk (bool): boolean to enable doubleclock mode
All the optional properties that are not bool follow the following logic: <1>: high active <0>: low active omitted: not used on hardware
4、实例,display-timing可以配置不同的信号timing,通过使用native-mode来指定使用的timing子节点,比如:
正常的使用如下:
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 display-timings { native-mode = <&timing0>; timing0: 1080p24 { /* 1920x1080p24 */ clock-frequency = <52000000>; hactive = <1920>; vactive = <1080>; hfront-porch = <25>; hback-porch = <25>; hsync-len = <25>; vback-porch = <2>; vfront-porch = <2>; vsync-len = <2>; hsync-active = <1>; }; };
如果要切换display-timing,可以再定义一个timing子节点,如下: Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 timing1: timing { /* 1920x1080p24 */ clock-frequency = <148500000>; hactive = <1920>; vactive = <1080>; hsync-len = <0 44 60>; hfront-porch = <80 88 95>; hback-porch = <100 148 160>; vfront-porch = <0 4 6>; vback-porch = <0 36 50>; vsync-len = <0 5 6>; };
屏幕技术文档参数如下:
每个屏幕都有vbp+vfp+vs
在填充6个参数时只需要满足关系:vbp+vfp+vs=文档值,hbp+hfp+hs=文档值,各值自行分配(通常hbp和vbp取较大值)
显示屏 LCD时序计算 clock-frequency 显示时钟 比如60hz刷新率 公式 :1940* 1340 * 60 = 155976000 显示时钟可以设置成 156000000
触摸驱动参考 目前适配的是synaptics 触摸屏,确保触摸驱动正确配置
i2c 设备树参考
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 &i2c5 { status = "okay"; synaptics@20 { status = "okay"; compatible = "synaptics,dsx-i2c"; reg = <0x20>; vdd-supply = <&vcc_3v3_s3>; // 对应pmu引脚或者供电引脚 avdd-supply = <&vcc_3v3_s3>; synaptics,pwr-reg-name = "avdd"; synaptics,bus-reg-name = "vdd"; synaptics,ub-i2c-addr = <0x2c>; pinctrl-0 = <&synaptics_irq>; // 中断引脚 pinctrl-1 = <&synaptics_rst>; // 复位引脚 synaptics,irq-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;// 这里需要注意 需要根据芯片引脚制定 synaptics,reset-gpio = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; synaptics,irq-on-state = <0>; synaptics,power-delay-ms = <200>; synaptics,reset-delay-ms = <200>; synaptics,reset-on-state = <0>; synaptics,reset-active-ms = <20>; synaptics,max-y-for-2d = <1200>; // synaptics,swap-axes = <1>; // x和y轴是否互换 根据实际情况配置 //synaptics,x-flip = <1>; // x轴翻转 // synaptics,y-flip = <1>; // y轴翻转 }; };
中断触发方式如下:
1 2 3 4 5 6 7 #define IRQ_TYPE_NONE 0 #define IRQ_TYPE_EDGE_RISING 1//上升沿触发 #define IRQ_TYPE_EDGE_FALLING 2//下降沿触发 #define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)//双边沿触发 #define IRQ_TYPE_LEVEL_HIGH 4//高电平触发 #define IRQ_TYPE_LEVEL_LOW 8//低电平触发