MT6580平台sensor的客制化方向等参数是如何获取的

MTK FAQ资料

MTK软件资料

描述:

MT6580 最新架构的sensor 的客制化方向等参数是如何获取的?

方法:

static int __init akm09911_init(void)
{
const char *name = "mediatek,AKM09911";
hw = get_mag_dts_func(name, hw); //优先通过dts获取
if (!hw)
hw = get_cust_mag_hw();
#ifdef CONFIG_MTK_LEGACY
struct I2C_board_info i2c_akm09911={ I2C_BOARD_INFO("akm09911", hw->i2c_addr[0])};
MAGN_LOG("[%s]: i2c_number=%d,i2c_addr=0x%x\n",__func__,hw->i2c_num,hw->i2c_addr[0]);
i2c_register_board_info(hw->i2c_num, &i2c_akm09911, 1);
#endif
mag_driver_add(&akm09911_init_info);
return 0;
}
get_mag_dts_func函数获取的客制化参数路径为kernel-3.10/arch/arm/boot/dts/xx.dts
不同sensor类型l客制化参数格式
cust_accel@0 {
compatible = "mediatek,MC3410";
i2c_num = <2>;
i2c_addr = <0x4c 0 0 0>;
direction = <2>; // 3 2
power_id = <0xffff>;
power_vol = <0>;
firlen = <0>;
is_batch_supported = <0>;
};
cust_alsps@0 {
compatible = "mediatek,CM36652";
i2c_num = <2>;
i2c_addr = <0x60 0 0 0>;
polling_mode_ps = <0>;
polling_mode_als = <1>;
power_id = <0xffff>;
power_vol = <0>; /* Total has 15 level*/
als_level = <0 125 319 525 1091 2480 3058 5115 8589 10769 12857 17807 22091 65535
65535>;/* Total has 16 range*/
als_value = <0 133 303 504 1002 2003 3006 5003 8002 10000 12000 16000 20000 20000 20000
20000>;
ps_threshold_high = <26>;
ps_threshold_low = <21>;
is_batch_supported_ps = <0>;
is_batch_supported_als = <0>;
};
cust_mag@0 {
compatible = "mediatek,AKM09911";
i2c_num = <2>;
i2c_addr = <0x0D 0 0 0>;
direction = <4>;
power_id = <0xffff>;
power_vol = <0>;
is_batch_supported = <0>;
};
cust_gyro@0 {
compatible = "mediatek,ITG1010";
i2c_num = <2>;
i2c_addr = <0x68 0 0 0>;
direction = <1>;
power_id = <0xffff>;
power_vol = <0>;
firlen = <0>;
is_batch_supported = <0>;
};
/* end sensor */

本文转载自一牛网论坛--mt6580平台

猜你喜欢

转载自blog.csdn.net/qq_42792038/article/details/82660427