iio: light: tcs3472: fix ATIME register write
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 12 Jun 2017 15:05:08 +0000 (00:05 +0900)
committerJonathan Cameron <jic23@kernel.org>
Sat, 1 Jul 2017 09:16:49 +0000 (10:16 +0100)
The integration time is controlled by the ATIME register only.  However,
this register is written by i2c_smbus_write_word_data() in write_raw().

We actually don't need to write a subsequent register.  So just use
i2c_smbus_write_byte_data() instead.

Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/tcs3472.c

index 3aa71e34ae28b39350033616805eb6f2d5480714..a9e153b3e1f96e96ce0b0ba4148d8797a52487dd 100644 (file)
@@ -169,7 +169,7 @@ static int tcs3472_write_raw(struct iio_dev *indio_dev,
                for (i = 0; i < 256; i++) {
                        if (val2 == (256 - i) * 2400) {
                                data->atime = i;
-                               return i2c_smbus_write_word_data(
+                               return i2c_smbus_write_byte_data(
                                        data->client, TCS3472_ATIME,
                                        data->atime);
                        }