* [PATCH 0/3] Enable ADC on STM32
@ 2016-12-02 13:56 Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 1/3] ARM: configs: stm32: enable ADC driver Fabrice Gasnier
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Fabrice Gasnier @ 2016-12-02 13:56 UTC (permalink / raw)
To: alexandre.torgue, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Enable minimal configuration and device tree to support ADC on STM32,
using ADC driver: https://lwn.net/Articles/706445/
Simple test on stm32f429i-eval board, using on-board potentiometer:
- cd /sys/bus/iio/devices/iio\:device0/
- cat in_voltage8_raw
Fabrice Gasnier (3):
ARM: configs: stm32: enable ADC driver
ARM: dts: stm32: Add ADC support to stm32f429
ARM: dts: stm32: enable ADC on stm32f429i-eval board
arch/arm/boot/dts/stm32429i-eval.dts | 25 ++++++++++++++++++
arch/arm/boot/dts/stm32f429.dtsi | 49 ++++++++++++++++++++++++++++++++++++
arch/arm/configs/stm32_defconfig | 5 ++++
3 files changed, 79 insertions(+)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] ARM: configs: stm32: enable ADC driver
2016-12-02 13:56 [PATCH 0/3] Enable ADC on STM32 Fabrice Gasnier
@ 2016-12-02 13:57 ` Fabrice Gasnier
2017-01-09 14:46 ` Alexandre Torgue
2016-12-02 13:57 ` [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429 Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board Fabrice Gasnier
2 siblings, 1 reply; 7+ messages in thread
From: Fabrice Gasnier @ 2016-12-02 13:57 UTC (permalink / raw)
To: alexandre.torgue, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
ADC driver depends on REGULATOR and IIO that are not yet selected.
Current hardware boards (like stm32f429i-eval) is using fixed
regulators.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
arch/arm/configs/stm32_defconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/configs/stm32_defconfig b/arch/arm/configs/stm32_defconfig
index a60b5cb..92ccc3c 100644
--- a/arch/arm/configs/stm32_defconfig
+++ b/arch/arm/configs/stm32_defconfig
@@ -49,6 +49,8 @@ CONFIG_SERIAL_STM32=y
CONFIG_SERIAL_STM32_CONSOLE=y
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_USB_SUPPORT is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
@@ -57,6 +59,9 @@ CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_DMADEVICES=y
CONFIG_STM32_DMA=y
+CONFIG_IIO=y
+CONFIG_STM32_ADC_CORE=y
+CONFIG_STM32_ADC=y
# CONFIG_FILE_LOCKING is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429
2016-12-02 13:56 [PATCH 0/3] Enable ADC on STM32 Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 1/3] ARM: configs: stm32: enable ADC driver Fabrice Gasnier
@ 2016-12-02 13:57 ` Fabrice Gasnier
2017-01-09 14:46 ` Alexandre Torgue
2016-12-02 13:57 ` [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board Fabrice Gasnier
2 siblings, 1 reply; 7+ messages in thread
From: Fabrice Gasnier @ 2016-12-02 13:57 UTC (permalink / raw)
To: alexandre.torgue, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Add ADC support & pinctrl analog phandle (adc3_in8) to stm32f429.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
arch/arm/boot/dts/stm32f429.dtsi | 49 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 3dd47eb..be1d970 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -172,6 +172,49 @@
status = "disabled";
};
+ adc: adc@40012000 {
+ compatible = "st,stm32f4-adc-core";
+ reg = <0x40012000 0x400>;
+ interrupts = <18>;
+ clocks = <&rcc 0 168>;
+ clock-names = "adc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+
+ adc1: adc@0 {
+ compatible = "st,stm32f4-adc";
+ #io-channel-cells = <1>;
+ reg = <0x0>;
+ clocks = <&rcc 0 168>;
+ interrupt-parent = <&adc>;
+ interrupts = <0>;
+ status = "disabled";
+ };
+
+ adc2: adc@100 {
+ compatible = "st,stm32f4-adc";
+ #io-channel-cells = <1>;
+ reg = <0x100>;
+ clocks = <&rcc 0 169>;
+ interrupt-parent = <&adc>;
+ interrupts = <1>;
+ status = "disabled";
+ };
+
+ adc3: adc@200 {
+ compatible = "st,stm32f4-adc";
+ #io-channel-cells = <1>;
+ reg = <0x200>;
+ clocks = <&rcc 0 170>;
+ interrupt-parent = <&adc>;
+ interrupts = <2>;
+ status = "disabled";
+ };
+ };
+
syscfg: system-config@40013800 {
compatible = "syscon";
reg = <0x40013800 0x400>;
@@ -334,6 +377,12 @@
slew-rate = <2>;
};
};
+
+ adc3_in8_pin: adc@200 {
+ pins {
+ pinmux = <STM32F429_PF10_FUNC_ANALOG>;
+ };
+ };
};
rcc: rcc@40023810 {
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board
2016-12-02 13:56 [PATCH 0/3] Enable ADC on STM32 Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 1/3] ARM: configs: stm32: enable ADC driver Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429 Fabrice Gasnier
@ 2016-12-02 13:57 ` Fabrice Gasnier
2017-01-09 14:48 ` Alexandre Torgue
2 siblings, 1 reply; 7+ messages in thread
From: Fabrice Gasnier @ 2016-12-02 13:57 UTC (permalink / raw)
To: alexandre.torgue, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Enable analog to digital converter on stm32f429i-eval board.
It has on-board potentimeter wired to ADC3 in8 analog pin and
uses fixed regulator to provide reference voltage.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
arch/arm/boot/dts/stm32429i-eval.dts | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
index 13c7cd2..6be0a24 100644
--- a/arch/arm/boot/dts/stm32429i-eval.dts
+++ b/arch/arm/boot/dts/stm32429i-eval.dts
@@ -65,6 +65,20 @@
serial0 = &usart1;
};
+ regulators {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg_vref: regulator@0 {
+ compatible = "regulator-fixed";
+ reg = <0>;
+ regulator-name = "vref";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+ };
+
leds {
compatible = "gpio-leds";
green {
@@ -123,3 +137,14 @@
pinctrl-names = "default";
status = "okay";
};
+
+&adc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&adc3_in8_pin>;
+ vref-supply = <®_vref>;
+ status = "okay";
+ adc3: adc@200 {
+ st,adc-channels = <8>;
+ status = "okay";
+ };
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] ARM: configs: stm32: enable ADC driver
2016-12-02 13:57 ` [PATCH 1/3] ARM: configs: stm32: enable ADC driver Fabrice Gasnier
@ 2017-01-09 14:46 ` Alexandre Torgue
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Torgue @ 2017-01-09 14:46 UTC (permalink / raw)
To: Fabrice GASNIER, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Hi Fabrice
On 12/02/2016 02:57 PM, Fabrice GASNIER wrote:
> ADC driver depends on REGULATOR and IIO that are not yet selected.
> Current hardware boards (like stm32f429i-eval) is using fixed
> regulators.
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
> arch/arm/configs/stm32_defconfig | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm/configs/stm32_defconfig b/arch/arm/configs/stm32_defconfig
> index a60b5cb..92ccc3c 100644
> --- a/arch/arm/configs/stm32_defconfig
> +++ b/arch/arm/configs/stm32_defconfig
> @@ -49,6 +49,8 @@ CONFIG_SERIAL_STM32=y
> CONFIG_SERIAL_STM32_CONSOLE=y
> # CONFIG_HW_RANDOM is not set
> # CONFIG_HWMON is not set
> +CONFIG_REGULATOR=y
> +CONFIG_REGULATOR_FIXED_VOLTAGE=y
> # CONFIG_USB_SUPPORT is not set
> CONFIG_NEW_LEDS=y
> CONFIG_LEDS_CLASS=y
> @@ -57,6 +59,9 @@ CONFIG_LEDS_TRIGGERS=y
> CONFIG_LEDS_TRIGGER_HEARTBEAT=y
> CONFIG_DMADEVICES=y
> CONFIG_STM32_DMA=y
> +CONFIG_IIO=y
> +CONFIG_STM32_ADC_CORE=y
> +CONFIG_STM32_ADC=y
> # CONFIG_FILE_LOCKING is not set
> # CONFIG_DNOTIFY is not set
> # CONFIG_INOTIFY_USER is not set
>
Applied on stm32-defconfig-for-v4.11
Thanks.
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429
2016-12-02 13:57 ` [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429 Fabrice Gasnier
@ 2017-01-09 14:46 ` Alexandre Torgue
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Torgue @ 2017-01-09 14:46 UTC (permalink / raw)
To: Fabrice GASNIER, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Hi Fabrice
On 12/02/2016 02:57 PM, Fabrice GASNIER wrote:
> Add ADC support & pinctrl analog phandle (adc3_in8) to stm32f429.
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
> arch/arm/boot/dts/stm32f429.dtsi | 49 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index 3dd47eb..be1d970 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -172,6 +172,49 @@
> status = "disabled";
> };
>
> + adc: adc@40012000 {
> + compatible = "st,stm32f4-adc-core";
> + reg = <0x40012000 0x400>;
> + interrupts = <18>;
> + clocks = <&rcc 0 168>;
> + clock-names = "adc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> +
> + adc1: adc@0 {
> + compatible = "st,stm32f4-adc";
> + #io-channel-cells = <1>;
> + reg = <0x0>;
> + clocks = <&rcc 0 168>;
> + interrupt-parent = <&adc>;
> + interrupts = <0>;
> + status = "disabled";
> + };
> +
> + adc2: adc@100 {
> + compatible = "st,stm32f4-adc";
> + #io-channel-cells = <1>;
> + reg = <0x100>;
> + clocks = <&rcc 0 169>;
> + interrupt-parent = <&adc>;
> + interrupts = <1>;
> + status = "disabled";
> + };
> +
> + adc3: adc@200 {
> + compatible = "st,stm32f4-adc";
> + #io-channel-cells = <1>;
> + reg = <0x200>;
> + clocks = <&rcc 0 170>;
> + interrupt-parent = <&adc>;
> + interrupts = <2>;
> + status = "disabled";
> + };
> + };
> +
> syscfg: system-config@40013800 {
> compatible = "syscon";
> reg = <0x40013800 0x400>;
> @@ -334,6 +377,12 @@
> slew-rate = <2>;
> };
> };
> +
> + adc3_in8_pin: adc@200 {
> + pins {
> + pinmux = <STM32F429_PF10_FUNC_ANALOG>;
> + };
> + };
> };
>
> rcc: rcc@40023810 {
>
Applied on stm32-dt-for-v4.11
Thanks
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board
2016-12-02 13:57 ` [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board Fabrice Gasnier
@ 2017-01-09 14:48 ` Alexandre Torgue
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Torgue @ 2017-01-09 14:48 UTC (permalink / raw)
To: Fabrice GASNIER, mcoquelin.stm32, linux, mark.rutland, robh+dt
Cc: devicetree, linux-arm-kernel, linux-kernel
Hi Fabrice
On 12/02/2016 02:57 PM, Fabrice GASNIER wrote:
> Enable analog to digital converter on stm32f429i-eval board.
> It has on-board potentimeter wired to ADC3 in8 analog pin and
> uses fixed regulator to provide reference voltage.
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
> arch/arm/boot/dts/stm32429i-eval.dts | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
> index 13c7cd2..6be0a24 100644
> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> @@ -65,6 +65,20 @@
> serial0 = &usart1;
> };
>
> + regulators {
> + compatible = "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + reg_vref: regulator@0 {
> + compatible = "regulator-fixed";
> + reg = <0>;
> + regulator-name = "vref";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + };
> + };
> +
> leds {
> compatible = "gpio-leds";
> green {
> @@ -123,3 +137,14 @@
> pinctrl-names = "default";
> status = "okay";
> };
> +
> +&adc {
> + pinctrl-names = "default";
> + pinctrl-0 = <&adc3_in8_pin>;
> + vref-supply = <®_vref>;
> + status = "okay";
> + adc3: adc@200 {
> + st,adc-channels = <8>;
> + status = "okay";
> + };
> +};
>
After node reordering:
Applied on stm32-dt-for-v4.11
Thanks
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-01-09 14:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 13:56 [PATCH 0/3] Enable ADC on STM32 Fabrice Gasnier
2016-12-02 13:57 ` [PATCH 1/3] ARM: configs: stm32: enable ADC driver Fabrice Gasnier
2017-01-09 14:46 ` Alexandre Torgue
2016-12-02 13:57 ` [PATCH 2/3] ARM: dts: stm32: Add ADC support to stm32f429 Fabrice Gasnier
2017-01-09 14:46 ` Alexandre Torgue
2016-12-02 13:57 ` [PATCH 3/3] ARM: dts: stm32: enable ADC on stm32f429i-eval board Fabrice Gasnier
2017-01-09 14:48 ` Alexandre Torgue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).