All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
@ 2020-12-11 11:12 Slaveyko Slaveykov
  2020-12-12 12:29 ` Crt Mori
  2020-12-12 18:44 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Slaveyko Slaveykov @ 2020-12-11 11:12 UTC (permalink / raw)
  To: Jonathan.Cameron, cmo; +Cc: linux-iio, Slaveyko Slaveykov

After an I2C reset command, the mlx90632 needs some time before
responding to other I2C commands. Without that delay, there is a chance
that the I2C command(s) after the reset will not be accepted

Signed-off-by: Slaveyko Slaveykov <sis@melexis.com>
---
 drivers/iio/temperature/mlx90632.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index 503fe54a0bb9..ee50f61e496a 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -247,6 +247,7 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
 	ret = regmap_write(regmap, MLX90632_REG_I2C_CMD, MLX90632_RESET_CMD);
 	if (ret < 0)
 		return ret;
+	usleep(150, 200);
 
 	ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
 				 (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
  2020-12-11 11:12 [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
@ 2020-12-12 12:29 ` Crt Mori
  2020-12-12 18:44 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Crt Mori @ 2020-12-12 12:29 UTC (permalink / raw)
  To: Slaveyko Slaveykov; +Cc: Jonathan Cameron, Linux Iio

Reviewed-by: Crt Mori <cmo@melexis.com>

We did not detect this issue on Linux chips, but there is a slight
possibility that it might occur nevertheless.  So I am proposing this
to add to_fixes as well (maybe even for the upcoming 5.10?)

Best regards,
Crt

On Fri, 11 Dec 2020 at 12:14, Slaveyko Slaveykov <sis@melexis.com> wrote:
>
> After an I2C reset command, the mlx90632 needs some time before
> responding to other I2C commands. Without that delay, there is a chance
> that the I2C command(s) after the reset will not be accepted
>
> Signed-off-by: Slaveyko Slaveykov <sis@melexis.com>
> ---
>  drivers/iio/temperature/mlx90632.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
> index 503fe54a0bb9..ee50f61e496a 100644
> --- a/drivers/iio/temperature/mlx90632.c
> +++ b/drivers/iio/temperature/mlx90632.c
> @@ -247,6 +247,7 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
>         ret = regmap_write(regmap, MLX90632_REG_I2C_CMD, MLX90632_RESET_CMD);
>         if (ret < 0)
>                 return ret;
> +       usleep(150, 200);
>
>         ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
>                                  (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
> --
> 2.16.2.windows.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
  2020-12-11 11:12 [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
  2020-12-12 12:29 ` Crt Mori
@ 2020-12-12 18:44 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-12-12 18:44 UTC (permalink / raw)
  To: Slaveyko Slaveykov; +Cc: Jonathan Cameron, Crt Mori, linux-iio

On Fri, Dec 11, 2020 at 3:46 PM Slaveyko Slaveykov <sis@melexis.com> wrote:
>
> After an I2C reset command, the mlx90632 needs some time before
> responding to other I2C commands. Without that delay, there is a chance
> that the I2C command(s) after the reset will not be accepted

...

It's good to put some comments here in the code.

> +       usleep(150, 200);


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-12 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 11:12 [PATCH] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
2020-12-12 12:29 ` Crt Mori
2020-12-12 18:44 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.