diff mbox series

[v2,07/13] iio: imu: inv_mpu6050: fix sleep time when turning regulators on

Message ID 20200219143958.3548-8-jmaneyrol@invensense.com (mailing list archive)
State New, archived
Headers show
Series Rework sensors engines and power management | expand

Commit Message

Jean-Baptiste Maneyrol Feb. 19, 2020, 2:39 p.m. UTC
Turning vdd regulator on requires a consequent sleep for the
chip to power on correctly.
Turning vddio regulator is much faster.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jonathan Cameron Feb. 21, 2020, 11:29 a.m. UTC | #1
On Wed, 19 Feb 2020 15:39:52 +0100
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote:

> Turning vdd regulator on requires a consequent sleep for the
> chip to power on correctly.
> Turning vddio regulator is much faster.
> 
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>

I'm going to retitle this as reduced sleep time rather than fix. 
The reason is to avoid it getting picked up as something we need
to backport.

Applied this and the ones before it I didn't reply to, to the togreg
branch of iio.git and pushed out as testing.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 3502b996671c..63cdde20df7e 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1201,7 +1201,7 @@ static int inv_mpu_core_enable_regulator_vddio(struct inv_mpu6050_state *st)
>  			"Failed to enable vddio regulator: %d\n", result);
>  	} else {
>  		/* Give the device a little bit of time to start up. */
> -		usleep_range(35000, 70000);
> +		usleep_range(3000, 5000);
>  	}
>  
>  	return result;
> @@ -1321,6 +1321,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
>  		dev_err(dev, "Failed to enable vdd regulator: %d\n", result);
>  		return result;
>  	}
> +	msleep(INV_MPU6050_POWER_UP_TIME);
>  
>  	result = inv_mpu_core_enable_regulator_vddio(st);
>  	if (result) {
diff mbox series

Patch

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 3502b996671c..63cdde20df7e 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1201,7 +1201,7 @@  static int inv_mpu_core_enable_regulator_vddio(struct inv_mpu6050_state *st)
 			"Failed to enable vddio regulator: %d\n", result);
 	} else {
 		/* Give the device a little bit of time to start up. */
-		usleep_range(35000, 70000);
+		usleep_range(3000, 5000);
 	}
 
 	return result;
@@ -1321,6 +1321,7 @@  int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 		dev_err(dev, "Failed to enable vdd regulator: %d\n", result);
 		return result;
 	}
+	msleep(INV_MPU6050_POWER_UP_TIME);
 
 	result = inv_mpu_core_enable_regulator_vddio(st);
 	if (result) {