微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 6580平台SENSOR的方向等客制化参数如何通过dts获取的

6580平台SENSOR的方向等客制化参数如何通过dts获取的

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]

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

[SOLUTION]

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 */

看不懂

加油  

努力发帖ing

谢谢分享

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top