1 关键字

xts;hats;input;

2 问题描述

系统版本:OpenHarmony 3.1 Release

代码版本:OpenHarmony-v3.1-Release

问题现象:xts认证测试时,HatsHdfInputTest::HdiInputTestt测试套中有29个用例不过

SUB_DriverSystem_HdiInput_0010 SUB_DriverSystem_HdiInput_0020 SUB_DriverSystem_HdiInput_0040 SUB_DriverSystem_HdiInput_0050 SUB_DriverSystem_HdiInput_0070 SUB_DriverSystem_HdiInput_0080 SUB_DriverSystem_HdiInput_0100 SUB_DriverSystem_HdiInput_0110 SUB_DriverSystem_HdiInput_0130 SUB_DriverSystem_HdiInput_0140 SUB_DriverSystem_HdiInput_0160 SUB_DriverSystem_HdiInput_0170 SUB_DriverSystem_HdiInput_0190 SUB_DriverSystem_HdiInput_0200 SUB_DriverSystem_HdiInput_0210 SUB_DriverSystem_HdiInput_0230 SUB_DriverSystem_HdiInput_0240 SUB_DriverSystem_HdiInput_0260 SUB_DriverSystem_HdiInput_0270 SUB_DriverSystem_HdiInput_0290 SUB_DriverSystem_HdiInput_0300 SUB_DriverSystem_HdiInput_0320 SUB_DriverSystem_HdiInput_0330 SUB_DriverSystem_HdiInput_0350 SUB_DriverSystem_HdiInput_0360 SUB_DriverSystem_HdiInput_0380 SUB_DriverSystem_HdiInput_0390 SUB_DriverSystem_HdiInput_0410 SUB_DriverSystem_HdiInput_0420

3 问题原因

3.1 正常机制

触摸屏接口为一个I2C接口(data和clk),及两个GPIO(rst和int)

读写I2C接口,配置正确的GPIO引脚,用例测试会设置GPIO的方向,触发模式,读写等正常。

3.2 异常机制

I2C接口冲突及GPIO引脚配置不正常,导致无法读写,后续用例无法继续执行

4 解决方案

修改/vendor/flyhong/fh100/hdf_config/khdf/input/input_config.hcs

​
​
busConfig{
    ...
    busNum=4;      //触摸屏的I2C接口编号 
    ...
}
pinConfig{
    ...
    rstGpio=400;     //触摸屏的复位信号脚
    intGpio=401;     //触摸屏的中断信号脚
    ...
​
}

5 定位过程

1.内核初始化GPIO控制器驱动时,发现引脚编号与芯片厂商的编号范围不一致,经过分析看到基地址不一致,因为GPIO脚本并不是真正能够操作的GPIO,所以导致用例失败,遂将GPIO引脚改为能正常操作的GPIO即可,根据基地址的偏移,发现400,401这两个引脚可正常使用

​
[    6.632460] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:144, count:16)\x0d
[    6.640867] [I/gpio_manager] GpioManagerAdd: start:144 count:16 added success\x0d
[    6.648029] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.648036] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.648044] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:144, count:16) succeed\x0d
[    6.657539] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:160, count:256)\x0d
[    6.666351] [I/gpio_manager] GpioManagerAdd: start:160 count:256 added success\x0d
[    6.673550] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.673556] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.673563] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:160, count:256) succeed\x0d
[    6.683157] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:416, count:24)\x0d
[    6.691598] [I/gpio_manager] GpioManagerAdd: start:416 count:24 added success\x0d
[    6.698732] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.698738] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.698745] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:416, count:24) succeed\x0d
[    6.708252] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:440, count:24)\x0d
[    6.716677] [I/gpio_manager] GpioManagerAdd: start:440 count:24 added success\x0d
[    6.723828] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.723834] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.723841] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:440, count:24) succeed\x0d
[    6.733348] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:464, count:24)\x0d
[    6.741790] [I/gpio_manager] GpioManagerAdd: start:464 count:24 added success\x0d
[    6.748923] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.748929] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.748936] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:464, count:24) succeed\x0d
[    6.758443] [I/linux_gpio_adapter] LinuxGpioMatchProbe: find gpio chip(start:488, count:24)\x0d
[    6.766891] [I/gpio_manager] GpioManagerAdd: start:488 count:24 added success\x0d
[    6.774021] [D/HDF_LOG_TAG] PlatformManagerAddDevice: add dev:(null)(0) to PLATFORM_MODULE_GPIO success\x0d
[    6.774027] [D/HDF_LOG_TAG] PlatformDeviceAdd: add dev:(null)(0) success\x0d
[    6.774035] [I/linux_gpio_adapter] LinuxGpioMatchProbe: add gpio controller(start:488, count:24) succeed\x0d
[    6.783563] [I/linux_gpio_adapter] LinuxGpioInit: dev service: init done!\x0d
​
  1. 从内核启动日志观察到HCS中配置的I2C接口被linux内核提前占用,无法读写,修改至其它未使用的I2C接口即可(从I2C1改至I2C4)

​
[    6.878531] [D/device_node] node HDF_PLATFORM_I2C_MANAGER property empty, match attr: hdf_platform_i2c_manager\x0d
[    6.878540] [I/device_node] launch devnode HDF_PLATFORM_I2C_MANAGER\x0d
[    6.884825] [I/i2c_core] I2cManagerBind: Enter!\x0d
[    6.889562] [I/osal_cdev] add cdev HDF_PLATFORM_I2C_MANAGER success\x0a\x0d
[    6.897366] [D/device_node] node linux_i2c_adapter property empty, match attr: linux_i2c_adapter\x0d
[    6.897376] [I/device_node] launch devnode \x0d
[    6.901612] [I/i2c_linux_adapter] LinuxI2cInit: Enter\x0d
[    6.906656] [I/i2c_linux_adapter] LinuxI2cProbe: Enter\x0d
[    6.911859] [I/i2c_core] I2cCntlrAdd: use default lock methods!\x0d
[    6.917818] [I/i2c_linux_adapter] LinuxI2cProbe: i2c adapter 0 add success\x0d
[    6.924759] [I/i2c_linux_adapter] LinuxI2cProbe: Enter\x0d
[    6.929932] [I/i2c_core] I2cCntlrAdd: use default lock methods!\x0d
[    6.935915] [I/i2c_linux_adapter] LinuxI2cProbe: i2c adapter 2 add success\x0d
[    6.942839] [I/i2c_linux_adapter] LinuxI2cProbe: Enter\x0d
[    6.948019] [I/i2c_core] I2cCntlrAdd: use default lock methods!\x0d
[    6.954001] [I/i2c_linux_adapter] LinuxI2cProbe: i2c adapter 3 add success\x0d
[    6.960926] [I/i2c_linux_adapter] LinuxI2cProbe: Enter\x0d
[    6.966105] [I/i2c_core] I2cCntlrAdd: use default lock methods!\x0d
[    6.972088] [I/i2c_linux_adapter] LinuxI2cProbe: i2c adapter 4 add success\x0d
[    6.979004] [I/i2c_linux_adapter] LinuxI2cInit: done\x0d
​

6 知识分享

熟悉HDF框架,驱动流程,对定位过程事半功倍。

1)在系统下可以直接操作GPIO是否能正常读写高低电平来判断引脚是否正确

2)通过对比HCS的配置接口与内核启动日志对比I2C接口是否有冲突

# cd /sys/class/gpio
# export 400 > export
# echo out > gpio400/direction
# echo 1 gpio400/value
1 gpio400/value
# echo 0 gpio400/value
0 gpio400/value
​
Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