driver: mpu: to support mpu6881/mpu6880

Change-Id: I731788cd35d27d2aab946ccb22f744aad85f7be3
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
This commit is contained in:
Zorro Liu 2017-06-12 17:48:04 +08:00 committed by Huang, Tao
parent 03078e9fda
commit 7943fd79ea
3 changed files with 13 additions and 4 deletions

View File

@ -1762,6 +1762,7 @@ int inv_check_chip_type(struct inv_mpu_iio_s *st, const char *name)
struct inv_reg_map_s *reg;
int result;
int t_ind;
int timeout = 10;
if (!strcmp(name, "itg3500"))
st->chip_type = INV_ITG3500;
@ -1787,9 +1788,14 @@ int inv_check_chip_type(struct inv_mpu_iio_s *st, const char *name)
reg = &st->reg;
st->setup_reg(reg);
/* reset to make sure previous state are not there */
result = inv_plat_single_write(st, reg->pwr_mgmt_1, BIT_H_RESET);
if (result)
return result;
while (timeout) {
result = inv_plat_single_write(st, reg->pwr_mgmt_1, BIT_H_RESET);
if (!result)
break;
pr_err("inv_mpu: reset chip failed, err = %d\n", result);
timeout--;
msleep(POWER_UP_TIME);
}
msleep(POWER_UP_TIME);
/* toggle power state */
result = st->set_power_state(st, false);

View File

@ -647,6 +647,9 @@ struct inv_mpu_slave {
/*---- MPU9250 ----*/
#define MPU9250_ID 0x71 /* unique WHOAMI */
/*---- MPU6880 ----*/
#define MPU6880_ID 0x78 /* unique WHOAMI */
#define THREE_AXIS 3
#define GYRO_CONFIG_FSR_SHIFT 3
#define ACCL_CONFIG_FSR_SHIFT 3

View File

@ -345,7 +345,7 @@ int inv_get_silicon_rev_mpu6500(struct inv_mpu_iio_s *st)
if (result)
return result;
if (whoami != MPU6500_ID && whoami != MPU9250_ID &&
whoami != MPU6515_ID)
whoami != MPU6515_ID && whoami != MPU6880_ID)
return -EINVAL;
/*memory read need more time after power up */