public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] iio: light: fix scale in veml3235 and add helpers to iio-gts
@ 2024-12-30 15:13 Javier Carrasco
  2024-12-30 15:13 ` [PATCH v3 1/2] iio: gts-helper: add helpers to ease searches of gain_sel and new_gain Javier Carrasco
  2024-12-30 15:13 ` [PATCH v3 2/2] iio: veml3235: fix scale to conform to ABI Javier Carrasco
  0 siblings, 2 replies; 5+ messages in thread
From: Javier Carrasco @ 2024-12-30 15:13 UTC (permalink / raw)
  To: Matti Vaittinen, Jonathan Cameron, Lars-Peter Clausen
  Cc: linux-iio, linux-kernel, Jonathan Cameron, Javier Carrasco

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@gmail.com>
---
Changes in v3:
- Rename iio_gts_find_gain_sel_in_times() to
  iio_gts_find_gain_time_sel_for_scale() and update its documentation.
- Rebase onto iio/testing, apply tags and drop applied patches.
- Link to v2: https://lore.kernel.org/r/20241224-veml3235_scale-v2-0-2e1286846c77@gmail.com

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@gmail.com

---
Javier Carrasco (2):
      iio: gts-helper: add helpers to ease searches of gain_sel and new_gain
      iio: veml3235: fix scale to conform to ABI

 drivers/iio/industrialio-gts-helper.c |  77 +++++++++++
 drivers/iio/light/Kconfig             |   1 +
 drivers/iio/light/veml3235.c          | 237 ++++++++++++++++++----------------
 include/linux/iio/iio-gts-helper.h    |   6 +
 4 files changed, 213 insertions(+), 108 deletions(-)
---
base-commit: 627f3c41ca005398cf1e86a312c5043147ec7ea6
change-id: 20241215-veml3235_scale-62de98c7b5fa

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-04 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 15:13 [PATCH v3 0/2] iio: light: fix scale in veml3235 and add helpers to iio-gts Javier Carrasco
2024-12-30 15:13 ` [PATCH v3 1/2] iio: gts-helper: add helpers to ease searches of gain_sel and new_gain Javier Carrasco
2024-12-30 15:13 ` [PATCH v3 2/2] iio: veml3235: fix scale to conform to ABI Javier Carrasco
2024-12-31  8:39   ` Javier Carrasco
2025-01-04 12:39     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox