显示及触摸接口配置
1. TTL Panel配置¶
从开发板原理图可以看到接入7寸ttl屏时使用的是RGB888格式,各个端口连接与端口复用表中的ttl24_mode_4一致,如下图:
在dts中添加如下配置:
soc { padmux { //TTL24_MODE 4 <PAD_GPIO0 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R0 >, <PAD_GPIO1 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R1 >, <PAD_GPIO2 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R2 >, <PAD_TX0_IO00 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R3 >, <PAD_TX0_IO01 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R4 >, <PAD_TX0_IO02 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R5 >, <PAD_TX0_IO03 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R6 >, <PAD_TX0_IO04 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_R7 >, <PAD_GPIO3 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G0 >, <PAD_GPIO4 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G1 >, <PAD_TX0_IO05 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G2 >, <PAD_TX0_IO06 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G3 >, <PAD_TX0_IO07 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G4 >, <PAD_TX0_IO08 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G5 >, <PAD_TX0_IO09 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G6 >, <PAD_TTL18 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_G7 >, <PAD_GPIO5 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B0 >, <PAD_GPIO6 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B1 >, <PAD_GPIO7 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B2 >, <PAD_TTL19 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B3 >, <PAD_TTL20 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B4 >, <PAD_TTL21 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B5 >, <PAD_TTL22 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B6 >, <PAD_TTL23 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_B7 >, <PAD_TTL24 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_LDE>, <PAD_TTL25 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_LVSYNC>, <PAD_TTL26 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_LHSYNC>, <PAD_TTL27 PINMUX_FOR_TTL24_MODE_4 MDRV_PUSE_TTL24_LCK>; }; };
注意,请逐个确认所使用的这些端口未被配置为其他功能,否则可能会出现一些未知的异常。
2. MIPI Panel配置¶
MIPI输出口支持4lane及2lane输出,当前开发板有两个4lane mipi口接插座,共用一组mipi tx引脚,线序定义如下表格:
Pad name | Mipi channel | 10.1'@31pin | 40pin |
---|---|---|---|
PAD_TX0_IO00/TTL_R3 | MIPI_TX_CH0P | MIPI_TX_D2P | MIPI_TX_D3P |
PAD_TX0_IO01/TTL_R4 | MIPI_TX_CH0N | MIPI_TX_D2N | MIPI_TX_D3N |
PAD_TX0_IO02/TTL_R5 | MIPI_TX_CH1P | MIPI_TX_D1P | MIPI_TX_D2P |
PAD_TX0_IO03/TTL_R6 | MIPI_TX_CH1N | MIPI_TX_D1N | MIPI_TX_D2N |
PAD_TX0_IO04/TTL_R7 | MIPI_TX_CH2P | MIPI_TX_CKP | MIPI_TX_CKP |
PAD_TX0_IO05/TTL_G2 | MIPI_TX_CH2N | MIPI_TX_CKN | MIPI_TX_CKN |
PAD_TX0_IO06/TTL_G3 | MIPI_TX_CH3P | MIPI_TX_D0P | MIPI_TX_D1P |
PAD_TX0_IO07/TTL_G4 | MIPI_TX_CH3N | MIPI_TX_D0N | MIPI_TX_D1N |
PAD_TX0_IO08/TTL_G5 | MIPI_TX_CH4P | MIPI_TX_D3P | MIPI_TX_D0P |
PAD_TX0_IO09/TTL_G6 | MIPI_TX_CH4N | MIPI_TX_D3P | MIPI_TX_D0N |
根据以上表格的对应关系,应在屏参文件(config.ini)中配置MIPI tx相关参数,如31pin接口接入10.1寸MIPI屏(主控IC:ILI9881C)时屏参mipi lane相关参数配置为:
m_eLaneNum = 4; #1:one lane, 2:two lane, 3:three lane, 4:four lane m_eFormat = 3; #0:rgb565, 1:rgb666, 2:loosely rgb666, 3:rgb888 m_eCtrlMode = 1; #0:cmd mode, 1:sync pluse, 2:sync event, 3:burst mode m_wDataClkSkew = 7; m_ucClkLane = 2; m_ucDataLane0 = 3; m_ucDataLane1 = 1; m_ucDataLane2 = 0; m_ucDataLane3 = 4; m_ucPolCh0 = 0; m_ucPolCh1 = 0; m_ucPolCh2 = 0; m_ucPolCh3 = 0; m_ucPolCh4 = 0;
40ping接口的屏参mipi相关参数配置为:
m_eLaneNum = 4; #1:one lane, 2:two lane, 3:three lane, 4:four lane m_eFormat = 3; #0:rgb565, 1:rgb666, 2:loosely rgb666, 3:rgb888 m_eCtrlMode = 1; #0:cmd mode, 1:sync pluse, 2:sync event, 3:burst mode m_wDataClkSkew = 7; m_ucClkLane = 2; m_ucDataLane0 = 4; m_ucDataLane1 = 3; m_ucDataLane2 = 1; m_ucDataLane3 = 0; m_ucPolCh0 = 0; m_ucPolCh1 = 0; m_ucPolCh2 = 0; m_ucPolCh3 = 0; m_ucPolCh4 = 0;
注意,当前开发板的mipi屏接口与TTL屏的引脚有复用,因此这两种屏无法同时使用,使用mipi屏时应注释掉ttl屏的dts相关配置。
3. 触摸屏配置¶
当前开发板外接的TTL或mipi屏的触摸模块使用的主控均为GT911,通过I2C接口与主芯片连接,硬件连接如下:
-
对照端口复用表配置dts
在padmux中将I2C0_SCL/SDA两个引脚配置为I2C功能。
<PAD_I2C0_SCL PINMUX_FOR_I2C0_MODE_7 MDRV_PUSE_I2C0_SCL>, <PAD_I2C0_SDA PINMUX_FOR_I2C0_MODE_7 MDRV_PUSE_I2C0_SDA>,
在I2C0节点下配置触摸屏相关参数
i2c0@0{ compatible = "sstar,i2c"; reg = <0x1F223000 0x200>,<0x1F207800 0x200>,<0x1F207000 0x200>; interrupts=<GIC_SPI INT_IRQ_MIIC_0 IRQ_TYPE_LEVEL_HIGH>; clocks = <&CLK_miic0>; #address-cells = <1>; #size-cells = <0>; i2c-group = <0>; status = "ok"; + + //interrupts=<GIC_SPI INT_IRQ_MIIC_0 IRQ_TYPE_LEVEL_HIGH>; + goodix_gt911@5D{ + compatible = "goodix,gt911"; + reg = <0x5D>; + goodix_rst = <PAD_GPIO13>; + goodix_int = <PAD_GPIO14>; + interrupts-extended = <&ms_gpi_intc INT_GPI_FIQ_PAD_GPIO14>; + interrupt-names = "goodix_int"; + }; };
- kernel defconfig中启用触摸屏并使用正确的驱动
-# CONFIG_INPUT_TOUCHSCREEN is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_GOODIX=y
注意,触摸屏的中断与复位(GPIO13、GPIO14)引脚与JTAG引脚有冲突(GPIO13~GPIO16),因此IPL与IPL_CUST需使用NO_JTAG
的版本,否则会概率性出现触摸屏无法识别问题。