mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabrice Gasnier <fabrice.gasnier@st.com>
To: Rob Herring <robh@kernel.org>
Cc: <linux-iio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<jic23@kernel.org>, <linux@armlinux.org.uk>,
	<mark.rutland@arm.com>, <mcoquelin.stm32@gmail.com>,
	<alexandre.torgue@st.com>, <lars@metafoo.de>, <knaack.h@gmx.de>,
	<pmeerw@pmeerw.net>
Subject: Re: [PATCH 01/10] Documentation: dt-bindings: Document STM32 ADC DT bindings
Date: Thu, 3 Nov 2016 12:11:19 +0100	[thread overview]
Message-ID: <37fc7ac7-8b99-9f21-d9d7-de2e217eb4cd@st.com> (raw)
In-Reply-To: <20161031030222.vjxcxklpaua3o77d@rob-hp-laptop>

On 10/31/2016 04:02 AM, Rob Herring wrote:
> On Tue, Oct 25, 2016 at 06:25:13PM +0200, Fabrice Gasnier wrote:
>> This patch adds documentation of device tree bindings for the STM32 ADC.
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>> ---
>>   .../devicetree/bindings/iio/adc/st,stm32-adc.txt   | 78 ++++++++++++++++++++++
>>   1 file changed, 78 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>> new file mode 100644
>> index 0000000..a9a8b3c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>> @@ -0,0 +1,78 @@
>> +STMicroelectronics STM32 ADC device driver
>> +
>> +STM32 ADC is a successive approximation analog-to-digital converter.
>> +It has several multiplexed input channels. Conversions can be performed
>> +in single, continuous, scan or discontinuous mode. Result of the ADC is
>> +stored in a left-aligned or right-aligned 32-bit data register.
>> +Conversions can be launched in software or using hardware triggers.
>> +
>> +The analog watchdog feature allows the application to detect if the input
>> +voltage goes beyond the user-defined, higher or lower thresholds.
>> +
>> +Each STM32 ADC block can have up to 3 ADC instances.
>> +
>> +Each instance supports two contexts to manage conversions, each one has its
>> +own configurable sequence and trigger:
>> +- regular conversion can be done in sequence, running in background
>> +- injected conversions have higher priority, and so have the ability to
>> +  interrupt regular conversion sequence (either triggered in SW or HW).
>> +  Regular sequence is resumed, in case it has been interrupted.
>> +
>> +Required properties:
>> +- compatible: Should be "st,stm32f4-adc".
>> +- reg: Offset and length of the ADC block register set.
>> +- interrupts: Must contain the interrupt for ADC.
>> +- clocks: Clock for the analog circuitry (common to all ADCs).
>> +- clock-names: Must be "adc".
>> +- vref-supply: Phandle to the vref input analog reference voltage.
>> +- #address-cells = <1>;
>> +- #size-cells = <0>;
>> +
>> +Optional properties:
>> +- A pinctrl state named "default" for each ADC channel may be defined to set
>> +  inX ADC pins in mode of operation for analog input on external pin.
>> +- gpios: Array of gpios that may be configured as EXTi trigger sources.
>> +
>> +Example:
> This should be last.
Hi Rob,

