Commit cf5b1385 authored by Slaveyko Slaveykov's avatar Slaveyko Slaveykov Committed by Jonathan Cameron

drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c

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: default avatarSlaveyko Slaveykov <sis@melexis.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: default avatarCrt Mori <cmo@melexis.com>
Fixes: e02472f7 ("iio:temperature:mlx90632: Adding extended calibration option")
Link: https://lore.kernel.org/r/20201216115720.12404-2-sis@melexis.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 7e6d9788
...@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type) ...@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
if (ret < 0) if (ret < 0)
return ret; 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, ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
(MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK), (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
(MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT)); (MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment