This series follows a similar approach as recently used for the veml3235
by using iio-gts to manage the scale as stated in the ABI. In its
current form, the driver exposes the hardware gain instead of the
multiplier for the raw value to obtain a value in lux.
Although this driver and the veml3235 have many similarities, there are
two main differences in this series compared to the one used to fix the
other driver:
- The veml6030 has fractional gains, which are not supported by the
iio-gts helpers. My first attempt was adding support for them, but
that made the whole iio-gts implementation more complex, cumbersome,
and the risk of affecting existing clients was not negligible.
Instead, a x8 factor has been used for the hardware gain to present
the minimum value (x0.125) as x1, keeping linearity. The scales
iio-gts generates are therefore right without any extra conversion,
and they match the values provided in the different datasheets.
- This driver included a processed value for the ambient light, maybe
because the scale did not follow the ABI and the conversion was not
direct. To avoid breaking userspace, the functionality has been kept,
but of course using the fixed scales. That requires using intermediate
u64 values u64 divisions via div_u64() and do_div() to avoid overflows.
To ease the usage of the iio-gts selectors, a previous patch to support
regfields and caching has been included.