概述
QCM2290 平台sensor移植
驱动移植BP:
1.将客户提供的驱动源码文件夹icm206xx和qmc6308放到ADSP.VT.5.4.1adsp_procsscsensors目录下
2.修改ADSP.VT.5.4.1/adsp_proc/ssc/chipset/agatti/por.py
bs.extend(['sns_ccd','dae_sensor','dynamic_sensors','low_lat_client_manager','cm_qsocket','sns_async_uart','sns_device_mode','ext_svc','sns_test','sns_dpc','sns_threshold','sns_gyro_ro t_matrix','sns_accel_cal','sns_basic_gestures','sns_distance_bound','sns_aont','sns_rmd','sns_multishake','sns_oem1','sns_tilt_to_wake','sns_psmd','sns_geomag_rv','sns_cmc','sns_facing','spi','sns_bring _to_ear'])
include_sensor_vendor_libs.extend(['lsm6dso','sns_ak0991x','sns_tmd2725'])
else:
exclude_libs.extend(['sns_ccd','dae_sensor','spi'])
- include_sensor_vendor_libs.extend(['lsm6dso', 'sns_bu52053nvx', 'sns_bmp285', 'sns_ak0991x', 'sns_tmd2725'])
+ include_sensor_vendor_libs.extend(['sns_qmc6308', 'sns_icm206xx'])
env.Replace(SSC_INCLUDE_SENS_VEND_LIBS=include_sensor_vendor_libs)
env.Replace(SSC_EXCLUDE_LIBS=exclude_libs)
3.由于sensor使用的是i2c(GPIO21和GPIO22 ),参考文档知晓这路i3c需要改成i2c,且其为se1:
修改ADSP.VT.5.4.1/adsp_proc/core/settings/buses/i2c/config/agatti/i2c_devcfg.c
192 #ifdef ENABLE_I2C_02
193 {
194 .core_base_addr = (uint8 *) QUPV3_CORE0_BASE_ADDRESS,
195 .core_offset = 0x00084000,
196 .qupv3_instance = QUP_SSC,
197 .core_index = 2,
198 .se_index = 1,
199 .core_irq = 57,
200
201 .polled_mode = FALSE,
202
203 .min_data_length_for_dma = 0,
204
205 .gpi_index = 1,
206 .gpi_protocol = PROTOCOL_I2C,//这里默认是i3c,改成i2c
207
。。。。
修改ADSP.VT.5.4.1/adsp_proc/core/settings/buses/qup_fw/config/agatti/fw_devcfg.c
20 // CUST // offset, protocol, mode, load_fw, dfs_mode
21 se_cfg se0_cfg_qrd = { 0x80000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
22 se_cfg se1_cfg_qrd = { 0x84000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };//这里默认是i3c,改成i2c
23 //se_cfg se2_cfg_qrd = { 0x88000, SE_PROTOCOL_SPI, GSI, TRUE, TRUE };
24 //se_cfg se3_cfg_qrd = { 0x8C000, SE_PROTOCOL_I2C, FIFO, TRUE, FALSE };
25 //se_cfg se4_cfg_qrd = { 0x90000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
26 se_cfg se5_cfg_qrd = { 0x94000, SE_PROTOCOL_UART, FIFO, TRUE, FALSE };
27
28
29
30 // MTP as default/// offset, protocol, mode, load_fw, dfs_mode
31 se_cfg se0_cfg = { 0x80000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
32 se_cfg se1_cfg = { 0x84000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };//这里默认是i3c,改成i2c
33 //se_cfg se2_cfg = { 0x88000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
34 //se_cfg se3_cfg = { 0x8C000, SE_PROTOCOL_I2C, FIFO, TRUE, FALSE };
35 //se_cfg se4_cfg = { 0x90000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
36 se_cfg se5_cfg = { 0x94000, SE_PROTOCOL_UART, FIFO, TRUE, FALSE };
37
38
39 // RUMI // offset, protocol, mode, load_fw, dfs_mode
40 se_cfg se0_cfg_rumi = { 0x80000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
41 se_cfg se1_cfg_rumi = { 0x84000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };//这里默认是i3c,改成i2c
42 //se_cfg se2_cfg_rumi = { 0x88000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
43 //se_cfg se3_cfg_rumi = { 0x8C000, SE_PROTOCOL_UART, GSI, FALSE, TRUE };
44 //se_cfg se4_cfg_rumi = { 0x90000, SE_PROTOCOL_I2C, GSI, TRUE, TRUE };
45 se_cfg se5_cfg_rumi = { 0x94000, SE_PROTOCOL_UART, FIFO, FALSE, FALSE };
修改TZ.XF.5.1/trustzone_images/core/settings/buses/qup_accesscontrol/qupv3/config/agatti/QUPAC_Access.c
43 const QUPv3_se_security_permissions_type ssc_qupv3_perms_default[] =
44 {
45 /*PeriphID, ProtocolID, Mode, NsOwner, bAllowFifo, bLoad, bModExcl */
46 { QUPV3_SSC_SE0, QUPV3_PROTOCOL_I2C, QUPV3_MODE_GSI, AC_ADSP_Q6_ELF, FALSE, FALSE, FALSE },
47 { QUPV3_SSC_SE1, QUPV3_PROTOCOL_I2C, QUPV3_MODE_GSI, AC_ADSP_Q6_ELF, FALSE, FALSE, FALSE },//这里默认是i3c,改成i2c
48 /*QUPV3_SSC_SE2*/
49 /*QUPV3_SSC_SE3*/
50 /*QUPV3_SSC_SE4*/
51 { QUPV3_SSC_SE5, QUPV3_PROTOCOL_UART_2W, QUPV3_MODE_GSI, AC_ADSP_Q6_ELF, FALSE, FALSE, FALSE },
52 { QUPV3_SSC_SE6, QUPV3_PROTOCOL_UART_2W, QUPV3_MODE_GSI, AC_ADSP_Q6_ELF, FALSE, FALSE, FALSE },
53 /*QUPV3_SSC_SE7*/
54 };
驱动移植AP:
1.在vendorqcomproprietarysensors-seeregistryconfigbengal目录下添加对应的agatti_icm206xx_0.json和agatti_qmc6308_0.json文件
2.添加vendorqcomproprietarysensors-seesensors-hal-2.0sensorsorientation.cppDEBUG:
1.agatti_icm206xx_0.json的配置:
hw_platform:cat /sys/devices/soc0/hw_platform
soc_id:cat /sys/devices/soc0/soc_id
"config":
{
"hw_platform": ["IDP", "IOT"],
"soc_id": ["473"]
},
其它配置:
"icm206xx_0_platform":{
"owner": "sns_icm206xx",
".config":{
"owner": "sns_icm206xx",
"bus_type":{ "type": "int", "ver": "0",
"data": "0"//总线类型,0是i2c,1是spi,2是uart,3是i3c
},
"bus_instance":{ "type": "int", "ver": "0",
"data": "2"//i2c 是se1,所以这里是2
},
"slave_config":{ "type": "int", "ver": "0",
"data": "105"//i2c地址,0x69
},
"min_bus_speed_khz":{ "type": "int", "ver": "0",
"data": "400"
},
"max_bus_speed_khz":{ "type": "int", "ver": "0",
"data": "400"
},
"reg_addr_type":{ "type": "int", "ver": "0",
"data": "0"
},
"dri_irq_num":{ "type": "int", "ver": "0",
"data": "32"//中断GPIO
},
"irq_pull_type":{ "type": "int", "ver": "0",
"data": "2"
},
"irq_is_chip_pin":{ "type": "int", "ver": "0",
"data": "1"
},
"irq_drive_strength":{ "type": "int", "ver": "0",
"data": "0"
},
"irq_trigger_type":{ "type": "int", "ver": "0",
"data": "0"
},
"num_rail":{ "type": "int", "ver": "0",
"data": "2"
},
"rail_on_state":{ "type": "int", "ver": "0",
"data": "1"//如果vdd和vddio一样这里是1
},
"vdd_rail":{ "type": "str", "ver": "0",
"data": "/pmic/client/sensor_vdd"
},
"vddio_rail":{ "type": "str", "ver": "0",
"data": "/pmic/client/sensor_vddio"
},
"rigid_body_type":{ "type": "int", "ver": "0",
"data": "0"
}
2.ADSP.VT.5.4.1adsp_procsscsensorsicm206xxbuildsensor_imgqdsp6agatti.adsp.prod目录下会生成对应的库
sns_static_sensors.c文件中搜一下icm206xx会发现添加进去了说明驱动加载成功了。
3.json文件是可以直接push到机器里面重启生效的,注意修改json文件权限644,将 mnt/vendor/persist/sensors/registry/registry/目录下对应的json文件删掉
4.ssc_drva_test -sensor=accel -duration=30 -sample_rate=100
ssc_drva_test -sensor=gyro -duration=30 -sample_rate=100
ssc_drva_test -sensor=mag -duration=30 -sample_rate=100
ssc_drva_test -sensor=proximity -duration=30 -sample_rate=100
可以利用上述指令查看sensor有没有通
5.如果没有通的话首先看adsp有没有起来,即 ls vendor/firmware_mnt/image/会看到相关adsp的文件说明adsp已经通了
也可以通过如下log确认adsp有没有起来:
(aDSP) image successfully:
subsys-pil-tz 3700000.qcom,lpass: adsp: loading from 0x0000000086700000 to
0x0000000088f00000
6.QXDM log的抓取:
adb shell
#cat /sys/bus/msm_subsys/devices/subsys0/name
#adsp
adb root
adb wait-for-device
adb remount
adb shell "echo related > /sys/bus/msm_subsys/devices/subsys0/restart_level"
adb shell sync
"send_data 75 37 03 48"
重启adsp 抓取QXDM log
7.如果距感很近才能感应可以修改json,改大near_threshold
".proximity":{
"owner": "sns_ltr556",
".fac_cal":{
"owner": "sns_ltr556",
"near_threshold":{ "type": "flt", "ver": "0",
"data": "300.0"
},
"far_threshold":{ "type": "flt", "ver": "0",
"data": "100.0"
}
可以修改寄存器-----涉及驱动代码(修改阈值)和寄存器的部分可以咨询FAE
检查结构,硅胶套是否漏光
8.调整gsensor方向:
“.orient”:{
“owner”: “sns_icm206xx”,
“x”:{ “type”: “str”, “ver”: “0”,
“data”: “-x”
},
“y”:{ “type”: “str”, “ver”: “0”,
“data”: “-y”
},
“z”:{ “type”: “str”, “ver”: “0”,
“data”: “+z”
}
},
注:该平台有个问题,缺少sensor解析库导致无法调通
高德地图的指南针用不了,百度地图或者其它apk正常,vendor/qcom/proprietary/sensors-see/sensors-hal-2.0/sensors/orientation.cpp
hal层释放这里,确实让高德地图的指南针能用了。
hal将旋转矢量传感器数据转换为方向传感器,及上层调用的TYPE_ORIENTATION类型
最后
以上就是正直斑马为你收集整理的QCM2290 平台sensor移植驱动移植BP:驱动移植AP:DEBUG:的全部内容,希望文章能够帮你解决QCM2290 平台sensor移植驱动移植BP:驱动移植AP:DEBUG:所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复