I'll fix this.
>
>> +	adc: adc@40012000 {
>> +		compatible = "st,stm32f4-adc";
>> +		reg = <0x40012000 0x400>;
>> +		interrupts = <18>;
>> +		clocks = <&rcc 0 168>;
>> +		clock-names = "adc";
>> +		vref-supply = <&reg_vref>;
>> +		pinctrl-names = "default";
>> +		pinctrl-0 = <&adc3_in8_pin>;
>> +		gpios = <&gpioa 11 0>,
>> +			<&gpioa 15 0>;
>> +
>> +		#address-cells = <1>;
>> +		#size-cells = <0>;
>> +
>> +		adc1: adc1-master@0 {
> adc@0 sufficient?
Yes, if you agree, I'd go for adc1@0, adc2@100, adc3@200, to reflect reg 
property for child node.
Is it ok from your point of view ?

>
>> +			#io-channel-cells = <1>;
>> +			reg = <0x0>;
>> +			clocks = <&rcc 0 168>;
>> +			st,adc-channels = <8>;
>> +		};
>> +		...
>> +		other adc child nodes follow...
>> +	};
>> +
>> +Contents of a stm32 adc child node:
>> +-----------------------------------
>> +An ADC block node should contain at least one subnode, representing an
>> +ADC instance available on the machine.
>> +
>> +Required properties:
>> +- reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
>> +- st,adc-channels: List of single-ended channels muxed for this ADC.
> How many? What are valid values?
stm32f4 can have up to 19 channels, numbered from 0 to 18 to match with 
reference manual.
I'll add this.
>
>> +- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
>> +  Documentation/devicetree/bindings/iio/iio-bindings.txt
>> +
>> +Optional properties:
>> +- clocks: Input clock private to this ADC instance.
>> +- st,injected: Use injected conversion sequence on an ADC, rather than regular.
> Not sure about this one. Seems like this would either be a user choice
> or depend on what's connected to the ADC.
It's related to ADC sequencer, and the way it's being configured/used 
(see above paragraph on regular/injected).
This is not related to what's connected to adc inputs.
As suggested by Jonathan, I think I'll drop injected support for now, to 
simplify the driver and review.

Thanks,
Best Regards,
Fabrice
>
>> +- dmas: Phandle to dma channel for this ADC instance, only for regular
>> +  conversions. See ../../dma/dma.txt for details.
>> +- dma-names: Must be "rx" when dmas property is being used.
>> -- 
>> 1.9.1
>>

  reply	other threads:[~2016-11-03 11:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 16:25 [PATCH 00/10] Add support for STM32 ADC Fabrice Gasnier
2016-10-25 16:25 ` [PATCH 01/10] Documentation: dt-bindings: Document STM32 ADC DT bindings Fabrice Gasnier
2016-10-31  3:02   ` Rob Herring
2016-11-03 11:11     ` Fabrice Gasnier [this message]
2016-10-25 16:25 ` [PATCH 02/10] iio: adc: Add stm32 support Fabrice Gasnier
2016-10-30 15:27   ` Jonathan Cameron
2016-11-03  8:20     ` Fabrice Gasnier
2016-11-05 15:44       ` Jonathan Cameron
2016-10-25 16:25 ` [PATCH 03/10] iio: adc: stm32: add optional dma support Fabrice Gasnier
2016-10-30 15:34   ` Jonathan Cameron
2016-10-25 16:25 ` [PATCH 04/10] iio: adc: stm32: add optional support for exti gpios Fabrice Gasnier
2016-10-30 14:35   ` Jonathan Cameron
2016-10-25 16:25 ` [PATCH 05/10] iio: adc: stm32: add trigger polarity ext attr Fabrice Gasnier
2016-10-30 14:33   ` Jonathan Cameron
2016-10-25 16:25 ` [PATCH 06/10] iio: adc: stm32: add ext attrs to configure sampling time Fabrice Gasnier
2016-10-30 14:21   ` Jonathan Cameron
2016-10-25 16:25 ` [PATCH 07/10] ARM: configs: stm32: enable IIO ADC driver Fabrice Gasnier
2016-10-25 16:25 ` [PATCH 08/10] ARM: dts: stm32f429: Add adc support Fabrice Gasnier
2016-10-25 16:25 ` [PATCH 09/10] ARM: dts: stm32f429: enable adc on eval board Fabrice Gasnier
2016-10-25 16:25 ` [PATCH 10/10] ARM: dts: stm32f429: Add dma support to adc Fabrice Gasnier

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=37fc7ac7-8b99-9f21-d9d7-de2e217eb4cd@st.com \
    --to=fabrice.gasnier@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®