All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Add delay after the addressed reset command in mlx90632.c
@ 2020-12-14 19:37 Slaveyko Slaveykov
  2020-12-14 19:37 ` [PATCH v2 1/1] drivers: iio: temperature: " Slaveyko Slaveykov
  0 siblings, 1 reply; 3+ messages in thread
From: Slaveyko Slaveykov @ 2020-12-14 19:37 UTC (permalink / raw)
  To: Jonathan.Cameron, cmo; +Cc: linux-iio, andy.shevchenko, Slaveyko Slaveykov

The only change in version 2 of the patch is adding a comment
in the code to explain why the delay is needed as advised 
by Andy Shevchenko <andy.shevchenko@gmail.com>.

Slaveyko Slaveykov (1):
  drivers: iio: temperature: Add delay after the addressed reset command
    in mlx90632.c

 drivers/iio/temperature/mlx90632.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.16.2.windows.1


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

* [PATCH v2 1/1] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
  2020-12-14 19:37 [PATCH v2 0/1] Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
@ 2020-12-14 19:37 ` Slaveyko Slaveykov
  2020-12-14 19:48   ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Slaveyko Slaveykov @ 2020-12-14 19:37 UTC (permalink / raw)
  To: Jonathan.Cameron, cmo; +Cc: linux-iio, andy.shevchenko, 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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index 503fe54a0bb9..f0eaadec11eb 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -247,6 +247,8 @@ 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);	//give the mlx90632 some time to reset properly before sending a new I2C command
+										//if this is not done, the following I2C command(s) will not be accepted
 
 	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 v2 1/1] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
  2020-12-14 19:37 ` [PATCH v2 1/1] drivers: iio: temperature: " Slaveyko Slaveykov
@ 2020-12-14 19:48   ` Lars-Peter Clausen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2020-12-14 19:48 UTC (permalink / raw)
  To: Slaveyko Slaveykov, Jonathan.Cameron, cmo; +Cc: linux-iio, andy.shevchenko

On 12/14/20 8:37 PM, Slaveyko Slaveykov 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 | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
> index 503fe54a0bb9..f0eaadec11eb 100644
> --- a/drivers/iio/temperature/mlx90632.c
> +++ b/drivers/iio/temperature/mlx90632.c
> @@ -247,6 +247,8 @@ 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);	//give the mlx90632 some time to reset properly before sending a new I2C command
> +										//if this is not done, the following I2C command(s) will not be accepted

Did you mean usleep_range()?

Also consider reformatting this by putting the comment before the 
instruction, I think that will make it easier to follow. The way it is 
right now it will not pass scripts/checkpatch.pl.


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

end of thread, other threads:[~2020-12-14 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 19:37 [PATCH v2 0/1] Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
2020-12-14 19:37 ` [PATCH v2 1/1] drivers: iio: temperature: " Slaveyko Slaveykov
2020-12-14 19:48   ` Lars-Peter Clausen

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.