Re: zephyr: Getting GPIOs from DTS file without aliases


Hiremath, Vijay P <vijay.p.hiremath@...>
 

Hi Kumar,

Thanks for the response, still couldn't compile.

const struct device *pin_pp3300_en = DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios);

error: 'DT_N_NODELABEL_EC_VR_EN_PP3300_A_P_gpios_IDX_0_PH_P_label' undeclared (first use in this function)
25 | DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios);

Regards
Vijay

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: Tuesday, October 20, 2020 11:09 AM
To: Hiremath, Vijay P <vijay.p.hiremath@intel.com>
Cc: devel@lists.zephyrproject.org
Subject: Re: [Zephyr-devel] zephyr: Getting GPIOs from DTS file without aliases



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.