All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Arnaud Pouliquen <arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
	Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	Peter Meerwald-Stadler
	<pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>,
	Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>,
	Takashi Iwai <tiwai-IBi9RG/b67k@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org"
	<alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
	"kernel-F5mvAk5X5gdBDgjK7y7TUQ@public.gmane.org"
	<kernel-F5mvAk5X5gdBDgjK7y7TUQ@public.gmane.org>,
	Maxime Coquelin
	<mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>,
	Olivier MOYSAN <olivier.moysan-qxv4g6HH51o@public.gmane.org>
Subject: Re: [RFC v2 6/7] IIO: add bindings for stm32 DFSDM filter
Date: Sun, 5 Mar 2017 11:00:23 +0000	[thread overview]
Message-ID: <bfabb5c4-fdd3-efe9-08f2-f42a0dd30166@kernel.org> (raw)
In-Reply-To: <7fbfc694-3685-ec90-6292-5a5157a8a0d2-qxv4g6HH51o@public.gmane.org>

On 27/02/17 10:47, Arnaud Pouliquen wrote:
> 
> 
> On 02/19/2017 04:00 PM, Jonathan Cameron wrote:
>> On 13/02/17 16:38, Arnaud Pouliquen wrote:
>>> Add bindings that describe Digital Filter for Sigma Delta
>>> Modulators. DFSDM allows to connect sigma delta
>>> modulators and/or PDM microphones.
>>>
>>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
>>> ---
>>>  .../bindings/iio/adc/st,stm32-dfsdm-adc.txt        | 125 +++++++++++++++++++++
>>>  1 file changed, 125 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> new file mode 100644
>>> index 0000000..83937cb
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> @@ -0,0 +1,125 @@
>>> +STMicroelectronics STM32 DFSDM ADC device driver
>>> +
>>> +
>>> +STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicted to
>>> +interface external sigma delta modulators to stm32 micro controlers.
>>> +it is mainly targeted for:
>>> +- Sigma delta modulators ( motor control, metering...)
>>> +- PDM microphones ( audio digital microphone)
>>> +
>>> +It featured with up to 8 serial digital interface (SPI or Manchester) and
>>> +up to 4 filters.
>>> +
>>> +Each instance of the sub-drivers uses one filter instance.
>>> +
>>> +Contents of a stm32 dfsdmc root node:
>>> +-------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-dfsdm-adc".
>>> +- reg: Offset and length of the DFSDM block register set.
>>> +- clocks: IP and serial interfaces clocking. Should be set according
>>> +		to rcc clock ID and "clock-names".
>>> +- clock-names: Input clock name "dfsdm" must be defined,
>>> +		"audio" is optional. If defined CLKOUT is based on the audio
>>> +		clock, else "dfsdm" is used.
>>> +- clocks: Clock for the analog circuitry (common to all ADCs).
>>> +- clock-names: Must be "adc".
>>> +
>>> +Optional properties:
>>> +- st,clkout-freq: needed for SPI master mode
>>> +		  SPI clock OUT frequency (Hz).This clock must be set according
>>> +		  to "clock" property. Frequency must be a multiple of the rcc
>>> +		  clock frequency. If not, clkout frequency will not be
>>> +		  accurate.
>>> +
>>> +Contents of a stm32 DFSDM child nodes:
>>> +----------------------------------------
>>> +
>>> +Required properties:
>>> +- compatible: Must be:
>>> +	"st,stm32-dfsdm-adc" for sigma delta ADCs
>>> +	"st,stm32-dfsdm-pdm" for audio digital microphone.
>>> +- reg: Specifies the DFSDM filter instance.
>>> +- interrupts: IRQ lines connected to each DFSDM filter instance.
>>> +- st,adc-channels:	List of single-ended channels muxed for this ADC.
>>> +- st,adc-channel-names:	List of single-ended channels Name.
>>> +- st,dai-filter-order:  SinC filter order from 0 to 5.
>>> +			0: FastSinC
>>> +			[1-5]: order 1 to 5.
>>> +			For audio purpose it is recommended to use order 3 to 5.
>>> +
>>> +Required properties for "st,stm32-dfsdm-adc" compatibility:
>>> +- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers".
>>> +- io-channels: from common iio binding. use to pipe external sigma delta
>>> +		modulator or internal ADC output to dfsdm channel.
>>> +
>>> +Required properties for "st,stm32-dfsdm-pdm" compatibility:
>>> +- #sound-dai-cells: must be set to 0.
>>> +- dma: DMA controller phandle and DMA request line associated to the
>>> +		filter instance ( specified by the field "reg")
>>> +- dma-names: must be "rx"
>>> +
>>> +Optional properties:
>>> +- st,adc-channel-types:	Single-ended channel input type. Default value is 0.
>>> +			- "SPI_R": SPI with data on rising edge (default)
>>> +			- "SPI_F": SPI with data on falling edge
>>> +			- "MANCH_R": manchester codec, rising edge = logic 0
>>> +			- "MANCH_F": manchester codec, falling edge = logic 1
>>> +- st,adc-channel-clk-src: Conversion clock source. default value is 1.
>>> +			  - "CLKIN": External SPI clock (CLKIN x)
>>> +			  - "CLKOUT": internal SPI clock (CLKOUT) (default)
>>> +			  - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
>>> +			  - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
>>> +
>>> +- st,adc-alt-channel: Must be defined if Two sigma delta modulator are
>>> +			  connected on same SPI input.
>>> +			  If not set channel n is connected to SPI input n.
>>> +			  If set channel n is connected to SPI input n + 1.
>>> +
>>> +- st,filter0-sync: Set to 1 to synchronize with DFSDM filter instance 0.
>>> +		   to used for multi microphone synchronization.
>>> +
>>> +Example of a sigma delta adc purpose:
>>> +	ads1202: simple_sd_adc@0 {
>>> +		compatible = "sd-modulator";
>> This suggests to me that we ought to have a primary compatible of the actual part
>> number.  Down the line I suspect we will want to distinguish between the different
>> ADCs and it's kind of easier if we do it from the start.  May not be obvious
>> later which the 'default sd-modulator' is.
> Not sure to understand your point... you mean use ADC name instead, for
> compatibility as suggested by Rob?
Yes, though you can do it as (and I may have the syntax wrong)
compatible = "ads1202", "sd-modulator" perhaps giving a fallback.
Better than having people 'lie' about the connected part in device trees
because they don't want to push the change upstream to add their part to those
supported.

This is similar to what we do for SoC ADCs where they are in theory compatible
across all supported parts, but in reality there are sometimes errata etc.
Allows people to be as specific as possible in their device trees, without
precluding use in the generic form if the part isn't explicitly supported.

Up to Rob though on whether he's happy with that trick here...

> 
>>> +		#io-channel-cells = <1>;
>>> +		status = "okay";
>>> +	};
>>> +	dfsdm: dfsdm@40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_adc0: dfsdm-adc0@0 {
>>> +			compatible = "st,stm32-dfsdm-adc";
>>> +			#io-channel-cells = <1>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "in0";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +			io-channels = <&ads1202 0>;
>>> +	};
>>> +
>>> +Example of a pdm microphone purpose:
>> Is there nothing about the particular pdm microphone that is
>> worth giving it an explicit representation in the device
>> tree?  I've no idea having never used one!
>>> +	dfsdm: dfsdm@40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_pdm0: dfsdm-pdm@0 {
>>> +			compatible = "st,stm32-dfsdm-pdm";
>>> +			#sound-dai-cells = <0>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			dmas = <&dmamux1 102 0x400 0x00>;
>>> +			dma-names = "rx";
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "pdm1";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +		};
>>> +	}
>>>
>>
> Here is a way to use it in device tree.
> - dmic_0 is an ASOC generic device that handles the PDM microphone
> - dai-link allows to bind the DFSDM with the SD-modulator in ALSA card
> declaration.
> 
> 	dmic0: dmic_0@0 {
> 		compatible = "dmic-codec";
> 		#sound-dai-cells = <0>;
> 
> 		status = "okay";
> 	};
> 
> 	sound_dfsdm_pdm {
> 		compatible = "simple-audio-card";
> 		simple-audio-card,name = "dfsdm_pdm";
> 		status = "okay";
> 
> 		dfsdm0_mic0: simple-audio-card,dai-link@0 {
> 			format = "pdm";
> 			bitclock-master = <&dmic0_codec>;
> 			cpu {
> 				system-clock-frequency= <2480000>;
> 				sound-dai = <&dfsdm_pdm0>;
> 			};
> 			dmic0_codec: codec {
> 				sound-dai = <&dmic0>;
> 			};
> 		};
> 	};
> };
That's fine.  I was just wondering if they ever had an 'smarts' 
that might make it sensible to provide an explicit description like
we are doing for the ADC part being used.

