Hi,

On Thu, Jun 20, 2019 at 07:25:25PM +0000, Boyang Yu wrote:
> max6658 may report unrealistically high temperature during
> the driver initialization, for which, its overtemp alarm pin
> also gets asserted. For certain devices implementing overtemp
> protection based on that pin, it may further trigger a reset to
> the device. By reproducing the problem, the wrong reading is
> found to be coincident with changing the conversion rate.
> 
> To mitigate this issue, set the stop bit before changing the
> conversion rate and unset it thereafter. After such change, the
> wrong reading is not reproduced. As the issue is only found on
> max6658, apply this change only to the max6657 kind.
> 
> Signed-off-by: Boyang Yu <b...@arista.com>
> ---
>  drivers/hwmon/lm90.c | 54 ++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 50 insertions(+), 4 deletions(-)
[ ... ]
> 
>  /*
>   * Set conversion rate.
>   * client->update_lock must be held when calling this function (unless we are
> @@ -587,7 +616,11 @@ static int lm90_set_convrate(struct i2c_client *client, 
> struct lm90_data *data,
>               if (interval >= update_interval * 3 / 4)
>                       break;
>  
> -     err = i2c_smbus_write_byte_data(client, LM90_REG_W_CONVRATE, i);
> +     if (data->kind == max6657)
> +             err = max6657_write_convrate(client, i);
> +     else
> +             err = i2c_smbus_write_byte_data(client, LM90_REG_W_CONVRATE, i);
> +
Please name the new function lm90_write_convrate, call it unconditionally,
and check if the chip is affected in the function. Also, please implement
the check with a feature flag - it is quite unlikely that only max6658
is affected, and we'll want an easy method to add support for other chips.

Thanks,
Guenter

Reply via email to