Skip to content

Commit b7b04f3

Browse files
M-Vaittinenjic23
authored andcommitted
iio: bu27034: Fix integration time
The bu27034 uses micro seconds for integration time configuration. This is incorrect as the ABI mandates use of seconds. Change BU27034 driver to use seconds for integration time. Fixes: e52afbd ("iio: light: ROHM BU27034 Ambient Light Sensor") Signed-off-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/a05647669af22ba919c7c87dccb43975e3235a87.1681722914.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 672cde9 commit b7b04f3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/iio/light/rohm-bu27034.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,11 +1167,12 @@ static int bu27034_read_raw(struct iio_dev *idev,
11671167

11681168
switch (mask) {
11691169
case IIO_CHAN_INFO_INT_TIME:
1170-
*val = bu27034_get_int_time(data);
1171-
if (*val < 0)
1172-
return *val;
1170+
*val = 0;
1171+
*val2 = bu27034_get_int_time(data);
1172+
if (*val2 < 0)
1173+
return *val2;
11731174

1174-
return IIO_VAL_INT;
1175+
return IIO_VAL_INT_PLUS_MICRO;
11751176

11761177
case IIO_CHAN_INFO_SCALE:
11771178
return bu27034_get_scale(data, chan->channel, val, val2);
@@ -1229,7 +1230,10 @@ static int bu27034_write_raw(struct iio_dev *idev,
12291230
ret = bu27034_set_scale(data, chan->channel, val, val2);
12301231
break;
12311232
case IIO_CHAN_INFO_INT_TIME:
1232-
ret = bu27034_try_set_int_time(data, val);
1233+
if (!val)
1234+
ret = bu27034_try_set_int_time(data, val2);
1235+
else
1236+
ret = -EINVAL;
12331237
break;
12341238
default:
12351239
ret = -EINVAL;

0 commit comments

Comments
 (0)