|
发表于 2023-4-3 14:41:23
1524 浏览 0 回复
SC9863A,UMS512T,UIS8581E,UIS7862A,UIS7862S 如何关闭sensorhub功能
[QUESTION]
支持sensorhub的平台如何将sensorhub架构关闭
[ANSWER]
请按照以下步骤修改:
(A)、 BoardConfig.mk
/device/sprd/sharkl***/${customer_product}/BoardConfig.mk
去掉如下sensorhub配置如下:
- USE_SPRD_SENSOR_HUB := true
- # Config Sensor driver
- SENSOR_HUB_ACCELEROMETER := icm20600
- SENSOR_HUB_GYROSCOPE := icm20600
- SENSOR_HUB_LIGHT := ltr553als
- SENSOR_HUB_MAGNETIC := akm09918
- SENSOR_HUB_PROXIMITY := ltr553iwhale2
- SENSOR_HUB_PRESSURE := null
- SENSOR_HUB_CALIBRATION := sp9863a
- # Config Sensor feature: sensorlist
- SENSOR_HUB_FEATURE := hub
复制代码 增加以下配置,具体sensor名称根据客制化需求修改
- # select sensor
- USE_SPRD_SENSOR_LIB := true //表示使用传统sensor架构
- BOARD_HAVE_ACC := Bma253
- BOARD_ACC_INSTALL := 1
- BOARD_HAVE_ORI := akm099xx
- BOARD_ORI_INSTALL := NULL
- BOARD_HAVE_PLS := LTR558ALS
- BOARD_PLS_COMPATIBLE := true
复制代码
(B)、 DeviceCommon.mk
/device/sprd/sharkl***/common/DeviceCommon.mk
去掉如下配置
- PRODUCT_PACKAGES += \
- sensors.firmware \
- libsensorsdrvcfg \
- libsensorlistcfg \
复制代码
(C)、 Kernel驱动
- 去除sensorhub代码相关的DTS配置节点、defconfig项,例如:
- 1.kernel/kernel4.14/arch/arm64/boot/dts/sprd/ums512-mach.dtsi
- 去掉如下代码:
- sprd-sensorhub {
- compatible = "sprd,sharkl5Pro-sensorhub";
- };
- 2.bsp/kernel/kernel4.14/arch/arm64/configs/sprd_sharkl5Pro_defconfig
- 将
- CONFIG_SPRD_SENSOR_HUB=y
- 改为:
- # CONFIG_SPRD_SENSOR_HUB is not set
复制代码- 增加对应需要使用的sensor kernel驱动,Android 9.0及之后版本请以ko的方式加载,使用input子系统上报,参考如下
- 1.bsp/modules/input/misc/ltr_558als/
- 仿照该sensor添加对应的sensor
- 2.dts的文件的添加参考:
- bsp/kernel/kernel4.14/arch/arm/boot/dts/XXX.dts
- ltr-558als@23{
- compatible = "LITEON,ltr_558als";
- reg = <0x23>;
- gpios = <&ap_gpio 52 GPIO_ACTIVE_HIGH>;
- sensitive = <1000 40 35 1200 1000 48>;
- luxcorrection = <3500>;
- };
- 3.hal 层 配置
- vendor/sprd/modules/sensors/libsensorclassic/pls
- 在该目录下添加类似Pls_LTR558ALS.cpp 的hal层的代码,主要修改sensor_list内容,可以请第三方厂商提供。注意该名字与BoardConfig.mk的名字需对应
- 4. 添加package信息
- bsp/device/sharkl***/androidq/${customer_product}/${customer_product}_base/modules.cfg
- BSP_MODULES_LIST="
- + ltr_558als.ko
- 5.添加KO文件到系统编译中
- device/sprd/sharkl***/${customer_product}/${customer_product}_Natv.mk
- PRODUCT_SOCKO_KO_LIST := \
- + $(BSP_KERNEL_MODULES_OUT)/ltr_558als.ko \
-
- 6.加载ko
- device/sprd/sharkl***/${customer_product}/rootdir/root/init.sensors.rc
- on post-fs
- + insmod ${ro.vendor.ko.mount.point}/socko/ltr_558als.ko
- on factorytest
- + insmod ${ro.vendor.ko.mount.point}/socko/ltr_558als.kodevice/
-
- 7.权限:
- device/sprd/sharkl***/common/rootdir/root/ueventd.common.rc
- + /dev/ltr_558als 0660 system input
- device/sprd/sharkl***/common/sepolicy/file_contexts
- + /dev/ltr_558als u:object_r:sensors_device:s0
复制代码
(D)、 Pinmap配置
sensorhub架构随CM4睡眠,传统 sensor架构随AP睡眠。
SPRD平台的参考设计中,sensor通常是连接到IIC2引脚上面,下面以IIC2为例,说明pinmap的修改:
iic_matrix_mtx_cfg 寄存器 -- 将连接sensor的i2c从CM4改为配给AP使用
-{REG_PIN_IIC_MATRIX_MTX_CFG,0x00003010},//IIC0->AP_IIC0;IIC1->AP_IIC1;IIC2->SP_IIC0;IIC3->AP_IIC3;IIC4->AP_IIC4;IIC5->AP_IIC5;IIC6->AON_IIC0;
+{REG_PIN_IIC_MATRIX_MTX_CFG,0x00003000},//IIC0->AP_IIC0;IIC1->AP_IIC1;IIC2->SP_IIC0;IIC3->AP_IIC3;IIC4->AP_IIC4;IIC5->AP_IIC5;IIC6->AON_IIC0;
(ps:详细可搜对应平台的芯片手册的iic_matrix_mtx_cfg寄存器,8581平台如上修改,7862平台需要考虑控制器的交换可咨询fae)
-{REG_MISC_PIN_SCL2, BITS_PIN_DS(1)|BIT_PIN_WPUS|BIT_PIN_WPU|BIT_PIN_SLP_CM4|BIT_PIN_SLP_WPU|BIT_PIN_SLP_Z},//I2C2_SCL
+{REG_MISC_PIN_SCL2, BITS_PIN_DS(1)|BIT_PIN_WPUS|BIT_PIN_WPU|BIT_PIN_SLP_AP|BIT_PIN_SLP_WPU|BIT_PIN_SLP_Z},//I2C2_SCL
{REG_PIN_SDA2, BITS_PIN_AF(0)},
-{REG_MISC_PIN_SDA2, BITS_PIN_DS(1)|BIT_PIN_WPUS|BIT_PIN_WPU|BIT_PIN_SLP_CM4|BIT_PIN_SLP_WPU|BIT_PIN_SLP_Z},//I2C2_SDA
+{REG_MISC_PIN_SDA2, BITS_PIN_DS(1)|BIT_PIN_WPUS|BIT_PIN_WPU|BIT_PIN_SLP_AP|BIT_PIN_SLP_WPU|BIT_PIN_SLP_Z},//I2C2_SDA
|
|
手机微信同号:13682654092
|
|
|
|
|
登录或注册
|