For an imx91 based project I am stuck with defining my first GPIO as output.
I have read several posts where examples towards the device trees are explained but I am still getting the `-22` return value.
Defined in device tree:
gpio_reset: gpio-reset {
compatible = "gpio-reset";
pinctrl-names = "default";
reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
status = "okay";
label = "RSTO";
gpio-name = "RSTO";
line-name = "RSTO";
};
Here I tried adding label,gpio-name and line-name. Not sure which one is needed.
Then in function
static void board_gpio_init(void){
struct gpio_desc desc;
int ret;
/* De-assert RSTO */
ret = dm_gpio_lookup_name("RSTO", &desc);
if (ret) {
printf("%s lookup 'RSTO' failed ret = %d\n", __func__, ret);
return;
}
...
}
This always returns -22 and it's the first pin to look up.
Then I thought let's try a proven example code based on leds,
gpio-leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_led>;
led-0 {
gpios = <&gpio3 26 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led-1 {
gpios = <&gpio3 27 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
Then
ret = dm_gpio_lookup_name("led-1", &desc);
also returns -22