Re: zephyr: Getting GPIOs from DTS file without aliases


Kumar Gala
 

On Oct 20, 2020, at 12:24 PM, Hiremath, Vijay P <vijay.p.hiremath@intel.com> wrote:

Hi All,

I have a dts file for GPIO configs. I would like to know if it is possible to get the GPIOs without aliases

DTS file:
pow_seq_gpio_keys {
compatible = "gpio-keys";

EC_VR_EN_PP3300_A: GPIOA3 {
label = "EN_PP3300_A";
gpios = <&gpioa 3 GPIO_ACTIVE_HIGH>;
};
};

aliases {
pp3300aout = &EC_VR_EN_PP3300_A;
};

C file:
Compiles:
const struct device *pin_pp3300_en = device_get_binding(DT_GPIO_LABEL(DT_ALIAS(pp3300aout), gpios));

fails to compile:
const struct device *pin_pp3300_en = device_get_binding(DT_GPIO_LABEL(EC_VR_EN_PP3300_A, gpios));
I think you want DT_NODELABEL.

DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios)

- k

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