目录
1 厂商驱动代码的添加
1.1 synaptics_dsx代码放到SDM710 kernel input相应目录
1.2 修改input/touchscreen目录下的Makefile和Kconfig文件
2 deconfig的配置
2.1 sdm670_defconfig
2.2 sdm670-perf_defconfig
3 目标平台的内核源码设备树dtsi配置
3.1 sdm670-qupv3.dtsi
3.2 sdm670-pinctrl.dtsi
4 firmware TP性能的添加
5 屏翻转的分析
5.1 TP 屏反向:TP 屏倒置180度处理 根据synaptics_dsx_i2c.c描述的属性:
5.2 LCD屏反向LCD屏倒置 180
6 屏兼容问题
7 总结
1)将synaptics_dsx 文件夹放到目录kernel/msm-4.9/drivers/input/touchscreen/下。
synaptics_dsx 文件夹包含的文件有:
Kconfig
synaptics_dsx_active_pen.c
synaptics_dsx_core.h
synaptics_dsx_gesture.c
synaptics_dsx_proximity.c
synaptics_dsx_rmi_hid_i2c.c
synaptics_dsx_test_reporting.c
Makefile
synaptics_dsx_core.c
synaptics_dsx_fw_update.c
synaptics_dsx_i2c.c
synaptics_dsx_rmi_dev.c
synaptics_dsx_spi.c
synaptics_dsx_video.c
2) 将synaptics_dsx.h 文件放到kernel/msm-4.9/include/linux/input目录下
1) 在Kconfig文件中配置宏
config TOUCHSCREEN_SYNAPTICS_DSX
bool "Synaptics DSX attributes"
depends on I2C
help
Say Y here to enable support for Synaptics DSX attributes.
This does not affect the core or other subsystem attributes.
If unsure, say N.
+source "drivers/input/touchscreen/synaptics_dsx/Kconfig“
2)在Makefile文件中添加语句
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX) += synaptics_dsx/
msm_defconfig和msm-perf_defconfig,前者是编译debug调试版本,后者是user编译版本。修改部分一样,添加如下:
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_I2C=y
#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_SPI=y
#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_HID_I2C=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y
CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_GESTURE=y
使用设备树模型有关硬件描述,所以我们要修改目标平台的dtsi文件: kernel/msm4.9/arch/arm64/boot/dts/qcom目录下的两个文件
1)sdm670-qupv3.dtsi
根据高通文档 80-pd126-5_d_sdm670_sdm710_qcs605_linux_peripherals_%28uart%2C_spi%2C_i2c%29_overview.pdf
和硬件原理图可以知道TP挂载的i2c模块是QUP_9 对应dts 文件就是qupv3_se9_i2c: i2c@a84000 {
4b(I2C偏移地址查考供应商提供的datasheet)、 "synaptics,dsx-i2c"(设备of_device_id要跟Synaptic_dsx_i2c.c文件中函数synaptics_rmi4_of_match_table[]中定义的一致)、 INT、reset、avdd、vdd等引脚需查看硬件原理图和高通平台的spreaddatasheet.
TP_IOVDD 悬空 ——》通过芯片内部有LCD供电
TP_INT——>TS_INT_N——》GPIO_125
TP_SRT——>TS_RESET_N——》GPIO _99
TP_SDA——>QUP_I2C_SDA_9——》GPIO_6
TP_SCL——>QUP_I2C_SCL_9——》GPIO _7
TP的相关GPIO引脚
有LCD_AVDD给TP供电:
添加sdm670-qupv3.dtsi的i2c设备树属性代码:
qupv3_se9_i2c: i2c@a84000 {
synaptics@4b {
compatible = "synaptics,dsx-i2c";
reg = <0x4b>;
interrupt-parent = <&tlmm>;
interrupts = <125 0x2008>;
//vdd-supply = <&pm8994_l14>;
//avdd-supply = <&pm8994_l22>;
//pinctrl-names = "pmx_ts_active", "pmx_ts_suspend";
//pinctrl-0 = <&ts_active>;
//pinctrl-1 = <&ts_suspend>;
synaptics,pwr-reg-name = "avdd";
synaptics,bus-reg-name = "vdd";
synaptics,display-coords = <0 0 1080 2160>;
synaptics,panel-coords = <0 0 1080 2160 >;
synaptics,reset-gpio = <&tlmm 99 0x00>;
synaptics,irq-gpio = <&tlmm 125 0x2008>;
synaptics,disable-gpios;
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,x-flip = <1>;
//synaptics,y-flip = <1>;
synaptics,fw-name = "startup_fw_update.img";
};
添加 sdm670-pinctrl.dtsi 代码:
+ touch_irq {
+ touch_irq_default: default {
+ mux {
+ pins = "gpio125";
+ function = "gpio";
+ };
+ config {
+ pins = "gpio125";
+ drive-strength = <6>; /* 16 mA */
+ bias-pull-down; /* pull down */
+ };
+ };
+ touch_irq_active: active {
+ mux {
+ pins = "gpio125";
+ function = "gpio";
+ };
+ config {
+ pins = "gpio125";
+ bias-pull-up;
+ drive-strength = <6>;
+ };
+ };
+ };
+ touch_reset {
+ touch_reset_default: default {
+ mux {
+ pins = "gpio99";
+ function = "gpio";
+ };
+ config {
+ pins = "gpio99";
+ bias-disable;
+ output-low;
+ drive-strength = <6>;
+ };
+ };
+ touch_reset_active: active {
+ mux {
+ pins = "gpio99";
+ function = "gpio";
+ };
+ config {
+ pins = "gpio99";
+ bias-pull-up;
+ drive-strength = <6>;
+ };
+ };
1)将startup_fw_update.img放在device/gree/G0335D/目录下;
2)在G0335D/device/gree/G0335D/G0335D.mk中的# Sensor features
PRODUCT_COPY_FILES += \的地方添加语句:
device/gree/G0335D/startup_fw_update.img:system/etc/firmware/synaptics/startup_fw_update.img \
3)确保kernel/msm-3.18/drivers/input/touchscreen/synaptics_dsx/ synaptics_dsx_fw_update.c中 宏:DO_STARTUP_FW_UPDATE打开, 另外ENABLE_SYS_REFLASH定义为 true 如下:
#define DO_STARTUP_FW_UPDATE
#define ENABLE_SYS_REFLASH true
4)确保以下为相对路径如下:
#define FW_IHEX_NAME "synaptics/startup_fw_update.bin"
#define FW_IMAGE_NAME "synaptics/startup_fw_update.img"
5)确保kernel/msm-3.18/drivers/input/touchscreen/synaptics_dsx/ synaptics_dsx_fw_update.c中fw的宏名字一致:
#define FW_IMAGE_NAME "synaptics/ startup_fw_update.img"
6)在dtsi文件确保fw-name名字一致。kernel/msm-3.18/arch/arm64/boot/dts/gree/G0335D/ msm8996-mtp.dtsi :
+ synaptics,fw-name = " startup_fw_update.img ";
7)固件升级成功后,将版本烧录到机器,可通过adb查看版本号:
Adb root
Adb shell
Cd /sys/class/input/input3
Cat buildid
prop = of_find_property(np, "synaptics,x-flip", NULL);
bdata->x_flip = prop > 0 ? true : false;
prop = of_find_property(np, "synaptics,y-flip", NULL);
bdata->y_flip = prop > 0 ? true : false;
可以在i2c dtsi文件sdm670-qupv3.dtsi添加 一下语句,从而使屏倒置:
synaptics,x-flip = <1>;
synaptics,y-flip = <1>;
device/qcom/msm8996/system.prop文件中添加:
ro.panel.mountflip=3
frameworks/native/services/surfaceflinger/DisplayDevice.cpp 描述属性:
property_get("ro.panel.mountflip", property, "0");
mPanelMountFlip = atoi(property);
/* 1: H-Flip, 2: V-Flip, 3: 180 (HV Flip)从Property里获得ro.panel.mountflip,ro.panel.mountflip这个赋值3就是180*/
https://blog.csdn.net/weixin_42352255/article/details/85453494
1)模块代码加载过程:
平台驱动加载:
module_init()——》synaptics_rmi4_init——》
synaptics_rmi4_bus_init()——》synaptics_rmi4_i2c_driver——》
synaptics_rmi4_i2c_probe——》注册i2c设备
synaptics_dsx_i2c_device
设备驱动加载:
synaptics_rmi4_driver——》synaptics_rmi4_probe——》input设备注
册synaptics_rmi4_set_input_dev——》synaptics_rmi4_query_device——》
synaptics_rmi4_f12_init
中断上报:
synaptics_rmi4_probe——》synaptics_rmi4_irq_enable——》
synaptics_rmi4_irq——》synaptics_rmi4_sensor_report——》
synaptics_rmi4_report_touch——》synaptics_rmi4_f12_abs_report
2)调试工具adb以及常用命令
Adb shell getevent –l //查看TP中断上报情况,显示input设备/type/code/value
Adb shell getevent –r //查看TP报点率
Adb shell getevent –I //查看输入事件信息
查看input节点目录: