[PATCH v3 00/11] Add STM32 DFSDM support

Arnaud Pouliquen arnaud.pouliquen at st.com
Fri Mar 17 07:08:13 PDT 2017


Hello,

I kept it as RFC as i reworked the global design (but also because not full validated...).
Regarding Mark and Jonathan's comments, I decided to  try an implementation 
with DMA support in IIO instead of handling it in ASOC.
Solution seems more straightforward but as DMA cyclic mode and associated buffer
block API is not part of IIO today, I still need some hacks...
To be honest, I tried to integrate DMA cyclic management and associated buffer block 
Consumer API. but no enough expertise on IIO to success... :(

Advantage vs V2:
	- No more data processing need in ASoC , done in IIO
        - ASoC uses IIO consumer interface ( except for buffer callback)
Drawback :
	- Need to create a "SPI bus" trigger to allo to use Buffer consumer API
        	=> Need to find a solution to set this trigger by default in IIO audio driver
        - No standard buffer management
        	- Implement DMA cyclic in DFSDM IIO driver.
                - Define specific API to handle  buffer callback per period instead of 
                  callback per samples generated by iio_push_to_buffers_with_timestamp.
 
V2-V3 delta:
	- New patches to support ASoC DMA codec in DT 
  		- ASoC: Add Bindins for DMIC codec driver.
  		- ASoC: codec: add DT support in dmic codec.
        - New patches to allow in-kernel set of IIO buffer size and watermark   
  		- IIO: consumer: allow to set buffer sizes.
	- IIO DFSDM drivers
        	- Split audio and ADC support in 2 drivers.
                - Implement DMA cyclic mode.
                - Add SPI bus Trigger for buffer management.
                
	- IIO sigma delta adc drivers
        	-  Suppress "simple and rename driver.
         
         - ASoC driver
         	- Suppress DMA engine.
                - Suppress copy ops.
                - Use IIO consmumer interface to enable/Disable DFSDM.        

Regards,

Arnaud

Arnaud Pouliquen (11):
  iio: Add hardware consumer support
  IIO: Add DT bindings for sigma delta adc modulator
  IIO: ADC: add sigma delta modulator support
  IIO: add DT bindings for stm32 DFSDM filter
  IIO: ADC: add stm32 DFSDM support for Sigma delta ADC
  IIO: ADC: add stm32 DFSDM support for PDM microphone
  IIO: consumer: allow to set buffer sizes
  ASoC: Add Bindins for DMIC codec driver
  ASoC: codec: add DT support in dmic codec
  ASoC: add bindings for stm32 DFSDM filter
  ASoC: stm32: add DFSDM DAI support

 .../bindings/iio/adc/sigma-delta-modulator.txt     |  13 +
 .../bindings/iio/adc/st,stm32-dfsdm-adc.txt        | 120 ++++
 Documentation/devicetree/bindings/sound/dmic.txt   |  11 +
 .../devicetree/bindings/sound/st,stm32-adfsdm.txt  |  41 ++
 drivers/iio/Kconfig                                |   6 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/adc/Kconfig                            |  50 ++
 drivers/iio/adc/Makefile                           |   4 +
 drivers/iio/adc/sd_adc_modulator.c                 |  98 +++
 drivers/iio/adc/stm32-dfsdm-adc.c                  | 419 ++++++++++++
 drivers/iio/adc/stm32-dfsdm-audio.c                | 720 +++++++++++++++++++++
 drivers/iio/adc/stm32-dfsdm-core.c                 | 658 +++++++++++++++++++
 drivers/iio/adc/stm32-dfsdm.h                      | 372 +++++++++++
 drivers/iio/buffer/industrialio-buffer-cb.c        |  12 +
 drivers/iio/hw_consumer.c                          | 156 +++++
 include/linux/iio/adc/stm32-dfsdm-audio.h          |  41 ++
 include/linux/iio/consumer.h                       |  13 +
 include/linux/iio/hw_consumer.h                    |  12 +
 sound/soc/Kconfig                                  |   1 +
 sound/soc/Makefile                                 |   1 +
 sound/soc/codecs/dmic.c                            |   8 +
 sound/soc/stm/Kconfig                              |  10 +
 sound/soc/stm/Makefile                             |   2 +
 sound/soc/stm/stm32_adfsdm.c                       | 362 +++++++++++
 24 files changed, 3131 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.txt
 create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
 create mode 100644 Documentation/devicetree/bindings/sound/dmic.txt
 create mode 100644 Documentation/devicetree/bindings/sound/st,stm32-adfsdm.txt
 create mode 100644 drivers/iio/adc/sd_adc_modulator.c
 create mode 100644 drivers/iio/adc/stm32-dfsdm-adc.c
 create mode 100644 drivers/iio/adc/stm32-dfsdm-audio.c
 create mode 100644 drivers/iio/adc/stm32-dfsdm-core.c
 create mode 100644 drivers/iio/adc/stm32-dfsdm.h
 create mode 100644 drivers/iio/hw_consumer.c
 create mode 100644 include/linux/iio/adc/stm32-dfsdm-audio.h
 create mode 100644 include/linux/iio/hw_consumer.h
 create mode 100644 sound/soc/stm/Kconfig
 create mode 100644 sound/soc/stm/Makefile
 create mode 100644 sound/soc/stm/stm32_adfsdm.c

V2:

Patch-set associated to this RFC proposes an implementation of the
DFSDM features shared between ASoC and IIO frameworks.

Patch-set is only a Skeleton of the drivers, so a base to discuss and validate a design. 
It contains minimum code to allow probing (with DT) and to expose the ASoC and IIO ABI.
Hope that is sufficent in a first step to allow to focus on APIs.

In this patch-set there are two new APIs used:
	- IIO in-kern API: based on hw_customer API proposed by Lars
 	- ASOC <-> IIO API inspired by API defined for hdmi-codec for ASoC/DRM interconnect. 
   	  API is dedicated to DFSDM only.

Notice also that this design is based on following assumption:
	- Audio stream ABI interface is ASoC, no access to data through IIO ABI for PDM. 
	- ASoC DMA should be used for audio transfer as designed for real time stream.
	- Need some runtime parameters exchange between ASoC and IIO
	  due to the correlation between the sample frequency, the DFSDM decimation 
          factor and the associated scaling.

- "ASoC: dmaengine_pcm: add copy support" patch:
 I added a patch in ASoC that allows to implement a copy function to process data 
 after DMA transfer. Requested, as DFSDM samples captured contain channel ID 
 on 8-LSB bits and need also a potential rescale to present DAT on 24-bits.  	

- "IIO: ADC: add sigma delta modulator support" patch:
Simple dummy driver created to support external Sigma delta modulator. 
It is binded to DFSDM driver through hw_customer API.


- 
1.9.1




More information about the linux-arm-kernel mailing list