All of lore.kernel.org
 help / color / mirror / Atom feed
From: Slaveyko Slaveykov <sis@melexis.com>
To: Jonathan.Cameron@huawei.com, cmo@melexis.com
Cc: linux-iio@vger.kernel.org, andy.shevchenko@gmail.com,
	lars@metafoo.de, Slaveyko Slaveykov <sis@melexis.com>
Subject: [PATCH v5 1/1] drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c
Date: Wed, 16 Dec 2020 13:57:20 +0200	[thread overview]
Message-ID: <20201216115720.12404-2-sis@melexis.com> (raw)
In-Reply-To: <20201216115720.12404-1-sis@melexis.com>

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.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Slaveyko Slaveykov <sis@melexis.com>
---
 drivers/iio/temperature/mlx90632.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index 503fe54a0bb9..608ccb1d8bc8 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
 	if (ret < 0)
 		return ret;
 
+	/*
+	 * 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.
+	 */
+	usleep_range(150, 200);
+
 	ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
 				 (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
 				 (MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT));
-- 
2.16.2.windows.1


  reply	other threads:[~2020-12-16 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 11:57 [PATCH v5 0/1] Add delay after the addressed reset command in mlx90632.c Slaveyko Slaveykov
2020-12-16 11:57 ` Slaveyko Slaveykov [this message]
2020-12-29 17:09   ` [PATCH v5 1/1] drivers: iio: temperature: " Jonathan Cameron
2020-12-16 16:16 ` [PATCH v5 0/1] " Andy Shevchenko

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=20201216115720.12404-2-sis@melexis.com \
    --to=sis@melexis.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cmo@melexis.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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 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.