Loading drivers/misc/mediatek/accelerometer/lsm6ds3/lsm6ds3.c +9 −17 Original line number Diff line number Diff line Loading @@ -1129,30 +1129,22 @@ static int LSM6DS3_acc_Enable_Func(struct i2c_client *client, LSM6DS3_ACC_GYRO_F #endif #ifdef LSM6DS3_STEP_COUNTER //step counter static int LSM6DS3_W_Open_RAM_Page(struct i2c_client *client, LSM6DS3_ACC_GYRO_RAM_PAGE_t newValue) static int LSM6DS3_enable_embedded_page_regs(struct i2c_client *client, bool enable) { u8 databuf[2] = {0}; int res = 0; GSE_FUN(); if(hwmsen_read_byte(client, LSM6DS3_RAM_ACCESS, databuf)) { GSE_ERR("%s read LSM6DS3_RAM_ACCESS register err!\n", __func__); return LSM6DS3_ERR_I2C; } else { GSE_LOG("%s read acc data format register: 0x%x\n", __func__, databuf[0]); databuf[0] = LSM6DS3_FUNC_CFG_ACCESS; if (enable) { databuf[1] = LSM6DS3_FUNC_CFG_REG2_MASK; } databuf[0] &= ~LSM6DS3_RAM_PAGE_MASK;//clear databuf[0] |= newValue; databuf[1] = databuf[0]; databuf[0] = LSM6DS3_RAM_ACCESS; res = i2c_master_send(client, databuf, 0x2); if(res <= 0) { GSE_ERR("%s write LSM6DS3_RAM_ACCESS register err!\n", __func__); GSE_ERR("%s write LSM6DS3_FUNC_CFG_ACCESS register err!\n", __func__); return LSM6DS3_ERR_I2C; } Loading @@ -1165,7 +1157,7 @@ static int LSM6DS3_Write_PedoThreshold(struct i2c_client *client, u8 newValue) int res = 0; GSE_FUN(); res = LSM6DS3_W_Open_RAM_Page(client, LSM6DS3_ACC_GYRO_RAM_PAGE_ENABLED); res = LSM6DS3_enable_embedded_page_regs(client, true); if(LSM6DS3_SUCCESS != res) { return res; Loading Loading @@ -1200,10 +1192,10 @@ static int LSM6DS3_Write_PedoThreshold(struct i2c_client *client, u8 newValue) GSE_ERR("%s write LSM6DS3_CTRL10_C register err!\n", __func__); return LSM6DS3_ERR_I2C; } res = LSM6DS3_W_Open_RAM_Page(client, LSM6DS3_ACC_GYRO_RAM_PAGE_DISABLED); res = LSM6DS3_enable_embedded_page_regs(client, false); if(LSM6DS3_SUCCESS != res) { GSE_ERR("%s write LSM6DS3_W_Open_RAM_Page failed!\n", __func__); GSE_ERR("%s write LSM6DS3_enable_embedded_page_regs failed!\n", __func__); return res; } Loading drivers/misc/mediatek/accelerometer/lsm6ds3/lsm6ds3.h +2 −8 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ /* LSM6DS3 Register Map (Please refer to LSM6DS3 Specifications) */ #define LSM6DS3_FUNC_CFG_ACCESS 0x00 #define LSM6DS3_RAM_ACCESS 0X01 #define LSM6DS3_FUNC_CFG_ACCESS 0x01 #define LSM6DS3_SENSOR_SYNC_TIME_FRAME 0X04 /*FIFO control register*/ Loading Loading @@ -295,12 +294,7 @@ typedef enum { #define LSM6DS3_ACC_GYRO_SIGN_MOT_MASK 0x01 typedef enum { LSM6DS3_ACC_GYRO_RAM_PAGE_DISABLED =0x00, LSM6DS3_ACC_GYRO_RAM_PAGE_ENABLED =0x80, } LSM6DS3_ACC_GYRO_RAM_PAGE_t; #define LSM6DS3_RAM_PAGE_MASK 0x80 #define LSM6DS3_FUNC_CFG_REG2_MASK 0x80 #define LSM6DS3_CONFIG_PEDO_THS_MIN 0x0F typedef enum { Loading drivers/misc/mediatek/gyroscope/lsm6ds3gy/lsm6ds3_gy.h +1 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,7 @@ /* LSM6DS3 Register Map (Please refer to LSM6DS3 Specifications) */ /*lenovo-sw caoyi1 modify 20150325 begin*/ #define LSM6DS3_FUNC_CFG_ACCESS 0x00 /*lenovo-sw caoyi1 modify 20150325 end*/ #define LSM6DS3_FUNC_CFG_ACCESS 0x01 #define LSM6DS3_SENSOR_SYNC_TIME_FRAME 0X04 /*FIFO control register*/ Loading Loading
drivers/misc/mediatek/accelerometer/lsm6ds3/lsm6ds3.c +9 −17 Original line number Diff line number Diff line Loading @@ -1129,30 +1129,22 @@ static int LSM6DS3_acc_Enable_Func(struct i2c_client *client, LSM6DS3_ACC_GYRO_F #endif #ifdef LSM6DS3_STEP_COUNTER //step counter static int LSM6DS3_W_Open_RAM_Page(struct i2c_client *client, LSM6DS3_ACC_GYRO_RAM_PAGE_t newValue) static int LSM6DS3_enable_embedded_page_regs(struct i2c_client *client, bool enable) { u8 databuf[2] = {0}; int res = 0; GSE_FUN(); if(hwmsen_read_byte(client, LSM6DS3_RAM_ACCESS, databuf)) { GSE_ERR("%s read LSM6DS3_RAM_ACCESS register err!\n", __func__); return LSM6DS3_ERR_I2C; } else { GSE_LOG("%s read acc data format register: 0x%x\n", __func__, databuf[0]); databuf[0] = LSM6DS3_FUNC_CFG_ACCESS; if (enable) { databuf[1] = LSM6DS3_FUNC_CFG_REG2_MASK; } databuf[0] &= ~LSM6DS3_RAM_PAGE_MASK;//clear databuf[0] |= newValue; databuf[1] = databuf[0]; databuf[0] = LSM6DS3_RAM_ACCESS; res = i2c_master_send(client, databuf, 0x2); if(res <= 0) { GSE_ERR("%s write LSM6DS3_RAM_ACCESS register err!\n", __func__); GSE_ERR("%s write LSM6DS3_FUNC_CFG_ACCESS register err!\n", __func__); return LSM6DS3_ERR_I2C; } Loading @@ -1165,7 +1157,7 @@ static int LSM6DS3_Write_PedoThreshold(struct i2c_client *client, u8 newValue) int res = 0; GSE_FUN(); res = LSM6DS3_W_Open_RAM_Page(client, LSM6DS3_ACC_GYRO_RAM_PAGE_ENABLED); res = LSM6DS3_enable_embedded_page_regs(client, true); if(LSM6DS3_SUCCESS != res) { return res; Loading Loading @@ -1200,10 +1192,10 @@ static int LSM6DS3_Write_PedoThreshold(struct i2c_client *client, u8 newValue) GSE_ERR("%s write LSM6DS3_CTRL10_C register err!\n", __func__); return LSM6DS3_ERR_I2C; } res = LSM6DS3_W_Open_RAM_Page(client, LSM6DS3_ACC_GYRO_RAM_PAGE_DISABLED); res = LSM6DS3_enable_embedded_page_regs(client, false); if(LSM6DS3_SUCCESS != res) { GSE_ERR("%s write LSM6DS3_W_Open_RAM_Page failed!\n", __func__); GSE_ERR("%s write LSM6DS3_enable_embedded_page_regs failed!\n", __func__); return res; } Loading
drivers/misc/mediatek/accelerometer/lsm6ds3/lsm6ds3.h +2 −8 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ /* LSM6DS3 Register Map (Please refer to LSM6DS3 Specifications) */ #define LSM6DS3_FUNC_CFG_ACCESS 0x00 #define LSM6DS3_RAM_ACCESS 0X01 #define LSM6DS3_FUNC_CFG_ACCESS 0x01 #define LSM6DS3_SENSOR_SYNC_TIME_FRAME 0X04 /*FIFO control register*/ Loading Loading @@ -295,12 +294,7 @@ typedef enum { #define LSM6DS3_ACC_GYRO_SIGN_MOT_MASK 0x01 typedef enum { LSM6DS3_ACC_GYRO_RAM_PAGE_DISABLED =0x00, LSM6DS3_ACC_GYRO_RAM_PAGE_ENABLED =0x80, } LSM6DS3_ACC_GYRO_RAM_PAGE_t; #define LSM6DS3_RAM_PAGE_MASK 0x80 #define LSM6DS3_FUNC_CFG_REG2_MASK 0x80 #define LSM6DS3_CONFIG_PEDO_THS_MIN 0x0F typedef enum { Loading
drivers/misc/mediatek/gyroscope/lsm6ds3gy/lsm6ds3_gy.h +1 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,7 @@ /* LSM6DS3 Register Map (Please refer to LSM6DS3 Specifications) */ /*lenovo-sw caoyi1 modify 20150325 begin*/ #define LSM6DS3_FUNC_CFG_ACCESS 0x00 /*lenovo-sw caoyi1 modify 20150325 end*/ #define LSM6DS3_FUNC_CFG_ACCESS 0x01 #define LSM6DS3_SENSOR_SYNC_TIME_FRAME 0X04 /*FIFO control register*/ Loading