iio: light: veml6030: fix scale to conform to ABI
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 27 Jan 2025 19:30:23 +0000 (20:30 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 8 Feb 2025 15:16:29 +0000 (15:16 +0000)
commit22eaca4283b216f5e1f7721e4ad0ecb3d23c6774
tree474e6e083ccdc6d7cd332ddb45ed559c3ed528be
parentdbd2e08ff09fd6bd51215b44474899cc1b7b7a16
iio: light: veml6030: fix scale to conform to ABI

The current scale is not ABI-compliant as it is just the sensor gain
instead of the value that acts as a multiplier to be applied to the raw
value (there is no offset).

Use the iio-gts helpers to obtain the proper scale values according to
the gain and integration time to match the resolution tables from the
datasheet and drop dedicated variables to store the current values of
the integration time, gain and resolution. When at it, use 'scale'
instead of 'gain' consistently for the get/set functions to avoid
misunderstandings.

Fixes: 7b779f573c48 ("iio: light: add driver for veml6030 ambient light sensor")
Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20250127-veml6030-scale-v3-2-4f32ba03df94@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/Kconfig
drivers/iio/light/veml6030.c