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

From: Matti Vaittinen
Date: Wed Apr 12 2023 - 08:30:01 EST


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@xxxxxxxxx>
---
drivers/iio/light/rohm-bu27034.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

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;
--
2.39.2


--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]

Attachment: signature.asc
Description: PGP signature