一、硬件原理图,连接如下:
从上述的原理图我们可以得到管脚的连接:
SENSOR_I2C_SCL1 --->GPIO14
SENSOR_I2C_SDA1 --->GPIO15
EINT-PS ---> GPIO60
2.1 首先跟FAE获取当前项目的驱动代码:
2.2 如下是在cp侧的代码修改如下:
把sns_dd_alsprx_stk3x3x.c、sns_dd_alsprx_stk3x3x.h、sns_dd_alsprx_stk3x3x_uimg.c 放到ADSP.VT.3.0 / adsp_proc/Sensors/dd/qcom/src/ 这个目录
2.3 配置编译如下
diff --git a/adsp_proc/Sensors/build/Sensors.scons b/adsp_proc/Sensors/build/Sensors.scons
index f507109..bb8d445 100755
--- a/adsp_proc/Sensors/build/Sensors.scons
+++ b/adsp_proc/Sensors/build/Sensors.scons
@@ -388,6 +388,7 @@env.Append(CPPDEFINES = ["CONFIG_SUPPORT_EPL259X"])env.Append(CPPDEFINES = ["CONFIG_SUPPORT_KXTJ2"])env.Append(CPPDEFINES = ["CONFIG_SUPPORT_MC3416"])
+ env.Append(CPPDEFINES = ["CONFIG_SUPPORT_STK3X3X"])#env.Append(CPPDEFINES = ["FEATURE_TEST_ALGO_GPIO"])env.Replace(SNS_QMI_ENABLE = True)env.Append(CPPDEFINES = ["USE_NATIVE_MEMCPY"])
diff --git a/adsp_proc/Sensors/common/inc/sns_reg_common.h b/adsp_proc/Sensors/common/inc/sns_reg_common.h
index 44d0b08..59ac2e4 100755
--- a/adsp_proc/Sensors/common/inc/sns_reg_common.h
+++ b/adsp_proc/Sensors/common/inc/sns_reg_common.h
@@ -1807,6 +1807,8 @@#define SNS_REG_UUID_TMG490x \{0xaa,0x50,0x3b,0xd7,0xc0,0xda,0x4f,0xd2,0xad,0xd5,0xf2,0x79,0x7c,0x58,0x83,0x3a}#define SNS_REG_UUID_EPL259X \
+ {0x5f,0x82,0x42,0xac,0x58,0x0c,0x11,0xe8,0x9e,0x97,0x4c,0xcc,0x6a,0x79,0x25,0xc1}
+#define SNS_REG_UUID_STK3X3X \{0x4f,0x82,0x42,0xac,0x58,0x0c,0x11,0xe8,0x9e,0x97,0x4c,0xcc,0x6a,0x79,0x15,0xc0}#define SNS_REG_UUID_KXTJ2 \{0x73,0x47,0x6f,0x10,0x03,0xce,0x85,0xbe,0xc0,0xe9,0x88,0xe2,0x73,0xfe,0x8b,0x87}
diff --git a/adsp_proc/Sensors/dd/qcom/build/dd_qcom.scons b/adsp_proc/Sensors/dd/qcom/build/dd_qcom.scons
index 0ce2951..5f04201 100755
--- a/adsp_proc/Sensors/dd/qcom/build/dd_qcom.scons
+++ b/adsp_proc/Sensors/dd/qcom/build/dd_qcom.scons
@@ -310,6 +310,8 @@"${BUILDPATH}/drv_mc34xx_uimg.c","${BUILDPATH}/sns_dd_accel_mc34xx.c","${BUILDPATH}/sns_dd_uimg_accel_mc34xx.c",
+ "${BUILDPATH}/sns_dd_alsprx_stk3x3x.c",
+ "${BUILDPATH}/sns_dd_alsprx_stk3x3x_uimg.c",]DD_UIMG_SOURCES = [
@@ -335,6 +337,7 @@"${BUILDPATH}/sns_dd_alt_bmp280_uimg.c","${BUILDPATH}/sns_dd_uimg_accel_mc34xx.c","${BUILDPATH}/drv_mc34xx_uimg.c",
+ "${BUILDPATH}/sns_dd_alsprx_stk3x3x_uimg.c",]if 'SNS_HIMEM_UIMG' in env['CPPDEFINES']:
diff --git a/adsp_proc/Sensors/dd/qcom/inc/sns_dd.h b/adsp_proc/Sensors/dd/qcom/inc/sns_dd.h
index e3c7d62..a0b23e1 100755
--- a/adsp_proc/Sensors/dd/qcom/inc/sns_dd.h
+++ b/adsp_proc/Sensors/dd/qcom/inc/sns_dd.h
@@ -158,6 +158,7 @@extern sns_ddf_driver_if_s sns_dd_epl259x_driver_if;extern sns_ddf_driver_if_s sns_dd_accel_kxtj2;extern sns_ddf_driver_if_s sns_dd_acc_mc34xx_if;
+extern sns_ddf_driver_if_s sns_alsprx_stk3x3x_driver_fn_list;/* Generic DD interfaces available for vendors */extern sns_ddf_driver_if_s sns_dd_vendor_if_1;
diff --git a/adsp_proc/Sensors/ddf/inc/sns_ddf_common.h b/adsp_proc/Sensors/ddf/inc/sns_ddf_common.h
index 9278692..1fdf147 100755
--- a/adsp_proc/Sensors/ddf/inc/sns_ddf_common.h
+++ b/adsp_proc/Sensors/ddf/inc/sns_ddf_common.h
@@ -246,6 +246,7 @@SNS_DDF_VENDOR_MEMSIC,SNS_DDF_VENDOR_PARTRON,SNS_DDF_VENDOR_MCUBE,
+ SNS_DDF_VENDOR_SENSORTEK,SNS_DDF_VENDOR_NUM_SUPPORTED /**< Add new entries above this line. */} sns_ddf_vendor_e;
diff --git a/adsp_proc/Sensors/smgr/src/sns_smgr_reg.c b/adsp_proc/Sensors/smgr/src/sns_smgr_reg.c
index 17ea2b2..ebabf89 100755
--- a/adsp_proc/Sensors/smgr/src/sns_smgr_reg.c
+++ b/adsp_proc/Sensors/smgr/src/sns_smgr_reg.c
@@ -445,6 +445,10 @@#ifdef CONFIG_SUPPORT_MC3416{ SNS_REG_UUID_MC3416, &sns_dd_acc_mc34xx_if},#endif
+#ifdef CONFIG_SUPPORT_STK3X3X
+ { SNS_REG_UUID_STK3X3X, &sns_alsprx_stk3x3x_driver_fn_list},
+#endif
+#endif // SENSORS_DD_DEV_FLAG
2.4 AP侧修改vendor/qcom/proprietary/sensors / dsps/reg_defaults/sensor_def_qcomdev.conf
添加STK3337的配置文件信息
# SSI SMGR Cfg 3: stk3x3x prx/als DRI
2303 0xc015796acc4c979e 0x00010001 #UUID
2302 0xe8110c58ac42824f 0x00010001 #UUID
2304 5700 0x00010001 #off_to_idle
2305 0 0x00010001 #idle_to_ready
2306 0xFFFF 0x00010001 #gpio1
2307 1040 0x00010001 #reg_group_id
2308 0xFFFF 0x00010001 #cal_grp_id
2309 4 0x00010001 #i2c_bus
2310 0x47 0x00010001 #i2c_address
2311 0 0x00010001 #sens_default
2312 0x00 0x00010001 #flags
2368 0xff 0x00010003 #vdd
2369 0xff 0x00010003 #vddio