iio: si1133: read 24-bit signed integer for measurement
authorMaxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
Wed, 19 Feb 2020 17:40:08 +0000 (12:40 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:30:23 +0000 (10:30 +0200)
commit84f77a944839c88b39633b7edf68ee873e839add
treece88cd2a0ed73a2c09401247fa205c7c0682b2e5
parent7b24ff9e0082e1d115c85573f140759368bea248
iio: si1133: read 24-bit signed integer for measurement

commit 328b50e9a0ad1fe8accdf8c19923deebab5e0c01 upstream.

The chip is configured in 24 bit mode. The values read from
it must always be treated as is. This fixes the issue by
replacing the previous 16 bits value by a 24 bits buffer.

This changes affects the value output by previous version of
the driver, since the least significant byte was missing.
The upper half of 16 bit values previously output are now
the upper half of a 24 bit value.

Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
Reported-by: Simon Goyette <simon.goyette@gmail.com>
Co-authored-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/light/si1133.c