ARM: dts: stm32mp1: Add adc nodes
authorPatrice Chotard <patrice.chotard@st.com>
Tue, 12 Feb 2019 15:50:41 +0000 (16:50 +0100)
committerPatrick Delaunay <patrick.delaunay@st.com>
Fri, 12 Apr 2019 14:09:13 +0000 (16:09 +0200)
Add adc related nodes. These nodes are used to detect the
current supplied by USB type-C power in port on DK1 and DK2
boards.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/dts/stm32mp157-pinctrl.dtsi
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi

index 4d2bf33be7d48e5d49c219286f824f7e039ea3e3..c06987548612083159bf7bb3d7fbd3539f35b5cf 100644 (file)
                                gpio-ranges = <&pinctrl 0 160 8>;
                        };
 
+                       adc12_usb_pwr_pins_a: adc12-usb-pwr-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)>;
index b4cfba0a386dd75abe978e12fd002be017b11dfd..af7acfa0375d0a13800bed69022abf78591de334 100644 (file)
        };
 };
 
+&adc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&adc12_usb_pwr_pins_a>;
+       vdd-supply = <&vdd>;
+       vdda-supply = <&vdd>;
+       vref-supply = <&vrefbuf>;
+       status = "okay";
+       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. 5µs).
+                */
+               st,min-sample-time-nsecs = <5000>;
+               /* ANA0, ANA1, USB Type-C CC1 & CC2 */
+               st,adc-channels = <0 1 18 19>;
+               status = "okay";
+       };
+};
+
 &clk_hse {
        st,digbypass;
 };