Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: e52afbd61039 ("iio: light: ROHM BU27034 Ambient Light Sensor")
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/a05647669af22ba919c7c87dccb43975e3235a87.1681722914.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Matti Vaittinen and committed by
Jonathan Cameron
b7b04f39 672cde9e

+9 -5
+9 -5
drivers/iio/light/rohm-bu27034.c
··· 1167 1167 1168 1168 switch (mask) { 1169 1169 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; 1173 1174 1174 - return IIO_VAL_INT; 1175 + return IIO_VAL_INT_PLUS_MICRO; 1175 1176 1176 1177 case IIO_CHAN_INFO_SCALE: 1177 1178 return bu27034_get_scale(data, chan->channel, val, val2); ··· 1230 1229 ret = bu27034_set_scale(data, chan->channel, val, val2); 1231 1230 break; 1232 1231 case IIO_CHAN_INFO_INT_TIME: 1233 - ret = bu27034_try_set_int_time(data, val); 1232 + if (!val) 1233 + ret = bu27034_try_set_int_time(data, val2); 1234 + else 1235 + ret = -EINVAL; 1234 1236 break; 1235 1237 default: 1236 1238 ret = -EINVAL;