Sounds like no!
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Arnaud Pouliquen <arnaud.pouliquen@st.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"kernel@stlinux.com" <kernel@stlinux.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Olivier MOYSAN <olivier.moysan@st.com>
Subject: Re: [RFC v2 6/7] IIO: add bindings for stm32 DFSDM filter
Date: Sun, 5 Mar 2017 11:00:23 +0000	[thread overview]
Message-ID: <bfabb5c4-fdd3-efe9-08f2-f42a0dd30166@kernel.org> (raw)
In-Reply-To: <7fbfc694-3685-ec90-6292-5a5157a8a0d2@st.com>

On 27/02/17 10:47, Arnaud Pouliquen wrote:
> 
> 
> On 02/19/2017 04:00 PM, Jonathan Cameron wrote:
>> On 13/02/17 16:38, Arnaud Pouliquen wrote:
>>> Add bindings that describe Digital Filter for Sigma Delta
>>> Modulators. DFSDM allows to connect sigma delta
>>> modulators and/or PDM microphones.
>>>
>>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>>> ---
>>>  .../bindings/iio/adc/st,stm32-dfsdm-adc.txt        | 125 +++++++++++++++++++++
>>>  1 file changed, 125 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> new file mode 100644
>>> index 0000000..83937cb
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> @@ -0,0 +1,125 @@
>>> +STMicroelectronics STM32 DFSDM ADC device driver
>>> +
>>> +
>>> +STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicted to
>>> +interface external sigma delta modulators to stm32 micro controlers.
>>> +it is mainly targeted for:
>>> +- Sigma delta modulators ( motor control, metering...)
>>> +- PDM microphones ( audio digital microphone)
>>> +
>>> +It featured with up to 8 serial digital interface (SPI or Manchester) and
>>> +up to 4 filters.
>>> +
>>> +Each instance of the sub-drivers uses one filter instance.
>>> +
>>> +Contents of a stm32 dfsdmc root node:
>>> +-------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-dfsdm-adc".
>>> +- reg: Offset and length of the DFSDM block register set.
>>> +- clocks: IP and serial interfaces clocking. Should be set according
>>> +		to rcc clock ID and "clock-names".
>>> +- clock-names: Input clock name "dfsdm" must be defined,
>>> +		"audio" is optional. If defined CLKOUT is based on the audio
>>> +		clock, else "dfsdm" is used.
>>> +- clocks: Clock for the analog circuitry (common to all ADCs).
>>> +- clock-names: Must be "adc".
>>> +
>>> +Optional properties:
>>> +- st,clkout-freq: needed for SPI master mode
>>> +		  SPI clock OUT frequency (Hz).This clock must be set according
>>> +		  to "clock" property. Frequency must be a multiple of the rcc
>>> +		  clock frequency. If not, clkout frequency will not be
>>> +		  accurate.
>>> +
>>> +Contents of a stm32 DFSDM child nodes:
>>> +----------------------------------------
>>> +
>>> +Required properties:
>>> +- compatible: Must be:
>>> +	"st,stm32-dfsdm-adc" for sigma delta ADCs
>>> +	"st,stm32-dfsdm-pdm" for audio digital microphone.
>>> +- reg: Specifies the DFSDM filter instance.
>>> +- interrupts: IRQ lines connected to each DFSDM filter instance.
>>> +- st,adc-channels:	List of single-ended channels muxed for this ADC.
>>> +- st,adc-channel-names:	List of single-ended channels Name.
>>> +- st,dai-filter-order:  SinC filter order from 0 to 5.
>>> +			0: FastSinC
>>> +			[1-5]: order 1 to 5.
>>> +			For audio purpose it is recommended to use order 3 to 5.
>>> +
>>> +Required properties for "st,stm32-dfsdm-adc" compatibility:
>>> +- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers".
>>> +- io-channels: from common iio binding. use to pipe external sigma delta
>>> +		modulator or internal ADC output to dfsdm channel.
>>> +
>>> +Required properties for "st,stm32-dfsdm-pdm" compatibility:
>>> +- #sound-dai-cells: must be set to 0.
>>> +- dma: DMA controller phandle and DMA request line associated to the
>>> +		filter instance ( specified by the field "reg")
>>> +- dma-names: must be "rx"
>>> +
>>> +Optional properties:
>>> +- st,adc-channel-types:	Single-ended channel input type. Default value is 0.
>>> +			- "SPI_R": SPI with data on rising edge (default)
>>> +			- "SPI_F": SPI with data on falling edge
>>> +			- "MANCH_R": manchester codec, rising edge = logic 0
>>> +			- "MANCH_F": manchester codec, falling edge = logic 1
>>> +- st,adc-channel-clk-src: Conversion clock source. default value is 1.
>>> +			  - "CLKIN": External SPI clock (CLKIN x)
>>> +			  - "CLKOUT": internal SPI clock (CLKOUT) (default)
>>> +			  - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
>>> +			  - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
>>> +
>>> +- st,adc-alt-channel: Must be defined if Two sigma delta modulator are
>>> +			  connected on same SPI input.
>>> +			  If not set channel n is connected to SPI input n.
>>> +			  If set channel n is connected to SPI input n + 1.
>>> +
>>> +- st,filter0-sync: Set to 1 to synchronize with DFSDM filter instance 0.
>>> +		   to used for multi microphone synchronization.
>>> +
>>> +Example of a sigma delta adc purpose:
>>> +	ads1202: simple_sd_adc@0 {
>>> +		compatible = "sd-modulator";
>> This suggests to me that we ought to have a primary compatible of the actual part
>> number.  Down the line I suspect we will want to distinguish between the different
>> ADCs and it's kind of easier if we do it from the start.  May not be obvious
>> later which the 'default sd-modulator' is.
> Not sure to understand your point... you mean use ADC name instead, for
> compatibility as suggested by Rob?
Yes, though you can do it as (and I may have the syntax wrong)
compatible = "ads1202", "sd-modulator" perhaps giving a fallback.
Better than having people 'lie' about the connected part in device trees
because they don't want to push the change upstream to add their part to those
supported.

This is similar to what we do for SoC ADCs where they are in theory compatible
across all supported parts, but in reality there are sometimes errata etc.
Allows people to be as specific as possible in their device trees, without
precluding use in the generic form if the part isn't explicitly supported.

Up to Rob though on whether he's happy with that trick here...

> 
>>> +		#io-channel-cells = <1>;
>>> +		status = "okay";
>>> +	};
>>> +	dfsdm: dfsdm@40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_adc0: dfsdm-adc0@0 {
>>> +			compatible = "st,stm32-dfsdm-adc";
>>> +			#io-channel-cells = <1>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "in0";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +			io-channels = <&ads1202 0>;
>>> +	};
>>> +
>>> +Example of a pdm microphone purpose:
>> Is there nothing about the particular pdm microphone that is
>> worth giving it an explicit representation in the device
>> tree?  I've no idea having never used one!
>>> +	dfsdm: dfsdm@40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_pdm0: dfsdm-pdm@0 {
>>> +			compatible = "st,stm32-dfsdm-pdm";
>>> +			#sound-dai-cells = <0>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			dmas = <&dmamux1 102 0x400 0x00>;
>>> +			dma-names = "rx";
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "pdm1";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +		};
>>> +	}
>>>
>>
> Here is a way to use it in device tree.
> - dmic_0 is an ASOC generic device that handles the PDM microphone
> - dai-link allows to bind the DFSDM with the SD-modulator in ALSA card
> declaration.
> 
> 	dmic0: dmic_0@0 {
> 		compatible = "dmic-codec";
> 		#sound-dai-cells = <0>;
> 
> 		status = "okay";
> 	};
> 
> 	sound_dfsdm_pdm {
> 		compatible = "simple-audio-card";
> 		simple-audio-card,name = "dfsdm_pdm";
> 		status = "okay";
> 
> 		dfsdm0_mic0: simple-audio-card,dai-link@0 {
> 			format = "pdm";
> 			bitclock-master = <&dmic0_codec>;
> 			cpu {
> 				system-clock-frequency= <2480000>;
> 				sound-dai = <&dfsdm_pdm0>;
> 			};
> 			dmic0_codec: codec {
> 				sound-dai = <&dmic0>;
> 			};
> 		};
> 	};
> };
That's fine.  I was just wondering if they ever had an 'smarts' 
that might make it sensible to provide an explicit description like
we are doing for the ADC part being used.

Sounds like no!
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


WARNING: multiple messages have this Message-ID (diff)
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC v2 6/7] IIO: add bindings for stm32 DFSDM filter
Date: Sun, 5 Mar 2017 11:00:23 +0000	[thread overview]
Message-ID: <bfabb5c4-fdd3-efe9-08f2-f42a0dd30166@kernel.org> (raw)
In-Reply-To: <7fbfc694-3685-ec90-6292-5a5157a8a0d2@st.com>

On 27/02/17 10:47, Arnaud Pouliquen wrote:
> 
> 
> On 02/19/2017 04:00 PM, Jonathan Cameron wrote:
>> On 13/02/17 16:38, Arnaud Pouliquen wrote:
>>> Add bindings that describe Digital Filter for Sigma Delta
>>> Modulators. DFSDM allows to connect sigma delta
>>> modulators and/or PDM microphones.
>>>
>>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>>> ---
>>>  .../bindings/iio/adc/st,stm32-dfsdm-adc.txt        | 125 +++++++++++++++++++++
>>>  1 file changed, 125 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> new file mode 100644
>>> index 0000000..83937cb
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt
>>> @@ -0,0 +1,125 @@
>>> +STMicroelectronics STM32 DFSDM ADC device driver
>>> +
>>> +
>>> +STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicted to
>>> +interface external sigma delta modulators to stm32 micro controlers.
>>> +it is mainly targeted for:
>>> +- Sigma delta modulators ( motor control, metering...)
>>> +- PDM microphones ( audio digital microphone)
>>> +
>>> +It featured with up to 8 serial digital interface (SPI or Manchester) and
>>> +up to 4 filters.
>>> +
>>> +Each instance of the sub-drivers uses one filter instance.
>>> +
>>> +Contents of a stm32 dfsdmc root node:
>>> +-------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-dfsdm-adc".
>>> +- reg: Offset and length of the DFSDM block register set.
>>> +- clocks: IP and serial interfaces clocking. Should be set according
>>> +		to rcc clock ID and "clock-names".
>>> +- clock-names: Input clock name "dfsdm" must be defined,
>>> +		"audio" is optional. If defined CLKOUT is based on the audio
>>> +		clock, else "dfsdm" is used.
>>> +- clocks: Clock for the analog circuitry (common to all ADCs).
>>> +- clock-names: Must be "adc".
>>> +
>>> +Optional properties:
>>> +- st,clkout-freq: needed for SPI master mode
>>> +		  SPI clock OUT frequency (Hz).This clock must be set according
>>> +		  to "clock" property. Frequency must be a multiple of the rcc
>>> +		  clock frequency. If not, clkout frequency will not be
>>> +		  accurate.
>>> +
>>> +Contents of a stm32 DFSDM child nodes:
>>> +----------------------------------------
>>> +
>>> +Required properties:
>>> +- compatible: Must be:
>>> +	"st,stm32-dfsdm-adc" for sigma delta ADCs
>>> +	"st,stm32-dfsdm-pdm" for audio digital microphone.
>>> +- reg: Specifies the DFSDM filter instance.
>>> +- interrupts: IRQ lines connected to each DFSDM filter instance.
>>> +- st,adc-channels:	List of single-ended channels muxed for this ADC.
>>> +- st,adc-channel-names:	List of single-ended channels Name.
>>> +- st,dai-filter-order:  SinC filter order from 0 to 5.
>>> +			0: FastSinC
>>> +			[1-5]: order 1 to 5.
>>> +			For audio purpose it is recommended to use order 3 to 5.
>>> +
>>> +Required properties for "st,stm32-dfsdm-adc" compatibility:
>>> +- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers".
>>> +- io-channels: from common iio binding. use to pipe external sigma delta
>>> +		modulator or internal ADC output to dfsdm channel.
>>> +
>>> +Required properties for "st,stm32-dfsdm-pdm" compatibility:
>>> +- #sound-dai-cells: must be set to 0.
>>> +- dma: DMA controller phandle and DMA request line associated to the
>>> +		filter instance ( specified by the field "reg")
>>> +- dma-names: must be "rx"
>>> +
>>> +Optional properties:
>>> +- st,adc-channel-types:	Single-ended channel input type. Default value is 0.
>>> +			- "SPI_R": SPI with data on rising edge (default)
>>> +			- "SPI_F": SPI with data on falling edge
>>> +			- "MANCH_R": manchester codec, rising edge = logic 0
>>> +			- "MANCH_F": manchester codec, falling edge = logic 1
>>> +- st,adc-channel-clk-src: Conversion clock source. default value is 1.
>>> +			  - "CLKIN": External SPI clock (CLKIN x)
>>> +			  - "CLKOUT": internal SPI clock (CLKOUT) (default)
>>> +			  - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
>>> +			  - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
>>> +
>>> +- st,adc-alt-channel: Must be defined if Two sigma delta modulator are
>>> +			  connected on same SPI input.
>>> +			  If not set channel n is connected to SPI input n.
>>> +			  If set channel n is connected to SPI input n + 1.
>>> +
>>> +- st,filter0-sync: Set to 1 to synchronize with DFSDM filter instance 0.
>>> +		   to used for multi microphone synchronization.
>>> +
>>> +Example of a sigma delta adc purpose:
>>> +	ads1202: simple_sd_adc at 0 {
>>> +		compatible = "sd-modulator";
>> This suggests to me that we ought to have a primary compatible of the actual part
>> number.  Down the line I suspect we will want to distinguish between the different
>> ADCs and it's kind of easier if we do it from the start.  May not be obvious
>> later which the 'default sd-modulator' is.
> Not sure to understand your point... you mean use ADC name instead, for
> compatibility as suggested by Rob?
Yes, though you can do it as (and I may have the syntax wrong)
compatible = "ads1202", "sd-modulator" perhaps giving a fallback.
Better than having people 'lie' about the connected part in device trees
because they don't want to push the change upstream to add their part to those
supported.

This is similar to what we do for SoC ADCs where they are in theory compatible
across all supported parts, but in reality there are sometimes errata etc.
Allows people to be as specific as possible in their device trees, without
precluding use in the generic form if the part isn't explicitly supported.

Up to Rob though on whether he's happy with that trick here...

> 
>>> +		#io-channel-cells = <1>;
>>> +		status = "okay";
>>> +	};
>>> +	dfsdm: dfsdm at 40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_adc0: dfsdm-adc0 at 0 {
>>> +			compatible = "st,stm32-dfsdm-adc";
>>> +			#io-channel-cells = <1>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "in0";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +			io-channels = <&ads1202 0>;
>>> +	};
>>> +
>>> +Example of a pdm microphone purpose:
>> Is there nothing about the particular pdm microphone that is
>> worth giving it an explicit representation in the device
>> tree?  I've no idea having never used one!
>>> +	dfsdm: dfsdm at 40017000 {
>>> +		compatible = "st,stm32h7-dfsdm";
>>> +		reg = <0x40017000 0x400>;
>>> +		clocks = <&timer_clk>;
>>> +		clock-names = "dfsdm";
>>> +
>>> +		dfsdm_pdm0: dfsdm-pdm at 0 {
>>> +			compatible = "st,stm32-dfsdm-pdm";
>>> +			#sound-dai-cells = <0>;
>>> +			reg = <0>;
>>> +			interrupts = <110>;
>>> +			dmas = <&dmamux1 102 0x400 0x00>;
>>> +			dma-names = "rx";
>>> +			st,adc-channels = <0>;
>>> +			st,adc-channel-names = "pdm1";
>>> +			st,adc-channel-types = "SPI_R";
>>> +			st,adc-channel-clk-src = "CLKOUT";
>>> +		};
>>> +	}
>>>
>>
> Here is a way to use it in device tree.
> - dmic_0 is an ASOC generic device that handles the PDM microphone
> - dai-link allows to bind the DFSDM with the SD-modulator in ALSA card
> declaration.
> 
> 	dmic0: dmic_0 at 0 {
> 		compatible = "dmic-codec";
> 		#sound-dai-cells = <0>;
> 
> 		status = "okay";
> 	};
> 
> 	sound_dfsdm_pdm {
> 		compatible = "simple-audio-card";
> 		simple-audio-card,name = "dfsdm_pdm";
> 		status = "okay";
> 
> 		dfsdm0_mic0: simple-audio-card,dai-link at 0 {
> 			format = "pdm";
> 			bitclock-master = <&dmic0_codec>;
> 			cpu {
> 				system-clock-frequency= <2480000>;
> 				sound-dai = <&dfsdm_pdm0>;
> 			};
> 			dmic0_codec: codec {
> 				sound-dai = <&dmic0>;
> 			};
> 		};
> 	};
> };
That's fine.  I was just wondering if they ever had an 'smarts' 
that might make it sensible to provide an explicit description like
we are doing for the ADC part being used.

