提交 b7b04f39 编写于 作者: M Matti Vaittinen 提交者: Jonathan Cameron

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: e52afbd6 ("iio: light: ROHM BU27034 Ambient Light Sensor")
Signed-off-by: NMatti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/a05647669af22ba919c7c87dccb43975e3235a87.1681722914.git.mazziesaccount@gmail.comSigned-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 672cde9e
...@@ -1167,11 +1167,12 @@ static int bu27034_read_raw(struct iio_dev *idev, ...@@ -1167,11 +1167,12 @@ static int bu27034_read_raw(struct iio_dev *idev,
switch (mask) { switch (mask) {
case IIO_CHAN_INFO_INT_TIME: case IIO_CHAN_INFO_INT_TIME:
*val = bu27034_get_int_time(data); *val = 0;
if (*val < 0) *val2 = bu27034_get_int_time(data);
return *val; if (*val2 < 0)
return *val2;
return IIO_VAL_INT; return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
return bu27034_get_scale(data, chan->channel, val, val2); return bu27034_get_scale(data, chan->channel, val, val2);
...@@ -1229,7 +1230,10 @@ static int bu27034_write_raw(struct iio_dev *idev, ...@@ -1229,7 +1230,10 @@ static int bu27034_write_raw(struct iio_dev *idev,
ret = bu27034_set_scale(data, chan->channel, val, val2); ret = bu27034_set_scale(data, chan->channel, val, val2);
break; break;
case IIO_CHAN_INFO_INT_TIME: 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; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册