diff mbox series

[3/3] iio: bu27034: Fix integration time units

Message ID a3bc95f4a16f876925cfc157aaf5d78f3dbc513d.1681301472.git.mazziesaccount@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series iio: Fix integration time units for iio-gts | expand

Commit Message

Matti Vaittinen April 12, 2023, 12:29 p.m. UTC
The integration time was presented by BU27034 in micro seconds. The ABI
documentation says this should be in seconds.

Fix integration time to be in seconds.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
 drivers/iio/light/rohm-bu27034.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/light/rohm-bu27034.c b/drivers/iio/light/rohm-bu27034.c
index e486dcf35eba..6044db52abfa 100644
--- a/drivers/iio/light/rohm-bu27034.c
+++ b/drivers/iio/light/rohm-bu27034.c
@@ -1171,7 +1171,7 @@  static int bu27034_read_raw(struct iio_dev *idev,
 		if (*val < 0)
 			return *val;
 
-		return IIO_VAL_INT;
+		return IIO_VAL_INT_MICRO;
 
 	case IIO_CHAN_INFO_SCALE:
 		return bu27034_get_scale(data, chan->channel, val, val2);
@@ -1229,7 +1229,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)
+			return -EINVAL;
+
+		ret = bu27034_try_set_int_time(data, val2);
 		break;
 	default:
 		ret = -EINVAL;