mbox series

[v6,0/9] iio: adc: dfsdm: add scaling support

Message ID 20240730084640.1307938-1-olivier.moysan@foss.st.com (mailing list archive)
Headers show
Series iio: adc: dfsdm: add scaling support | expand

Message

Olivier Moysan July 30, 2024, 8:46 a.m. UTC
The aim of this serie is to add scaling support to STM32 DFSDM
peripheral in the analog context.

The DFSDM currently operates as a consumer of IIO channels
provided by a generic SD modulator. As previously discussed in RFC [1],
this topology is not suitable for implementing scaling.

This series brings the integration of the DFSDM driver with the new 
IIO backend framework [2], enabling the DFSDM IIO device to offer 
scaling feature based on reference voltage data obtained from the
IIO SD modulator backend. This generic SD modulator backend takes the
place of the former SD modulator, used with legacy implementation.

The DFSDM driver has been updated to adopt the generic ADC channel
binding [3]. The reasons for this include:
- Reducing the use of proprietary properties
- Simplifying the coexistence of legacy and new backend bindings
- Prepare the support of the MDF peripheral on STM32MP25 SoC

Backward compatibility is maintained through legacy support.

This series extends the backend framework with the following APIs:
- iio_backend_read_raw:
	This API is intented to retrieve channel attributes from the
	backend. It is based on IIO framework read_raw API.
- iio_backend_read_scale / iio_backend_read_offset
	Dedicated APIs to read scale and offset channel values.
- iio_backend_disable / iio_backend_enable:
	backend enable/disable to be used for PM management
- devm_iio_backend_fwnode_get
	Intended for parsing DT subnodes to allow generic channel binding
	support, as generic channel DT nodes are not populated as devices.

[1]: https://lore.kernel.org/lkml/20200204101008.11411-1-olivier.moysan@st.com/
[2]: https://lore.kernel.org/all/20240206-iio-backend-v9-0-df66d159c000@analog.com/
[3]: devicetree/bindings/iio/adc/adc.yaml

Changes in v2:
- Update enable/disable backend API
- Rename devm_iio_backend_subnode_get(), as devm_iio_backend_fwnode_get()
- Update iio_backend_read_raw() prototype to fully match IIO framework
  read_raw callback prototype.
- Change st,adc-channel-type property name and type in DFSDM binding
- Remove sd-backend and rename ads1201 compatibles in SD binding

Changes in v3:
- Add iio_backend_read_scale and iio_backend_read_offset
- Remove sd-backend compatible. Adapt existing sd modulator driver and
  binding to support backend topology.
- Misc corrections in DFSDM binding & minor changes in DFSDM driver

Changes in v4:
- Remove allOf and rework examples in SD modulator binding
- Wrap lines to 80 characters in IIO code

Changes in v5:
- Move iio_backend_read_scale and iio_backend_read_offset to inline
  and update prototype
- Fix channel number & remove legacy binding example in DFSDM binding
- Rearrange DFSDM patches to fix build issue in serie
- Split SD modulator binding patch.
  Move reference voltage change in a separate patch

Changes in v6:
- Minor cleanup in DFSDM binding
- Fix vref-supply dependency condition in SD modulator binding

Olivier Moysan (9):
  iio: add read scale and offset services to iio backend framework
  iio: add enable and disable services to iio backend framework
  iio: add child nodes support in iio backend framework
  dt-bindings: iio: dfsdm: move to backend framework
  dt-bindings: iio: add backend support to sd modulator
  dt-bindings: iio: add vref support to sd modulator
  iio: adc: stm32-dfsdm: adopt generic channels bindings
  iio: add iio backend support to sd modulator
  iio: adc: stm32-dfsdm: add scaling support to dfsdm

 .../iio/adc/sigma-delta-modulator.yaml        |  25 +-
 .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml  | 122 +++++++-
 drivers/iio/adc/Kconfig                       |   2 +
 drivers/iio/adc/sd_adc_modulator.c            |  92 +++++-
 drivers/iio/adc/stm32-dfsdm-adc.c             | 293 +++++++++++++++---
 drivers/iio/industrialio-backend.c            | 101 +++++-
 include/linux/iio/backend.h                   |  29 +-
 7 files changed, 592 insertions(+), 72 deletions(-)


base-commit: bf829a98bc4bb9076a2fd70f4a69ea7e281863fa

Comments

Jonathan Cameron Aug. 3, 2024, 3:13 p.m. UTC | #1
On Tue, 30 Jul 2024 10:46:30 +0200
Olivier Moysan <olivier.moysan@foss.st.com> wrote:

> The aim of this serie is to add scaling support to STM32 DFSDM
> peripheral in the analog context.
> 
All looks good to me.  I'll leave it a little longer though as
some of the dt-bindings patches don't have tags from the maintainers yet.

Jonathan
Jonathan Cameron Aug. 6, 2024, 4:39 p.m. UTC | #2
On Sat, 3 Aug 2024 16:13:34 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 30 Jul 2024 10:46:30 +0200
> Olivier Moysan <olivier.moysan@foss.st.com> wrote:
> 
> > The aim of this serie is to add scaling support to STM32 DFSDM
> > peripheral in the analog context.
> >   
> All looks good to me.  I'll leave it a little longer though as
> some of the dt-bindings patches don't have tags from the maintainers yet.
> 
> Jonathan
> 

Applied to the togreg branch of iio.git and pushed out as testing for 0-day
to poke at it etc.

Thanks,

Jonathan