Sounds like no!
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2017-03-05 11:00 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 16:38 [RFC v2 0/7] Add STM32 DFSDM support Arnaud Pouliquen
2017-02-13 16:38 ` Arnaud Pouliquen
2017-02-13 16:38 ` Arnaud Pouliquen
2017-02-13 16:38 ` [RFC v2 1/7] iio: Add hardware consumer support Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
     [not found]   ` <1487003909-11710-2-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-02-19 14:13     ` Jonathan Cameron
2017-02-19 14:13       ` Jonathan Cameron
2017-02-19 14:13       ` Jonathan Cameron
2017-02-13 16:38 ` [RFC v2 2/7] IIO: Add bindings for simple sigma delta adc Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-22 15:17   ` Rob Herring
2017-02-22 15:17     ` Rob Herring
2017-02-22 15:17     ` Rob Herring
2017-02-27 11:15     ` Arnaud Pouliquen
2017-02-27 11:15       ` Arnaud Pouliquen
2017-02-27 11:15       ` Arnaud Pouliquen
2017-03-05 11:04       ` Jonathan Cameron
2017-03-05 11:04         ` Jonathan Cameron
2017-03-05 11:04         ` Jonathan Cameron
2017-02-13 16:38 ` [RFC v2 3/7] IIO: ADC: add sigma delta modulator support Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
     [not found]   ` <1487003909-11710-4-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-02-19 14:20     ` Jonathan Cameron
