iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delay
replace msleep(INV_MPU6050_REG_UP_TIME) with usleep_range calls due to fact the wait time is under 20 milliseconds. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
115f0341bc
commit
8f356be3fe
|
@ -151,7 +151,8 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (power_on)
|
if (power_on)
|
||||||
msleep(INV_MPU6050_REG_UP_TIME);
|
usleep_range(INV_MPU6050_REG_UP_TIME_MIN,
|
||||||
|
INV_MPU6050_REG_UP_TIME_MAX);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ static int inv_mpu6050_select_bypass(struct i2c_adapter *adap, void *mux_priv,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
msleep(INV_MPU6050_REG_UP_TIME);
|
usleep_range(INV_MPU6050_REG_UP_TIME_MIN,
|
||||||
|
INV_MPU6050_REG_UP_TIME_MAX);
|
||||||
}
|
}
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
st->powerup_count++;
|
st->powerup_count++;
|
||||||
|
|
|
@ -172,10 +172,15 @@ struct inv_mpu6050_state {
|
||||||
#define INV_MPU6050_BYTES_PER_3AXIS_SENSOR 6
|
#define INV_MPU6050_BYTES_PER_3AXIS_SENSOR 6
|
||||||
#define INV_MPU6050_FIFO_COUNT_BYTE 2
|
#define INV_MPU6050_FIFO_COUNT_BYTE 2
|
||||||
#define INV_MPU6050_FIFO_THRESHOLD 500
|
#define INV_MPU6050_FIFO_THRESHOLD 500
|
||||||
|
|
||||||
|
/* delay time in milliseconds */
|
||||||
#define INV_MPU6050_POWER_UP_TIME 100
|
#define INV_MPU6050_POWER_UP_TIME 100
|
||||||
#define INV_MPU6050_TEMP_UP_TIME 100
|
#define INV_MPU6050_TEMP_UP_TIME 100
|
||||||
#define INV_MPU6050_SENSOR_UP_TIME 30
|
#define INV_MPU6050_SENSOR_UP_TIME 30
|
||||||
#define INV_MPU6050_REG_UP_TIME 5
|
|
||||||
|
/* delay time in microseconds */
|
||||||
|
#define INV_MPU6050_REG_UP_TIME_MIN 5000
|
||||||
|
#define INV_MPU6050_REG_UP_TIME_MAX 10000
|
||||||
|
|
||||||
#define INV_MPU6050_TEMP_OFFSET 12421
|
#define INV_MPU6050_TEMP_OFFSET 12421
|
||||||
#define INV_MPU6050_TEMP_SCALE 2941
|
#define INV_MPU6050_TEMP_SCALE 2941
|
||||||
|
|
Loading…
Reference in New Issue