OSDN Git Service

iio: light: vcnl4000 use word writes instead of byte writes
authorAngus Ainslie (Purism) <angus@akkea.ca>
Thu, 21 Mar 2019 15:40:43 +0000 (08:40 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 4 Apr 2019 19:20:42 +0000 (20:20 +0100)
The VCNL4200 datasheet says that word read and writes should be used
to access the registers.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Tested-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/vcnl4000.c

index 04fd0d4..5e0a8eb 100644 (file)
@@ -140,10 +140,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
        data->rev = (ret >> 8) & 0xf;
 
        /* Set defaults and enable both channels */
-       ret = i2c_smbus_write_byte_data(data->client, VCNL4200_AL_CONF, 0x00);
+       ret = i2c_smbus_write_word_data(data->client, VCNL4200_AL_CONF, 0);
        if (ret < 0)
                return ret;
-       ret = i2c_smbus_write_byte_data(data->client, VCNL4200_PS_CONF1, 0x00);
+       ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, 0);
        if (ret < 0)
                return ret;