2017-02-19 14:20       ` Jonathan Cameron
2017-02-19 14:20       ` Jonathan Cameron
2017-02-13 16:38 ` [RFC v2 4/7] ASoC: dmaengine_pcm: add copy support Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-14 17:16   ` Mark Brown
2017-02-14 17:16     ` Mark Brown
2017-02-14 17:16     ` Mark Brown
2017-02-15 13:59     ` Arnaud Pouliquen
2017-02-15 13:59       ` Arnaud Pouliquen
2017-02-15 13:59       ` Arnaud Pouliquen
     [not found]       ` <40633f7c-a2ac-1658-cc9d-b30eaff8a95a-qxv4g6HH51o@public.gmane.org>
2017-02-15 14:53         ` Mark Brown
2017-02-15 14:53           ` Mark Brown
2017-02-15 14:53           ` Mark Brown
2017-02-15 15:46           ` Arnaud Pouliquen
2017-02-15 15:46             ` Arnaud Pouliquen
2017-02-15 15:46             ` Arnaud Pouliquen
     [not found]             ` <338f8db7-2077-626f-986b-b4e3df40469c-qxv4g6HH51o@public.gmane.org>
2017-02-16 20:14               ` Mark Brown
2017-02-16 20:14                 ` Mark Brown
2017-02-16 20:14                 ` Mark Brown
2017-02-27  9:05                 ` Arnaud Pouliquen
2017-02-27  9:05                   ` Arnaud Pouliquen
2017-02-27  9:05                   ` Arnaud Pouliquen
2017-02-13 16:38 ` [RFC v2 5/7] ASoC: stm32: add DFSDM DAI support Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
     [not found]   ` <1487003909-11710-6-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-02-13 18:13     ` Peter Meerwald-Stadler
