Re: how to describe a peripheral with power enable pin


Rafael Dias
 

I found a solution:

/ {
si7021_pwr: si7021-pwr-ctrl {
compatible = "regulator-fixed";
regulator-name = "Si7021 enable pin";
enable-gpios = < &gpiod 9 0 >;
label = "Si7021pwr";
};

si7021_pwr2: si7021-pwr2-ctrl {
compatible = "regulator-fixed";
regulator-name = "Si7021 enable pin";
enable-gpios = < &gpiod 10 0 >;
label = "Si7021pwr2";
};
};

On Thu, 8 Apr 2021 at 06:03, Rafael Dias via lists.zephyrproject.org <rdmeneze=gmail.com@...> wrote:
Hi Peter,
thank you.

I was performing some tests here and I have a question: if I want to enable two or more supply-regulators in device three, how to proceed?

I tried this approach and it doesn't work:

/ {
regulator {
compatible = "regulator-fixed";
regulator-name = "Si7021 enable pin";
enable-gpios = < &gpiod 9 0 >;
label = "Si7021pwr";
};

regulator {
compatible = "regulator-fixed";
regulator-name = "Si7021 enable pin test";
enable-gpios = < &gpiod 10 0 >;
label = "Si7021pwr2";
};
};

Using this declarations, only the second definition,  Si7021pwr2, appears on ./zephyr/include/generated/devicetree_unfixed.h

On Fri, 2 Apr 2021 at 13:08, Peter A. Bigot <pab@...> wrote:
The regulators API was designed for this purpose.  For a simple GPIO you should just be able to use a supply-gpios property in the devicetree node.  See https://docs.zephyrproject.org/latest/reference/peripherals/regulators.html

Peter



--
Rafael Dias Menezes
tel.:
+436507008854



--
Rafael Dias Menezes
tel.:
+436507008854

Join devel@lists.zephyrproject.org to automatically receive all group messages.