linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <matt.ranostay@intel.com>
Cc: linux-iio@vger.kernel.org, daniel.baluta@intel.com,
	adriana.reus@intel.com
Subject: Re: [PATCH 2/5] iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delay
Date: Thu, 25 Feb 2016 19:54:56 +0000	[thread overview]
Message-ID: <56CF5C10.30507@kernel.org> (raw)
In-Reply-To: <1456177151-15881-3-git-send-email-matt.ranostay@intel.com>

On 22/02/16 21:39, Matt Ranostay wrote:
> 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>
Applied.
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 ++-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  | 3 ++-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  | 7 ++++++-
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 4324328fd304..6d4b19dd16f8 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -148,7 +148,8 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on)
>  		return result;
>  
>  	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;
>  }
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> index af400dd892a9..37cc16d3fca3 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> @@ -68,7 +68,8 @@ static int inv_mpu6050_select_bypass(struct i2c_adapter *adap, void *mux_priv,
>  		if (ret)
>  			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) {
>  		st->powerup_count++;
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> index fcc2f3dfdfa8..243324dd78de 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> @@ -172,10 +172,15 @@ struct inv_mpu6050_state {
>  #define INV_MPU6050_BYTES_PER_3AXIS_SENSOR   6
>  #define INV_MPU6050_FIFO_COUNT_BYTE          2
>  #define INV_MPU6050_FIFO_THRESHOLD           500
> +
> +/* delay time in milliseconds */
>  #define INV_MPU6050_POWER_UP_TIME            100
>  #define INV_MPU6050_TEMP_UP_TIME             100
>  #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_SCALE               2941
> 


  reply	other threads:[~2016-02-25 19:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 21:39 [PATCH 0/5] mpu6050: code clean and calibration support Matt Ranostay
2016-02-22 21:39 ` [PATCH 1/5] iio: imu: mpu6050: use inv_mpu6050_sensor_show return code Matt Ranostay
2016-02-22 21:49   ` Daniel Baluta
2016-02-22 21:50     ` Daniel Baluta
2016-02-25 19:50   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 2/5] iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delay Matt Ranostay
2016-02-25 19:54   ` Jonathan Cameron [this message]
2016-02-22 21:39 ` [PATCH 3/5] iio: imu: mpu6050: add missing docstring for int_pin_cfg Matt Ranostay
2016-02-25 19:55   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 4/5] iio: imu: mpu6050: add calibration offset support Matt Ranostay
2016-02-25 19:55   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 5/5] iio: imu: mpu6050: add mpu6500 register settings Matt Ranostay
2016-02-25 19:56   ` Jonathan Cameron
2016-02-24 21:08 ` [PATCH 0/5] mpu6050: code clean and calibration support Jonathan Cameron
     [not found]   ` <DM3PR1201MB1072776083BB71F4F618555CAFA50@DM3PR1201MB1072.namprd12.prod.outlook.com>
2016-02-25  8:45     ` Daniel Baluta
2016-02-25 15:36       ` Ge Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CF5C10.30507@kernel.org \
    --to=jic23@kernel.org \
    --cc=adriana.reus@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=matt.ranostay@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).