2017-02-13 18:13       ` Peter Meerwald-Stadler
     [not found]       ` <alpine.DEB.2.02.1702131906350.25127-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>
2017-02-14 11:09         ` Arnaud Pouliquen
2017-02-14 11:09           ` Arnaud Pouliquen
     [not found]           ` <c381a9a2-5dff-af9a-eeb0-8fd1a74f448e-qxv4g6HH51o@public.gmane.org>
2017-02-14 12:57             ` Peter Meerwald-Stadler
2017-02-14 12:57               ` Peter Meerwald-Stadler
2017-02-14 17:45     ` Mark Brown
2017-02-14 17:45       ` Mark Brown
2017-02-14 17:45       ` Mark Brown
2017-02-15 16:39       ` Arnaud Pouliquen
2017-02-15 16:39         ` Arnaud Pouliquen
2017-02-15 16:39         ` Arnaud Pouliquen
     [not found]         ` <9b875a75-294a-2f59-5830-cc0f6b3b62c7-qxv4g6HH51o@public.gmane.org>
2017-02-15 16:53           ` Mark Brown
2017-02-15 16:53             ` Mark Brown
2017-02-15 16:53             ` Mark Brown
     [not found]       ` <20170214174534.35ytbpax75mxcayg-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-02-19 14:56         ` Jonathan Cameron
2017-02-19 14:56           ` Jonathan Cameron
2017-02-19 14:56           ` Jonathan Cameron
2017-02-27 10:31           ` Arnaud Pouliquen
2017-02-27 10:31             ` Arnaud Pouliquen
2017-02-27 10:31             ` Arnaud Pouliquen
     [not found]             ` <84f330ab-48a2-6e0b-ab95-6aab5b34c241-qxv4g6HH51o@public.gmane.org>
2017-03-05 10:55               ` Jonathan Cameron
2017-03-05 10:55                 ` Jonathan Cameron
2017-03-05 10:55                 ` Jonathan Cameron
2017-02-13 16:38 ` [RFC v2 6/7] IIO: add bindings for stm32 DFSDM filter Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-19 15:00   ` Jonathan Cameron
2017-02-19 15:00     ` Jonathan Cameron
2017-02-19 15:00     ` Jonathan Cameron
2017-02-27 10:47     ` Arnaud Pouliquen
2017-02-27 10:47       ` Arnaud Pouliquen
2017-02-27 10:47       ` Arnaud Pouliquen
     [not found]       ` <7fbfc694-3685-ec90-6292-5a5157a8a0d2-qxv4g6HH51o@public.gmane.org>
