5. MTK 平台使用DTS的方式兼容不同gsensor的修改

MTK 平台使用DTS的方式兼容不同gsensor的修改

 

一.在dct工具目录下的I2C_YuSu.cmp文件中添加GSENSOR_1

80_c_m\update\alps\kst\drv\dct\dct\old_dct\I2C_YuSu.cmp

GSENSOR

GSENSOR_1

这样在使用DrvGen.exe打开codegen.dws时,I2C选项卡就能配置GSENSOR和GSENSOR_1,配置两种gsensor的i2c地址

 

 

二.在dts中添加两种gsensor的配置,如下

update/alps/kst/drv/dct/v117_128_dws/magc6580_we_c_m.dts

                cust_accel@0 {

                compatible                              = "mediatek,mc3xxx";

                i2c_num                         = <2>;

                i2c_addr                                = <0x4c 0 0 0>;

                direction                               = <5>;

                power_id                                = <0xffff>;

                power_vol                               = <0>;

                firlen                                  = <0>;

                is_batch_supported                      = <0>;

                        };

 

                cust_accel_mxc6255@0 {

                compatible                              = "mediatek,MXC622X";

                i2c_num                         = <2>;

                i2c_addr                                = <0x15 0 0 0>;

                direction                               = <2>;

                power_id                                = <0xffff>;

                power_vol                               = <0>;

                firlen                                  = <0>;

                is_batch_supported                      = <0>;

                        };

 

三.mxc622x.c中配置成mediatek,gsensor_1,用宏CONFIG_KST_ACCEL_COMPATIBLE来控制

80_c_m\update\alps\kernel-3.18\drivers\misc\mediatek\accelerometer\mc3xxx_auto\mc3xxx.c

static const struct of_device_id accel_of_match[] = {

         {.compatible = "mediatek,gsensor"},

         {},

};

 

80_c_m\update\alps\kernel-3.18\drivers\misc\mediatek\accelerometer\mxc6255\mxc622x.c

#if defined(CONFIG_KST_ACCEL_COMPATIBLE)

static const struct of_device_id accel_of_match[] = {

        {.compatible = "mediatek,gsensor_1"},

        {},

};

#else

static const struct of_device_id accel_of_match[] = {

        {.compatible = "mediatek,gsensor"},

        {},

};

#endif

 

四.Kconfig中添加KST_ACCEL_COMPATIBLE的配置

80_c_m\update\alps\kernel-3.18\kst\Kconfig

config KST_ACCEL_COMPATIBLE

         bool "KST ACCEL COMPATIBLE aosp"

         default n

         ---help---

           Kingsentime KST ACCEL COMPATIBLE aosp

 

五.在mk中配置两种gsensor的驱动文件夹的名称,同时配置上KST_ACCEL_COMPATIBLE

update/alps/kst/make/v117_hd_chaoshang_128_b1b5_8Gb_2d2.mk

-KST_KERNEL_BOARD_CUSTOM05 =

+KST_KERNEL_BOARD_CUSTOM05 = KST_ACCEL_COMPATIBLE

转载于:https://www.cnblogs.com/f888/p/8041775.html

你可能感兴趣的:(5. MTK 平台使用DTS的方式兼容不同gsensor的修改)