iio: light: Simplify the current to lux LUT
authorGregor Riepl <onitake@gmail.com>
Thu, 20 Feb 2020 21:20:53 +0000 (22:20 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 8 Mar 2020 17:28:41 +0000 (17:28 +0000)
commit070bd30a518a106c8bb3c8a71de1db7f714bed02
tree6dc51c964eca8d13186a54bc4aa286268e5da603
parent317d4bcca76956d177ae584d95482a329225ff03
iio: light: Simplify the current to lux LUT

The look-up-table for currens to lux is simply specifying
all currents from 5..47 mA, if we add some values for 0..5
we can just select the index for the lux value in an array
from the mA value. Use clamp() to get the value in the
range of values in the array.

Cc: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Gregor Riepl <onitake@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/gp2ap002.c