1.硬件配置 打开核心板原理图,配置GYRO(陀螺仪),ALSPS(光感),G-sensor(加速度)的ENIT和GPIO以及I2C,打开 vendor\mediatek\proprietary\scripts\dct\DrvGen.exe 工具选择 (1)vendor\mediatek\proprietary\bootable\bootloader\lk\target\tb8788p1_64_bsp\dct\dct\codegen.dws (2)kernel-4.4\drivers\misc\mediatek\dws\mt6771\tb8788p1_64_bsp.dws 配置操作如图所示:
如果不知道I2C挂在哪个总线上,地址是多少,可以参考一下操作 路径: kernel-4.4\arch\arm64\boot\dts\mediatek\tb8788p1_64_bsp.dts(搜索sensor)
2.sensor 驱动移植 2.1 添加光感驱动文件(ap3xx6c) 将ap3xx6c驱动文件夹添加到alsps(光感)目录中 kernel-4.4\drivers\misc\mediatek\sensors-1.0\alsps\ap3xx6c
2.2 修改配置文件 (1)路径:device/mediateksample/tb8788p1_64_bsp/ProjectConfig.mk - CUSTOM_KERNEL_GYROSCOPE = yes
复制代码(2)路径:kernel-4.4/arch/arm64/configs/tb8788p1_64_bsp_defconfig,添加以下代码,有的话就不用添加,添加没有的就行 - CONFIG_MTK_SENSORS_1_0=y
- CONFIG_CUSTOM_KERNEL_ACCELEROMETER=y
- #CONFIG_MTK_MC3410_I2C is not set
- CONFIG_CUSTOM_KERNEL_ALSPS=y
- CONFIG_MTK_LTR303=y
- #CONFIG_MTK_LTR303 is not set
- CONFIG_MTK_AP3XX6C=y
- CONFIG_CUSTOM_KERNEL_MAGNETOMETER=y
- CONFIG_MTK_AKM09918=y
- CONFIG_CUSTOM_KERNEL_GYROSCOPE=y
- CONFIG_MTK_MPU6050GY=y
- CONFIG_MTK_MPU6050G=y
复制代码(3)路径:kernel-4.4/drivers/misc/mediatek/sensors-1.0/alsps/Kconfig - source "drivers/misc/mediatek/sensors-1.0/alsps/ap3xx6c/Kconfig"
复制代码(4)路径:kernel-4.4/drivers/misc/mediatek/sensors-1.0/alsps/Makefile - obj-$(CONFIG_MTK_AP3XX6C) += ap3xx6c/
复制代码
|