目录
1、事件驱动和设备挂载
2、adb调试节点
3、修改设备树地址
4、修改驱动地址
5、修改firmware固件参数
我们总是习惯不断的搜索,阅读前人总结和分享的经验,在不断尝试中进步,如果没有大家的分享经验,学习和探索的过程将是多么的痛苦和艰难,将心比心!将自己遇到的困难和解决方法分享,既可以记录和回顾,也可以帮助更多努力前行需要帮助的人~
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
daisy.skye的博客_CSDN博客-嵌入式,Qt,Linux领域博主
https://blog.csdn.net/qq_40715266?type=lately
良好的环境除了制度的管理,还需要更多人自觉的遵守和维护!
通过在代码中添加驱动以及Kconfig和Makefile编译,还有deconfig和设备树dtsi配置
如果配置有误或者缺失,就会导致编译部分hynitron的驱动
:~out/target/product$ find | grep "hynitron"
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/modules.order
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/built-in.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.built-in.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/modules.builtin
完成配置和编译后,可以直接在out目录查看是否生成了响应的 .o 驱动文件
out/target/product/$ find | grep "hynitron"
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_proximity.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_i2c.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_core.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/modules.order
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_core.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_tool_debug.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_esd_check.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/built-in.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_gesture.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_proximity.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_update_firmware.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_tool_debug.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_esd_check.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.hynitron_i2c.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/.built-in.o.cmd
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_gesture.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_update_firmware.o
./obj/kernel/msm-3.18/drivers/input/touchscreen/hynitron/modules.builtin
之后将编译好的包下载到设备中,可以看到
adb shell getevent 显示 input 上报事件
C:\Users\fujy>adb shell
P322:/ # getevent
add device 1: /dev/input/event6
name: "msm8953-snd-card-internal Button Jack"
add device 7: /dev/input/event1
name: "hyn_ts"
adb shell ll /sys/bus/i2c/drivers 查看设备挂载
虽然节点有了但是触摸屏幕并没有响应
daisy通过adb调试发现也没有反馈卡出了,adb 导出kernel日志查看问题
[ 8.023803] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x1a MSTR_STS:0x0d1343c8 OPER:0x00000090
[ 8.023900] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x1a MSTR_STS:0x091343c8 OPER:0x00000090
[ 8.023996] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:7 tx:0) mode:FIFO slv_addr:0x1a MSTR_STS:0x0d1343c8 OPER:0x00000010
[ 8.024087] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:7 tx:0) mode:FIFO slv_addr:0x1a MSTR_STS:0x0d1300c8 OPER:0x00000010
[ 8.024112] [HYN][Error] iic read touch point data failed.
[ 8.024181] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:3) mode:FIFO slv_addr:0x1a MSTR_STS:0x0d1343c8 OPER:0x00000090
[ 8.024287] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:3) mode:FIFO slv_addr:0x1a MSTR_STS:0x091343c8 OPER:0x00000090
[ 8.024312] [HYN][Error] send read touch info ending failed.
daisy查看kernel日志发现i2c读取寄存器值返回失败,与节点默认配置的i2c地址不匹配,询问fae后得知i2c地址是0x5a,修改msm8953-qrd.dtsi节点中的地址以及驱动中的地址
hynitron@1a{
compatible = "hynitron,hyn_ts";
reg = <0x1a>;
interrupt-parent = <&tlmm>;
interrupts = <65 0x02>;
hynitron,reset-gpio = <&tlmm 64 0x01>;
hynitron,irq-gpio = <&tlmm 65 0x02>;
hynitron,max-touch-number = <5>;
hynitron,display-coords = <240 320>;
hynitron,have-key;
hynitron,key-number = <3>;
hynitron,key-code = <139 172 158>;
hyn_cst3xx,key-y-coord = <2000 2000 2000>;
hyn_cst3xx,key-x-coord = <200 600 800>;
status = "okay";
};
kernel/msm-3.18/drivers/input/touchscreen/hynitron/hynitron_core.h
#define HYN_CHIP_TYPE_CONFIG CST226SE //芯片型号
#define HYN_IRQ_TRIGGER_RISING_CONFIG 0x01
#define HYN_MAIN_IIC_ADDR_CONFIG 0x5a //i2c地址
#define HYN_X_DISPLAY_DEFAULT 240 //屏幕横向分辨率
#define HYN_Y_DISPLAY_DEFAULT 320 //屏幕纵向分辨率
daisy修改i2c地址后,发现固件更新失败,查看报错位置是由于没有找到匹配的project_id
[HYN][Error]not find matched TP firmware,please check chip type and chip project id. !
[HYN]hyn_find_fw_idx: Enter
[HYN][Info]hyn_find_fw_idx check_project_id:0,chip_ic_type :0xa8,chip_ic_project_id:0x4416,config_chip_type :0xa8.
文件路径\hynitron\hynitron_update_firmware.c
int hyn_boot_update_fw(struct i2c_client * client)
{……
check_proj_id=1;
proj_id=hyn_find_fw_idx(check_proj_id);
HYN_INFO("hyn_find_fw_idx: proj_id:%d.\r\n",proj_id);
if(proj_id<0){
HYN_ERROR("not find matched TP firmware,please check chip type and chip project id. !\n");
proj_id=hyn_find_fw_idx(0);
if(proj_id>0){
hyn_ts_data->fw_name =hynitron_fw_grp[proj_id].name;
hyn_ts_data->p_hynitron_upgrade_firmware =hynitron_fw_grp[proj_id].fw;
hyn_ts_data->fw_length =hynitron_fw_grp[proj_id].fw_length;
HYN_INFO("update default TP firmware data for apk update.(%s)!\n", hynitron_fw_grp[proj_id].name);
}else{
HYN_INFO("please chekc hynitron_fw_grp fw config!\n");
return 0;
}
}
……}
daisy查找报错代码,发现是有由于在匹配列表过程hynitron_fw_grp[10]没有匹配上
前面daisy修改驱动地址的位置,配置过芯片型号是CST226SE,这边依旧取CST2xxSE,把原有的 project_id; module_id改成刚才日志中打印的参数,重新完成编译
#define HYN_CHIP_TYPE_CONFIG CST226SE //芯片型号
//please config the chip series before using.
struct hynitron_fw_array hynitron_fw_grp[10] = {
//0-name; 1-fw; 2-project_id; 3-module_id; 4-chip_type; 5-fw_length;
{ "capacitive_hynitron_cst0xx_update", cst0xx_fw, 0x2843,0x01, CST016, (sizeof(cst0xx_fw))},
{ "capacitive_hynitron_cst1xx_update", cst1xx_fw, 0x0501,0x01, CST128, (sizeof(cst1xx_fw))},
//daisy 2023-05-05
//{ "capacitive_hynitron_cst2xxse_update", cst2xxse_fw, 0x0501,0x01, CST226SE, (sizeof(cst2xxse_fw))},
{ "capacitive_hynitron_cst2xxse_update", cst2xxse_fw, 0x4416,0xa8, CST226SE, (sizeof(cst2xxse_fw))},
{ "capacitive_hynitron_cst3xx_update", cst3xx_fw, 0x2117,0x11, CST328, (sizeof(cst3xx_fw))},
{ "capacitive_hynitron_cst6xx_update", cst6xx_fw, 0x2117,0x11, CST6928S, (sizeof(cst6xx_fw))},
{ "capacitive_hynitron_cst3xxse_update", cst3xxse_fw, 0x0501,0x01, CST328SE, (sizeof(cst3xxse_fw))},
{ "capacitive_hynitron_cst8xx_update", cst8xx_fw, 0x0501,0x01, CST836, (sizeof(cst8xx_fw))},
{ "capacitive_hynitron_cst9xx_update", cst9xx_fw, 0x2208,0x01, CST918, (sizeof(cst9xx_fw))},
};
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
daisy.skye的博客_CSDN博客-嵌入式,Qt,Linux领域博主
https://blog.csdn.net/qq_40715266?type=lately
良好的环境除了制度的管理,还需要更多人自觉的遵守和维护!