2017-03-05 11:00         ` Jonathan Cameron [this message]
2017-03-05 11:00           ` Jonathan Cameron
2017-03-05 11:00           ` Jonathan Cameron
     [not found]   ` <1487003909-11710-7-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-02-13 18:05     ` Peter Meerwald-Stadler
2017-02-13 18:05       ` Peter Meerwald-Stadler
2017-02-22 16:42     ` Rob Herring
2017-02-22 16:42       ` Rob Herring
2017-02-22 16:42       ` Rob Herring
2017-02-27 14:07       ` Arnaud Pouliquen
2017-02-27 14:07         ` Arnaud Pouliquen
2017-02-27 14:07         ` Arnaud Pouliquen
2017-02-13 16:38 ` [RFC v2 7/7] IIO: ADC: add stm32 DFSDM support Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-13 16:38   ` Arnaud Pouliquen
2017-02-19 14:46   ` Jonathan Cameron
2017-02-19 14:46     ` Jonathan Cameron
2017-02-19 14:46     ` Jonathan Cameron
2017-02-27 10:09     ` Arnaud Pouliquen
2017-02-27 10:09       ` Arnaud Pouliquen
2017-02-27 10:09       ` Arnaud Pouliquen
     [not found]       ` <fe86eca5-5dca-efb3-45d2-46e193f60dc9-qxv4g6HH51o@public.gmane.org>
2017-03-05 10:55         ` Jonathan Cameron
2017-03-05 10:55           ` Jonathan Cameron
2017-03-05 10:55           ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfabb5c4-fdd3-efe9-08f2-f42a0dd30166@kernel.org \
    --to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=alexandre.torgue-qxv4g6HH51o@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=arnaud.pouliquen-qxv4g6HH51o@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kernel-F5mvAk5X5gdBDgjK7y7TUQ@public.gmane.org \
    --cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=olivier.moysan-qxv4g6HH51o@public.gmane.org \
    --cc=perex-/Fr2/VpizcU@public.gmane.org \
    --cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tiwai-IBi9RG/b67k@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.