Linux驱动--触摸显示屏适配
触摸显示屏
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 | panel: panel { |
Or:
1 | &dsi { |
display
1、display-timing 参数说明如下:
1 | +----------+-------------------------------------+----------+-------+ |
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 | display-timings { |
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>;
};
1 | 屏幕技术文档参数 |
&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 | 中断触发方式 |
#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//低电平触发
```