zephyr: Getting GPIOs from DTS file without aliases
Hiremath, Vijay P <vijay.p.hiremath@...>
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));
Regards Vijay
|
|
Kumar Gala
On Oct 20, 2020, at 12:24 PM, Hiremath, Vijay P <vijay.p.hiremath@intel.com> wrote:I think you want DT_NODELABEL. DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios) - k
|
|
Hiremath, Vijay P <vijay.p.hiremath@...>
Hi Kumar,
toggle quoted messageShow quoted text
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:I think you want DT_NODELABEL. DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios) - k
|
|
Hiremath, Vijay P <vijay.p.hiremath@...>
Changing to definition in DTS file to lowercase without underscore works with Kumar's fix
toggle quoted messageShow quoted text
enpp3p3: GPIOA3 { label = "EN_PP3300_A"; gpios = <&gpioa 3 GPIO_ACTIVE_HIGH>; }; const struct device *pin_pp3300_en = device_get_binding(DT_GPIO_LABEL(DT_NODELABEL(enpp3p3), gpios));
-----Original Message-----
From: Hiremath, Vijay P Sent: Tuesday, October 20, 2020 11:23 AM To: Kumar Gala <kumar.gala@linaro.org> Cc: devel@lists.zephyrproject.org Subject: RE: [Zephyr-devel] zephyr: Getting GPIOs from DTS file without aliases 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:I think you want DT_NODELABEL. DT_GPIO_LABEL(DT_NODELABEL(EC_VR_EN_PP3300_A), gpios) - k
|
|
Kumar Gala
Can you do:
toggle quoted messageShow quoted text
grep DT_N_NODELABEL zephyr/include/generated/devicetree_unfixed.h - k
On Oct 20, 2020, at 1:22 PM, Hiremath, Vijay P <vijay.p.hiremath@intel.com> wrote:
|
|