]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: humidity: hdc100x: fix sensor data reads of temp and humidity
authorAlison Schofield <amsfield22@gmail.com>
Mon, 8 Aug 2016 18:14:36 +0000 (11:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2016 08:09:30 +0000 (10:09 +0200)
commitcf6ffb120f37977c4d3efa1a90c50f8e8195ed8d
treeb9b0566b3e871cfa9905c29c3c315d85ed4cf623
parente6b1db623a4d4e8043e4d0c9d60b786fa236c18b
iio: humidity: hdc100x: fix sensor data reads of temp and humidity

commit 0d9dcf852334b796bacc7020364afba3122db81e upstream.

Replace the i2c_smbus_read_byte commmands used to retrieve the sensor
data with an i2c_master_recv command.

The smbus read byte method fails because the device does not expect a
stop condition after sending the first byte. When we issue the second
read, we are getting the first byte again. Net effect is that of the 14
bits used for the measurement, the 8 most significant bits are correct,
the lower 6 are not.

None of the smbus read protocols follow the pattern this device requires
(S Addr Rd [A] Data [A] Data NA P), hence the switch to an i2c receive
transaction.

Applicable from original introduction of this driver, but will require
backporting due to churn in the code.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/humidity/hdc100x.c