lkml.org 
[lkml]   [2021]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 2/2] iio: temperature: add driver support for ti tmp117
From
Date
On 4/6/21 8:28 PM, Puranjay Mohan wrote:
> +
> +static int tmp117_write_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *channel, int val,
> + int val2, long mask)
> +{
> + struct tmp117_data *data = iio_priv(indio_dev);
> + s16 off;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_CALIBBIAS:
> + off = clamp(val, -32768, 32767);
> + if (off == data->calibbias)

data->calibbias is only set in probe() and always 0. I'm not sure we
need to cache the value. Reading it back from the device seems fine.

> + return 0;
> + return i2c_smbus_write_word_swapped(data->client,
> + TMP117_REG_TEMP_OFFSET, off);
> +
> + default:
> + return -EINVAL;
> + }
> +}
> +

\
 
 \ /
  Last update: 2021-04-07 06:57    [W:0.070 / U:1.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site