This series addresses an issue in the veml3235 that was inherited from an older driver (veml6030, not covered here but probably addressed after discussing this series), where the scale is does not follow ABI. To simplify the gain/integration time handling, the iio-gts helpers have been used. And to further simplify the process, two new helpers have been proposed to address repetitive patterns that are found in all users of iio-gts. The additions to iio-gts are wrappers around existing helpers, and I have tried to keep their names short, as adding more prefixes to the existing functions looked too cumbersome and inconvenient to follow the 80-char/line recommendation. I have not added any test for the new helpers because I would prefer to discuss them first. This series has been tested with a veml3235sl under all supported gains and integration times as well as with a few unsupported values to make sure the operations fail in those cases. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx> --- Changes in v2: - industrialio-gts-helper.c: explicitly return -EINVAL if iio_gts_find_new_gain_vy_gain_time_min() fails for the minimum gain fallback. - industrialio-gts-helper.c: check the non-zero value of ret to continue to the next iteration in iio_gts_find_gan_sel_in_times(). - veml3235.c: drop code style fixes and move them to a separate patch. - veml3235.c: add patch to support regmap cache to simplify value updates. - veml3235.c: put 'val' back in the arguments of set_it() to drop the diff, and check it internally as before. - veml3235.c: fix typo in comment. - Link to v1: https://lore.kernel.org/r/20241220-veml3235_scale-v1-0-b43b190bbb6a@xxxxxxxxx --- Javier Carrasco (4): iio: gts-helper: add helpers to ease searches of gain_sel and new_gain iio: light: veml3235: fix code style iio: light: veml3235: extend regmap to add cache iio: veml3235: fix scale to conform to ABI drivers/iio/industrialio-gts-helper.c | 76 ++++++++++ drivers/iio/light/Kconfig | 1 + drivers/iio/light/veml3235.c | 274 ++++++++++++++++++++-------------- include/linux/iio/iio-gts-helper.h | 5 + 4 files changed, 245 insertions(+), 111 deletions(-) --- base-commit: e25c8d66f6786300b680866c0e0139981273feba change-id: 20241215-veml3235_scale-62de98c7b5fa Best regards, -- Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>