[PATCH v4 0/5] Migrate STX104 to the regmap API

From: William Breathitt Gray
Date: Tue Apr 04 2023 - 10:12:15 EST


Changes in v4:
- Fix race conditions in stx104_read_raw() and stx104_write_raw() by
utilizing a mutex
- Improve indentation in stx104_write_raw() by bailing out early if
chan->output is false in for the IIO_CHAN_INFO_RAW case
- Remove regmap_config max_register lines as superfluous
- Utilize BIT() for gain calculation in stx104_read_raw()
Changes in v3:
- Add STX104_ prefixes to defines to avoid potential name classes
- Rename SAME_CHANNEL() to STX104_SINGLE_CHANNEL() to convey intention
better
- Utilize u8_encode_bits() to define STX104_SOFTWARE_TRIGGER
- Adjust to utilize reg_base members in regmap_config structures
- Fix off-by-one errors in aio_data_wr_ranges[], aio_data_rd_ranges[],
and aio_data_regmap_config max_register
- Inline gpio_config initialization to avoid zeroing it at declaration
- Add blank lines between register map init blocks for clarity
- Utilize regmap_read_poll_timeout() for ADC conversion status poll
Changes in v2:
- Relocate struct stx104_iio for the sake of a clearer patch diff
- Replace FIELD_PREP() and FIELD_GET() with u8_encode_bits() and
u8_get_bits()

The regmap API supports IO port accessors so we can take advantage of
regmap abstractions rather than handling access to the device registers
directly in the driver.

To make the git history cleaner, a precursor patch to improve
indentation in stx104_write_raw() and a follow-up patch to utilize
regmap_read_poll_timeout() for polling the ADC conversion status are
included.

William Breathitt Gray (5):
iio: addac: stx104: Fix race condition for stx104_write_raw()
iio: addac: stx104: Fix race condition when converting
analog-to-digital
iio: addac: stx104: Improve indentation in stx104_write_raw()
iio: addac: stx104: Migrate to the regmap API
iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll

drivers/iio/addac/Kconfig | 2 +
drivers/iio/addac/stx104.c | 455 +++++++++++++++++++++----------------
2 files changed, 261 insertions(+), 196 deletions(-)


base-commit: f73df43e957a6fc705a9bd6d143585bdf1b13365
--
2.39.2