Commit 9e444dbf authored by Jeff LaBundy's avatar Jeff LaBundy Committed by Lee Jones
Browse files

iio: temperature: iqs620at-temp: Add support for V3 silicon



The vendor introduced an updated revision of IQS620A(T) silicon
which is backwards-compatible with previous revisions, the only
exception being the offset used to derive temperature.

Enable this new revision by returning the appropriate offset as
a function of the hardware number provided by the parent MFD.

Signed-off-by: default avatarJeff LaBundy <jeff@labundy.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 1de785a5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#define IQS620_TEMP_SCALE			1000
#define IQS620_TEMP_OFFSET			(-100)
#define IQS620_TEMP_OFFSET_V3			(-40)

static int iqs620_temp_read_raw(struct iio_dev *indio_dev,
				struct iio_chan_spec const *chan,
@@ -41,7 +42,8 @@ static int iqs620_temp_read_raw(struct iio_dev *indio_dev,
		return IIO_VAL_INT;

	case IIO_CHAN_INFO_OFFSET:
		*val = IQS620_TEMP_OFFSET;
		*val = iqs62x->hw_num < IQS620_HW_NUM_V3 ? IQS620_TEMP_OFFSET
							 : IQS620_TEMP_OFFSET_V3;
		return IIO_VAL_INT;

	default: