我想在我的 AOSP 源代码中添加 LSM6DS3 传感器驱动程序。我正在使用 SC600T 设备。
我已经将
lsm6ds3
添加到该位置
/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9/drivers/iio/imu/st_lsm6ds3
,带有 Makefile
和 Kconfig
文件。
在
/../../iio/imu/Kconfig
文件中添加了以下行:
source "drivers/iio/imu/st_lsm6ds3/Kconfig"
添加了以下行至
/../../iio/imu/Makefile
。
obj-y += st_lsm6ds3/
/SC600T/../../iio/imu/st_lsm6ds3/Makefile
的内容:
# SPDX-License-Identifier: GPL-2.0-only
st_lsm6dsx-y := st_lsm6dsx_core.o st_lsm6dsx_buffer.o \
st_lsm6dsx_shub.o
obj-$(CONFIG_IIO_ST_LSM6DSX) += st_lsm6dsx.o
obj-$(CONFIG_IIO_ST_LSM6DSX_I2C) += st_lsm6dsx_i2c.o
obj-$(CONFIG_IIO_ST_LSM6DSX_SPI) += st_lsm6dsx_spi.o
obj-$(CONFIG_IIO_ST_LSM6DSX_I3C) += st_lsm6dsx_i3c.o
我还在设备树文件中添加了
lsm6ds3
节点:
&i2c_2 {
status = "ok";
#address-cells = <0x1>;
#size-cells = <0x0>;
lsm6ds3@6b {
compatible = "st,lsm6ds3";
reg = <0x6b>;
interrupt-parent = <&tlmm>;
interrupt-gpios = <&tlmm 45 0x2008>;
interrupts = <45 0x02>;
};
我已在 SENSOR_I2C_SCL(引脚号 131)和 SENSOR_I2C_SDA(引脚号 132)上连接 LSM6DS3 加速度传感器。
之后我成功编译了源代码并在目标设备(SC600T)上进行了 flash boot 和 dtbo。
当我尝试使用
adb shell >> /sys/bus/devices/i2C/devices
节点检查传感器数据时可用并且
lsm6ds3 地址节点为 6b 也是可用的。
但 lsm6ds3 传感器未被探测到。
在此输入图片描述
然后我将在 msm8953_defconfig 文件中添加以下行。
CONFIG_IIO_ST_LSM6DSX=y
CONFIG_IIO_ST_LSM6DSX_I2C=y
CONFIG_IIO_ST_LSM6DSX_SPI=y
CONFIG_IIO_ST_LSM6DSX_I3C=y
添加此文件后,当我编译源代码时出现以下错误:
[ 2% 309/12824] Building kernel...
FAILED: out/target/product/msm8953_64/obj/kernel/msm-4.9/arch/arm64/boot/Image.gz-dtb
/bin/bash -c "(rm -rf out/target/product/msm8953_64/obj/kernel/msm-4.9/arch/arm64/boot/dts ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- KCFLAGS=-mno-android ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- KCFLAGS=-mno-android modules ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 INSTALL_MOD_PATH=../../../dlkm INSTALL_MOD_STRIP=1 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- modules_install ) && (mdpath=\`find out/target/product/msm8953_64/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; ko=\`find \$mpath/kernel -type f -name *.ko\`; for i in \$ko; do mv \$i out/target/product/msm8953_64/dlkm/lib/modules/; done; fi ) && (mdpath=\`find out/target/product/msm8953_64/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; rm -rf \$mpath; fi )"
make: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9'
make[1]: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
make[2]: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
make[1]: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
CHK include/config/kernel.release
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
Using /media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9 as source for kernel
/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9 is not clean, please run 'make mrproper'
in the '/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9' directory.
make[2]: *** [prepare3] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
make: *** [sub-make] Error 2
make: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9'
[ 2% 312/12824] target C: libdsutils <= vendor/qcom/proprietary/data/dsutils/src/ds_util.c
vendor/qcom/proprietary/data/dsutils/src/ds_util.c:719:7: warning: unused variable 'adb_lvl' [-Wunused-variable]
int adb_lvl = 0;
^
vendor/qcom/proprietary/data/dsutils/src/ds_util.c:2357:5: warning: unused function 'ds_can_exec' [-Wunused-function]
int ds_can_exec
^
2 warnings generated.
[ 2% 314/12824] target C++: KmInstallKeybox <= ven...ecuremsm/keymaster_install_toolbox/InstallKeybox.cpp
ninja: build stopped: subcommand failed.
20:36:27 ninja failed with: exit status 1
#### failed to build some targets (42 seconds) ####
在 AOSP 中添加任何自定义传感器,这所有步骤是否都是必需的?为什么 lsm6ds3 传感器未被探测到?我需要从硬件方面检查什么吗?
移远SC600设备上的传感器通过称为ADSP的东西,这是闭源的。在此系统下,传感器通过vendor/qcom/proprietary/sensors/dsps/reg_defaults/sensor_def_qcomdev.conf文件进行配置。
有一系列可与 ADSP 配合使用的兼容传感器。您必须向您的移远代表询问。否则你必须要求他们集成你想要的传感器,这当然是一个过分的要求,所以认为这是不可能的(除非高通给你ADSP源代码,我认为这不会发生) ).