linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add support for ADC on stm32mp157a-dk1
@ 2019-09-13 14:34 Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 1/3] ARM: dts: stm32: Enable VREFBUF " Fabrice Gasnier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fabrice Gasnier @ 2019-09-13 14:34 UTC (permalink / raw)
  To: alexandre.torgue
  Cc: mark.rutland, devicetree, linux-kernel, robh+dt, mcoquelin.stm32,
	fabrice.gasnier, linux-stm32, linux-arm-kernel

This series adds support for ADC on stm32mp157a-dk1 board:
- enable vrefbuf regulator used as reference voltage
- define ADC pins for AIN connector and USB Type-C CC pins
- configure ADC1 and ADC2 to use these

Fabrice Gasnier (3):
  ARM: dts: stm32: Enable VREFBUF on stm32mp157a-dk1
  ARM: dts: stm32: add ADC pins used on stm32mp157a-dk1
  ARM: dts: stm32: enable ADC support on stm32mp157a-dk1

 arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 16 +++++++++++++++
 arch/arm/boot/dts/stm32mp157a-dk1.dts     | 34 +++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ARM: dts: stm32: Enable VREFBUF on stm32mp157a-dk1
  2019-09-13 14:34 [PATCH 0/3] Add support for ADC on stm32mp157a-dk1 Fabrice Gasnier
@ 2019-09-13 14:34 ` Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 2/3] ARM: dts: stm32: add ADC pins used " Fabrice Gasnier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fabrice Gasnier @ 2019-09-13 14:34 UTC (permalink / raw)
  To: alexandre.torgue
  Cc: mark.rutland, devicetree, linux-kernel, robh+dt, mcoquelin.stm32,
	fabrice.gasnier, linux-stm32, linux-arm-kernel

Enable VREFBUF as ADC/DAC uses it on stm32mp157a-dk1 board.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 arch/arm/boot/dts/stm32mp157a-dk1.dts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/stm32mp157a-dk1.dts b/arch/arm/boot/dts/stm32mp157a-dk1.dts
index 0615d1c..ebd9f33 100644
--- a/arch/arm/boot/dts/stm32mp157a-dk1.dts
+++ b/arch/arm/boot/dts/stm32mp157a-dk1.dts
@@ -449,3 +449,10 @@
 	pinctrl-0 = <&uart4_pins_a>;
 	status = "okay";
 };
+
+&vrefbuf {
+	regulator-min-microvolt = <2500000>;
+	regulator-max-microvolt = <2500000>;
+	vdda-supply = <&vdd>;
+	status = "okay";
+};
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ARM: dts: stm32: add ADC pins used on stm32mp157a-dk1
  2019-09-13 14:34 [PATCH 0/3] Add support for ADC on stm32mp157a-dk1 Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 1/3] ARM: dts: stm32: Enable VREFBUF " Fabrice Gasnier
@ 2019-09-13 14:34 ` Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 3/3] ARM: dts: stm32: enable ADC support " Fabrice Gasnier
  2019-10-03 10:08 ` [PATCH 0/3] Add support for ADC " Alexandre Torgue
  3 siblings, 0 replies; 5+ messages in thread
From: Fabrice Gasnier @ 2019-09-13 14:34 UTC (permalink / raw)
  To: alexandre.torgue
  Cc: mark.rutland, devicetree, linux-kernel, robh+dt, mcoquelin.stm32,
	fabrice.gasnier, linux-stm32, linux-arm-kernel

Define pins that can be used for ADC on stm32mp157a-dk1 board:
- AIN connector has ADC input pins
- USB Type-C CC1 & CC2 pins (e.g. in18, in19)

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi
index e4a0d51..eeb60d0 100644
--- a/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi
@@ -137,6 +137,22 @@
 				status = "disabled";
 			};
 
+			adc12_ain_pins_a: adc12-ain-0 {
+				pins {
+					pinmux = <STM32_PINMUX('C', 3, ANALOG)>, /* ADC1 in13 */
+						 <STM32_PINMUX('F', 12, ANALOG)>, /* ADC1 in6 */
+						 <STM32_PINMUX('F', 13, ANALOG)>, /* ADC2 in2 */
+						 <STM32_PINMUX('F', 14, ANALOG)>; /* ADC2 in6 */
+				};
+			};
+
+			adc12_usb_cc_pins_a: adc12-usb-cc-pins-0 {
+				pins {
+					pinmux = <STM32_PINMUX('A', 4, ANALOG)>, /* ADC12 in18 */
+						 <STM32_PINMUX('A', 5, ANALOG)>; /* ADC12 in19 */
+				};
+			};
+
 			cec_pins_a: cec-0 {
 				pins {
 					pinmux = <STM32_PINMUX('A', 15, AF4)>;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ARM: dts: stm32: enable ADC support on stm32mp157a-dk1
  2019-09-13 14:34 [PATCH 0/3] Add support for ADC on stm32mp157a-dk1 Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 1/3] ARM: dts: stm32: Enable VREFBUF " Fabrice Gasnier
  2019-09-13 14:34 ` [PATCH 2/3] ARM: dts: stm32: add ADC pins used " Fabrice Gasnier
