Regulators from GPIO expander

Hi, 

I have some dependency issues in my devicetree definition. 

I have a first regulator that control the power of a gpio expander connected through I2C. 

This GPIO expander control other regulators, for other devices. 

It seems that all regulators declared from gpio expander try to get configured before the gpio expander is initialized. 

But I need the first regulator to be initialized before the gpio expander. 

What is the recommended way to implement this initialization order. 

First regulator -> I2C -> GPIO expander -> other regulators ? 

Parents
  • Hello, 

    Can you please provide more information and elaborate more on what you are trying to achieve. What device are you using? What version of nRF Connect SDK are you using?


    Thank you.
    Kind regards,
    Øyvind

  • I'm on nrf Connect v1.9. 

    It's a custom board with a NRF52840. 

    I use one GPIO for enabling power for the most important peripherals.

    I added a regulator in my device tree, this regulator is enabled by this GPIO. 

    Then I have a PCA9534 GPIO expander on I2C. 

    I want to add more regulators managed by the pins from the GPIO expander.

    Here sample of my device tree and an overlay I use for regulators from GPIO expander : 

    / {
    	
    	sw_3v3_en: sw-3v3-ctrl {
    		compatible = "regulator-fixed-sync", "regulator-fixed";
    		label = "sw-3v3-ctrl";
    		regulator-name = "sw-3v3-ctrl";
    		enable-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
    		/* Always on in dev config */ 
    		regulator-boot-on;
    	};
    
        [...]
        
    };

    / {
    
        en_a_aux: en-a-ctrl {
    		compatible = "regulator-fixed";
    		label = "PERIPHERAL-A-REGULATOR";
    		regulator-name = "en-a-ctrl";
    		enable-gpios = <&gpio_expander 0 GPIO_ACTIVE_HIGH>;
            vin-supply = <&sw_3v3_en>;
    		// Always on in dev config
    		regulator-boot-on;
    	};
    };
    
    &i2c1 {
        gpio_expander: tca953x@20 {
            status = "okay";
            compatible = "ti,tca9538";
            label = "PCA953X";
            reg = <0x20>;
            gpio-controller;
            ngpios = <8>;
            #gpio-cells = <2>;
            vin-supply = <&sw_3v3_en>;
        };
    };

    Regards,

Reply
  • I'm on nrf Connect v1.9. 

    It's a custom board with a NRF52840. 

    I use one GPIO for enabling power for the most important peripherals.

    I added a regulator in my device tree, this regulator is enabled by this GPIO. 

    Then I have a PCA9534 GPIO expander on I2C. 

    I want to add more regulators managed by the pins from the GPIO expander.

    Here sample of my device tree and an overlay I use for regulators from GPIO expander : 

    / {
    	
    	sw_3v3_en: sw-3v3-ctrl {
    		compatible = "regulator-fixed-sync", "regulator-fixed";
    		label = "sw-3v3-ctrl";
    		regulator-name = "sw-3v3-ctrl";
    		enable-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
    		/* Always on in dev config */ 
    		regulator-boot-on;
    	};
    
        [...]
        
    };

    / {
    
        en_a_aux: en-a-ctrl {
    		compatible = "regulator-fixed";
    		label = "PERIPHERAL-A-REGULATOR";
    		regulator-name = "en-a-ctrl";
    		enable-gpios = <&gpio_expander 0 GPIO_ACTIVE_HIGH>;
            vin-supply = <&sw_3v3_en>;
    		// Always on in dev config
    		regulator-boot-on;
    	};
    };
    
    &i2c1 {
        gpio_expander: tca953x@20 {
            status = "okay";
            compatible = "ti,tca9538";
            label = "PCA953X";
            reg = <0x20>;
            gpio-controller;
            ngpios = <8>;
            #gpio-cells = <2>;
            vin-supply = <&sw_3v3_en>;
        };
    };

    Regards,

Children
Related