MTK Android Driver :sensor
16. 感測器
MTK_SENSOR_SUPPORT= yes
CUSTOM_KERNEL_ACCELEROMETER= auto//重力加速度感測器
CUSTOM_KERNEL_MAGNETOMETER=akm8975//磁力感應器//
CUSTOM_KERNEL_ALSPS= tmd2771//光感距離感測器
CUSTOM_KERNEL_BAROMETER=//氣壓計
CUSTOM_KERNEL_GYROSCOPE=//陀螺儀
16.1 重力加速度感測器(G-sensor感應器)
CUSTOM_KERNEL_ACCELEROMETER= auto//感測器
#ifdefined(MTK_AUTO_DETECT_ACCELEROMETER)
\mediatek\source\kernel\drivers\hwmon\hwmsen\Hwmsen_dev.c
inthwmsen_gsensor_add(struct sensor_init_info* obj)
\mediatek\custom\common\kernel\accelerometer\auto\
重力感測方向設定:
\alps\mediatek\custom\\kernel\accelerometer\mc3210\cust_acc.c
static structacc_hw cust_acc_hw = {
.i2c_num = 2,
.direction = 5, // modify//
16.2 ALS\PS 光感距離感測器
CUSTOM_KERNEL_ALSPS= tmd2771
mediatek\custom\common\kernel\alsps\tmd2771\tmd2771.c
mediatek\custom\common\kernel\alsps\tmd2771\tmd2771.h
mediatek\custom\prj\kernel\alsps\tmd2771\cust_alsps.c
16.3 GYRO-sensormotion sensor 陀螺儀
CUSTOM_KERNEL_GYROSCOPE= l3g4200d
mediatek\custom\common\kernel\gyroscope\l3g4200d\l3g4200d.c
mediatek\custom\prj\kernel\gyroscope\l3g4200d\cust_gyro.c
16.4 BAROMETER-sensor氣壓計
CUSTOM_KERNEL_BAROMETER= ms5607
mediatek\custom\prj\kernel\barometer\ms5607\cust_baro.c
mediatek\custom\common\kernel\barometer\ms5607\ms5607.c
16.5 MAGNETOMETER 磁感應器
\alps\mediatek\custom\\kernel\magnetometer\yamaha532\cust_mag.c
磁感應方向設定:
static structmag_hw cust_mag_hw = {
.i2c_num = 2,
.direction = 3,//磁感應方向//參照規格書
.power_id = MT65XX_POWER_NONE, /*!< LDO is not used */
.power_vol= VOL_DEFAULT, /*!< LDO is not used */
};
16.6 compass 指南針
CUSTOM_KERNEL_MAGNETOMETER= akm8975
mediatek\custom\common\kernel\magnetometer\akm8975\akm8975.c
mediatek\custom\konka73_gb\kernel\magnetometer\akm8975\cust_mag.c
17. 震動馬達
CUSTOM_KERNEL_VIBRATOR=vibrator
a.馬達震動幅度(MT6582及其他最新平臺):
..\mediatek\custom\\kernel\vibrator\cust_vibrator.c
static structvibrator_hw cust_vibrator_hw = {
.vib_timer = 80,//30, //振動時長
.vib_limit = 9,//振動??
.vib_vol = 0x5, //2.8V for vibr // :0x5//振動電壓
};
b.馬達震動幅度MT6577直接修改pmic驅動電壓:
此檔案可以修改各個gpio驅動電壓:
\alps\mediatek\platform\mt6577\lk\mt_pmic.c
void PMIC_CUSTOM_SETTING_V1(void){}
ret=pmic_config_interface(BANK0_DIGLDO_CON33,0x3,
BANK_0_RG_VIBR_VOSEL_MASK,BANK_0_RG_VIBR_VOSEL_SHIFT);//0x4