(1)添加供应商给的驱动
添加到vendor\qcom\non-hlos\ADSP.VT.5.4.3.c1\adsp_proc\ssc_drivers
(2)添加编译
\vendor\qcom\non-hlos\ADSP.VT.5.4.3.c1\adsp_proc\ssc\chipset\divar\por.py
if 'SSC_TARGET_X86' not in env['CPPDEFINES']:
#POR sensors list
include_sensor_vendor_libs.extend(['lsm6dso', #ACCEL/GYRO/MD/TEMP
'sns_ak0991x', #MAGNETOMETER
'sns_tmd2725', #ALS/PROX
'sns_bmp285', #PRESSURE
'sns_bu52053nvx', #HALL
'sns_sc7a20',
'sns_ltr569'])
/*此处id为供应商给的驱动文件中LTR-569ALS-WA\build\sns_ltr569.scons,.scons的前缀*/
(3)修改通讯协议
-3.1vendor\qcom\
non-hlos\ADSP.VT.5.4.3.c1\adsp_proc\core\settings\buses\qup_fw\config\divar\fw_devcfg.c
根据DATA SHEET选择对应SE设备修改通信协议
-3.2vendor\qcom\non-hlos\
ADSP.VT.5.4.3.c1\adsp_proc\core\settings\buses\i2c\config\divar\i2c_devcfg.c
(4)查看是否编译成功:
1.编译成功会adsp_proc下生成obj文件夹,里面有所有的镜像
2.或在驱动文件的build下生成/sensor.img/所有.o文件
可以直接在编译目录下$:find -name "xxxx.o"以快捷搜索有无.o生成
AP侧修改
添加.json文件在
vendor\qcom\proprietary\sensors-see\registry\config\lahaina(项目名)
{
"config":
{
"hw_platform": ["QRD"], // cat /sys/devices/soc0/hw_platform获取
"soc_id": ["497"] //cat /sys/devices/soc0/soc_id 获取
},
"bmi160_0":{
"owner": "sns_bmi160",
".accel":{
"owner": "sns_bmi160",
".config":{
"owner": "sns_bmi160",
"is_dri":{ "type": "int", "ver": "0",
"data": "1"
},//配置中断模式或者轮训模式(“0”轮训模式,“1”中断模式)
"hw_id":{ "type": "int", "ver": "0",
"data": "0"
},//用来区分同一硬件多个传感器
"res_idx":{ "type": "int", "ver": "0",
"data": "2"
},
"sync_stream":{ "type": "int", "ver": "0",
"data": "0"
}
}
},
".gyro":{
"owner": "sns_bmi160",
".config":{
"owner": "sns_bmi160",
"is_dri":{ "type": "int", "ver": "0",
"data": "1"
},
"hw_id":{ "type": "int", "ver": "0",
"data": "0"
},
"res_idx":{ "type": "int", "ver": "0",
"data": "4"
},
"sync_stream":{ "type": "int", "ver": "0",
"data": "0"
}
}
},
".md":{
"owner": "sns_bmi160",
".config":{
"owner": "sns_bmi160",
"is_dri":{ "type": "int", "ver": "0",
"data": "1"
},
"hw_id":{ "type": "int", "ver": "0",
"data": "0"
},
"res_idx":{ "type": "int", "ver": "0",
"data": "0"
},
"sync_stream":{ "type": "int", "ver": "0",
"data": "0"
}
}
},
".temp":{
"owner": "sns_bmi160",
".config":{
"owner": "sns_bmi160",
"is_dri":{ "type": "int", "ver": "0",
"data": "0"
},
"hw_id":{ "type": "int", "ver": "0",
"data": "0"
},
"res_idx":{ "type": "int", "ver": "0",
"data": "2"
},
"sync_stream":{ "type": "int", "ver": "0",
"data": "0"
}
}
}
},
"bmi160_0_platform":{
"owner": "sns_bmi160",
".config":{
"owner": "sns_bmi160",
"bus_type":{ "type": "int", "ver": "0",
"data": "0"
},//I2C 写 0、 SPI 写 1、 I3C 写 3
"bus_instance":{ "type": "int", "ver": "0",
"data": "2"
},//bus_instance: = SE 数 + 1(平台datasheet)
"slave_config":{ "type": "int", "ver": "0",
"data": "104"
},//I2C 地址,参考规格书
"min_bus_speed_khz":{ "type": "int", "ver": "0",
"data": "400"
},//最小 COM 总线时钟速度,默认配置 400khz
"max_bus_speed_khz":{ "type": "int", "ver": "0",
"data": "400"
},//最大 COM 总线时钟速度,默认配置 400khz
"reg_addr_type":{ "type": "int", "ver": "0",
"data": "0"
},//寄存器地址类型( 寄存器地址位数,“ 0” 8 bit “ 1” 16 bit “ 2” 32bit)
"dri_irq_num":{ "type": "int", "ver": "0",
"data": "102"
},//中断引脚
"irq_pull_type":{ "type": "int", "ver": "0",
"data": "2"
},//配置中断引脚内部电平类型
"irq_is_chip_pin":{ "type": "int", "ver": "0",
"data": "1"
},//配置 MSM_GPIO 由于中断模式
"irq_drive_strength":{ "type": "int", "ver": "0",
"data": "0"
},//配置 MSM_GPIO 由于中断模式
"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": "2"
},//低功耗供电模式 LPM 还是常规供电模式 NPM
"vddio_rail":{ "type": "str", "ver": "0",
"data": "/pmic/client/sensor_vddio"
},
"vdd_rail":{ "type": "str", "ver": "0",
"data": "/pmic/client/sensor_vdd"
},
"rigid_body_type":{ "type": "int", "ver": "0",
"data": "0"
}
}
将sensor器件添加到高通island(低功耗模式)
【不同平台特性不同,此操作需和平台确认清楚能不能去掉!并非所有平台都能去掉这三行!】
vendor\qcom\non-hlos\ADSP.VT.5.4.3.c1\adsp_proc\ssc\chipset\divar\por.py
(1)先在在此文件中注释掉以下三行,以释放island空间来添加新器件进island空间:
#env.AddUsesFlags(['SNS_DYNLIB_LOCAL_HEAPMGR'])
#env.AddUsesFlags(['SNS_DYNLIB_LSM6DSO'])
#env.Append(CPPDEFINES = ['SNS_DYNLIB_NUM_OF_ISLAND_PAGES = 11'])
(2) 在此处添加驱动名
# 1. Island drivers
env.AddUsesFlags(['SNS_ISLAND_INCLUDE_HX32062SE'])
#env.AddUsesFlags(['SNS_ISLAND_INCLUDE_AK0991X'])
#env.AddUsesFlags(['SNS_ISLAND_INCLUDE_TMD2725'])
#env.AddUsesFlags(['SNS_ISLAND_INCLUDE_BMP285'])
island驱动名获取方法:打开驱动文件中的build文件(后缀.scons),找到以下句段,
if 'SNS_ISLAND_INCLUDE_HX32062SE' in env:
hx32062se_island_enable = True
其中引号中的id就是添加到por.py的id。