Skip to main content
Associate II
October 31, 2025
Question

STM32 ADC UBoot Driver failing when trying to enable ADC voltage regulator (ADVREGEN)

I'm trying to perform ADC using PA3 (adc1_in15) and PF11(adc1_in2) pins of stm32mp157c-ev1 board but I keep getting "stm32-adc adc@0: Failed to enable vreg: -110"

In arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi I added the following:

&adc {
    /* ANA0, ANA1 are dedicated pins and don't need pinctrl: only in6. */
    pinctrl-0 = <&adc1_ain_pins_a>;
    pinctrl-names = "default";
    vdd-supply = <&vdd>;
    vdda-supply = <&vdda>;
    vref-supply = <&vdda>;
    status = "okay";
    adc1: adc@0 {
         status = "okay";
 
        /delete-node/ channel@0;
        /delete-node/ channel@1;
        /delete-node/ channel@6;
 
        channel@2 {
             reg = <2>;
             /* 16.5 ck_cycles sampling time */
            st,min-sample-time-ns = <400>;
        };
        channel@15 {
            reg = <15>;
            st,min-sample-time-ns = <400>;
        };
    };
};
 
After comparing the drivers between the kernel and uboot, I found out that the UBoot's stm32-adc-core driver does not enable the VDDA/VDD and VREF regulators. Thus, I tried to patch 
stm32_adc_core_probe so VDDA/VDD and VREF regulators will get enabled (I used
regulator_set_enable_if_allowed API from regulator.h to enable them)
). After patching it, I verified that the issue got fixed and was able to perform ADC.
 
I would like to understand whether this is a driver issue or DTS issue? If it is a driver problem, please patch it as I'm not an familiar with contributing to the community and got no idea about the SOP for patching a driver. Thanks!