@ 2019-09-13 14:34 ` Fabrice Gasnier
  2019-10-03 10:08 ` [PATCH 0/3] Add support for ADC " Alexandre Torgue
  3 siblings, 0 replies; 5+ messages in thread
From: Fabrice Gasnier @ 2019-09-13 14:34 UTC (permalink / raw)
  To: alexandre.torgue
  Cc: mark.rutland, devicetree, linux-kernel, robh+dt, mcoquelin.stm32,
	fabrice.gasnier, linux-stm32, linux-arm-kernel

Configure ADC support on stm32mp157a-dk1. It can be used for various
purpose:
- AIN connector has several analog inputs: ANA0, ANA1, ADC2 in6 & in2,
  ADC1 in13 & in6
- USB Type-C CC1 & CC2 pins wired to in18 & in19
It's easier then to Configure them all. But keep them disabled by default,
so the pins are kept in their initial state to lower power consumption.
This way they can also be used as GPIO.
Add VDD and VDDA supplies to ADC on stm32mp157c-dk1 board. This allows to
get full ADC analog performances in case VDDA is below 2.7V (not the case
by default).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 arch/arm/boot/dts/stm32mp157a-dk1.dts | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/stm32mp157a-dk1.dts b/arch/arm/boot/dts/stm32mp157a-dk1.dts
index ebd9f33..2f42fcd 100644
--- a/arch/arm/boot/dts/stm32mp157a-dk1.dts
+++ b/arch/arm/boot/dts/stm32mp157a-dk1.dts
@@ -97,6 +97,33 @@
 	};
 };
 
+&adc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&adc12_ain_pins_a>, <&adc12_usb_cc_pins_a>;
+	vdd-supply = <&vdd>;
+	vdda-supply = <&vdd>;
+	vref-supply = <&vrefbuf>;
+	status = "disabled";
+	adc1: adc@0 {
+		/*
+		 * Type-C USB_PWR_CC1 & USB_PWR_CC2 on in18 & in19.
+		 * Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
+		 * 5 * (56 + 47kOhms) * 5pF => 2.5us.
+		 * Use arbitrary margin here (e.g. 5us).
+		 */
+		st,min-sample-time-nsecs = <5000>;
+		/* AIN connector, USB Type-C CC1 & CC2 */
+		st,adc-channels = <0 1 6 13 18 19>;
+		status = "okay";
+	};
+	adc2: adc@100 {
+		/* AIN connector, USB Type-C CC1 & CC2 */
+		st,adc-channels = <0 1 2 6 18 19>;
+		st,min-sample-time-nsecs = <5000>;
+		status = "okay";
+	};
+};
+
 &cec {
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&cec_pins_b>;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Add support for ADC on stm32mp157a-dk1
  2019-09-13 14:34 [PATCH 0/3] Add support for ADC on stm32mp157a-dk1 Fabrice Gasnier
                   ` (2 preceding siblings ...)
  2019-09-13 14:34 ` [PATCH 3/3] ARM: dts: stm32: enable ADC support " Fabrice Gasnier
@ 2019-10-03 10:08 ` Alexandre Torgue
  3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Torgue @ 2019-10-03 10:08 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: mark.rutland, devicetree, linux-kernel, robh+dt, mcoquelin.stm32,
	linux-stm32, linux-arm-kernel

Hi Fabrice

On 9/13/19 4:34 PM, Fabrice Gasnier wrote:
> This series adds support for ADC on stm32mp157a-dk1 board:
> - enable vrefbuf regulator used as reference voltage
> - define ADC pins for AIN connector and USB Type-C CC pins
> - configure ADC1 and ADC2 to use these
> 
> Fabrice Gasnier (3):
>    ARM: dts: stm32: Enable VREFBUF on stm32mp157a-dk1
>    ARM: dts: stm32: add ADC pins used on stm32mp157a-dk1
>    ARM: dts: stm32: enable ADC support on stm32mp157a-dk1
> 
>   arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 16 +++++++++++++++
>   arch/arm/boot/dts/stm32mp157a-dk1.dts     | 34 +++++++++++++++++++++++++++++++
>   2 files changed, 50 insertions(+)
> 

Series applied on stm32-next.

Regards
Alex

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-03 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 14:34 [PATCH 0/3] Add support for ADC on stm32mp157a-dk1 Fabrice Gasnier
2019-09-13 14:34 ` [PATCH 1/3] ARM: dts: stm32: Enable VREFBUF " Fabrice Gasnier
2019-09-13 14:34 ` [PATCH 2/3] ARM: dts: stm32: add ADC pins used " Fabrice Gasnier
2019-09-13 14:34 ` [PATCH 3/3] ARM: dts: stm32: enable ADC support " Fabrice Gasnier
2019-10-03 10:08 ` [PATCH 0/3] Add support for ADC " 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).