我是靠谱客的博主 伶俐手机,最近开发中收集的这篇文章主要介绍【高通SDM660 Android 10.0】(1) --- Sensor 驱动 Bringup Guide,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

代码位于:

# adsp_proc/Sensors/dd/qcom/src/sns_dd_lsm6dsm_uimg.c
/**
 * LSM6DSMLHC device driver interface.
 */
sns_ddf_driver_if_s sns_dd_lsm6dsm_if =
{
  &sns_dd_lsm6dsm_init,
  &sns_dd_lsm6dsm_get_data,
  &sns_dd_lsm6dsm_set_attr_uimg,
  &sns_dd_lsm6dsm_get_attr,
  &sns_dd_lsm6dsm_handle_timer,
  &sns_dd_lsm6dsm_handle_irq,
  &sns_dd_lsm6dsm_reset,
  &sns_dd_lsm6dsm_run_test,
  &sns_dd_lsm6dsm_sched_data,
  &sns_dd_lsm6dsm_probe,
  &sns_dd_lsm6dsm_trigger_fifo
};

结构体声明在

# adsp_proc/Sensors/dd/qcom/inc/sns_dd.h

extern sns_ddf_driver_if_s sns_dd_lsm6dsm_if;

将结构体与UUID绑定:

# adsp_proc/Sensors/smgr/src/sns_smgr_reg.c

#ifdef CONFIG_SUPPORT_LSM6DSM
{ SNS_REG_UUID_LSM6DSM, &sns_dd_lsm6dsm_if},
#endif

UUID 定义位于:

# adsp_proc/Sensors/common/inc/sns_reg_common.h

#define SNS_REG_UUID_LSM6DSM 
  {0x3c,0xfd,0x26,0xe8,0x52,0xaf,0x48,0xbe,0xac,0xc2,0x1d,0x40,0xfc,0x4c,0x53,0x68}

------------------------------------------------------------------------------------------------
# vendor/qcom/proprietary/sensors/dsps/sensordaemon/common/inc/sns_reg_common.h

#define SNS_REG_UUID_LSM6DSM 
  {0x3c,0xfd,0x26,0xe8,0x52,0xaf,0x48,0xbe,0xac,0xc2,0x1d,0x40,0xfc,0x4c,0x53,0x68}
  
==>
1902 0xbe48af52e826fd3c 0x00010001 #UUID
1903 0x68534cfc401dc2ac 0x00010001 #UUID

将代码编译进来:

# adsp_proc/Sensors/dd/qcom/build/dd_qcom.scons

DD_SOURCES = [
     "${BUILDPATH}/sns_dd_lsm6dsm.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_esp.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_fifo.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_fifo_uimg.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_selftest.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_uimg.c",
    	]
DD_UIMG_SOURCES = [
     "${BUILDPATH}/sns_dd_lsm6dsm_fifo_uimg.c",
     "${BUILDPATH}/sns_dd_lsm6dsm_uimg.c",
   		]

至此,在ADSP 侧,代码就 配置好了,可以看到UUID 同样也定义在了vendor 中,所以后面通过UUID 就能找到对应的sensor 了

# dsps/reg_defaults/sensor_def_qcomdev.conf
#######################################################################
###        sdm660 Chipsets
#######################################################################
:hardware sdm660
:platform
:property
:soc_id
:soc_rev
:subtype
# SSI SMGR Cfg 0: LSM6DSM Accel DRI/FIFO
1903 0x68534cfc401dc2ac 0x00010001 #UUID
1902 0xbe48af52e826fd3c 0x00010001 #UUID
1904 100000 0x00010001             #off_to_idle
1905 100000 0x00010001             #idle_to_ready
1906 0x1001 0x00010001             #SPI_bus
1907 1000 0x00010001               #reg_group_id
1908 0 0x00010001                  #cal_grp_id
1909 68 0x00010001                 #gpio1
1910 0xFFFF 0x00010001             #gpio2
1911 0 0x00010001                  #sensor_id
1912 0 0x00010001                  #CS for SPI
1913 1 0x00010001                  #data_type1
1914 4 0x00010001                  #data_type2
1915 -1 0x00010001                 #rel_sns_idx
1916 2 0x00010001                  #sens_default
1917 0xD0 0x00010001               #flags
1982 0 0x00010001                  #device_select
1987 0x8E 0x00010001               #vdd
1988 0x8E 0x00010001               #vddio

# SSI SMGR Cfg 1: LSM6DSM Gyro DRI/FIFO
1919 0x68534cfc401dc2ac 0x00010001 #UUID
1918 0xbe48af52e826fd3c 0x00010001 #UUID
1920 100000 0x00010001             #off_to_idle
1921 100000 0x00010001             #idle_to_ready
1922 0x1001 0x00010001             #SPI_bus
1923 1010 0x00010001               #reg_group_id
1924 10 0x00010001                 #cal_grp_id
1925 68 0x00010001                 #gpio1
1926 0xFFFF 0x00010001             #gpio2
1927 10 0x00010001                 #sensor_id
1928 0 0x00010001                  #CS for SPI
1929 3 0x00010001                  #data_type1
1930 4 0x00010001                  #data_type2
1931 -1 0x00010001                 #rel_sns_idx
1932 4 0x00010001                  #sens_default
1933 0xD0 0x00010001               #flags
1983 0 0x00010001                  #device_select
1989 0x8E 0x00010001               #vdd
1990 0x8E 0x00010001               #vddio

最后

以上就是伶俐手机为你收集整理的【高通SDM660 Android 10.0】(1) --- Sensor 驱动 Bringup Guide的全部内容,希望文章能够帮你解决【高通SDM660 Android 10.0】(1) --- Sensor 驱动 Bringup Guide所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部