Skip to content

Commit

Permalink
iio: bu27034: Fix integration time
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
M-Vaittinen authored and jic23 committed May 13, 2023
1 parent 672cde9 commit b7b04f3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/iio/light/rohm-bu27034.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,11 +1167,12 @@ static int bu27034_read_raw(struct iio_dev *idev,

switch (mask) {
case IIO_CHAN_INFO_INT_TIME:
*val = bu27034_get_int_time(data);
if (*val < 0)
return *val;
*val = 0;
*val2 = bu27034_get_int_time(data);
if (*val2 < 0)
return *val2;

return IIO_VAL_INT;
return IIO_VAL_INT_PLUS_MICRO;

case IIO_CHAN_INFO_SCALE:
return bu27034_get_scale(data, chan->channel, val, val2);
Expand Down Expand Up @@ -1229,7 +1230,10 @@ static int bu27034_write_raw(struct iio_dev *idev,
ret = bu27034_set_scale(data, chan->channel, val, val2);
break;
case IIO_CHAN_INFO_INT_TIME:
ret = bu27034_try_set_int_time(data, val);
if (!val)
ret = bu27034_try_set_int_time(data, val2);
else
ret = -EINVAL;
break;
default:
ret = -EINVAL;
Expand Down

0 comments on commit b7b04f3

Please sign in to comment.