Skip to content

Commit a00d471

Browse files
Al2Klimovgregkh
authored andcommitted
iio: light: al3010: read both ALS ADC registers again
commit ee78fae upstream. al3010_read_raw() used to read two adjacent registers until the driver was modernized using the regmap framework. That cleanup accidentally replaced the 16-bit word read with a single byte read. I'm reverting latter. Fixes: 0e5e21e ("iio: light: al3010: Implement regmap support") Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cd27856 commit a00d471

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/iio/light/al3010.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static int al3010_read_raw(struct iio_dev *indio_dev,
111111
int *val2, long mask)
112112
{
113113
struct al3010_data *data = iio_priv(indio_dev);
114-
int ret, gain, raw;
114+
int ret, gain;
115+
__le16 raw;
115116

116117
switch (mask) {
117118
case IIO_CHAN_INFO_RAW:
@@ -120,11 +121,12 @@ static int al3010_read_raw(struct iio_dev *indio_dev,
120121
* - low byte of output is stored at AL3010_REG_DATA_LOW
121122
* - high byte of output is stored at AL3010_REG_DATA_LOW + 1
122123
*/
123-
ret = regmap_read(data->regmap, AL3010_REG_DATA_LOW, &raw);
124+
ret = regmap_bulk_read(data->regmap, AL3010_REG_DATA_LOW,
125+
&raw, sizeof(raw));
124126
if (ret)
125127
return ret;
126128

127-
*val = raw;
129+
*val = le16_to_cpu(raw);
128130

129131
return IIO_VAL_INT;
130132
case IIO_CHAN_INFO_SCALE:

0 commit comments

Comments
 (0)