I am using a iMX93 QS93, In the device tree I configured the gpio as an input line as you can see below
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_pmic>;
// nPBOUT Line Input
power_button_npbout {
label = "nPBOUT";
gpios = <&gpio2 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <0>;
//interrupt-parent = <&gpio2>;
//interrupts = <18 IRQ_TYPE_EDGE_BOTH>;
};
};
And here the Pin Multiplexing configuration:
pinctrl_gpio_pmic: gpio_pmicgrp {
fsl,pins = <
MX93_PAD_GPIO_IO18__GPIO2_IO18 0x1c0
>;
};
I am building my image using yocto and after the successful build, I run the image in the target and tried to export the gpio by running `echo 50 > /sys/class/gpio/export`. The export fails with the error :
-bash: echo: write error: Device or resource busy
The `gpioinfo` shows this line under `gpiochip0 - 32lines:`
line 18: unnamed input active-low consumer=nPBOUT
The output of `cat /sys/kernel/debug/gpio` shows :
gpio-0 ( |scl ) out lo
gpio-1 ( |sda ) in lo
gpio-2 ( |scl ) out lo
gpio-3 ( |sda ) in lo
gpio-9 ( |PSHOLD ) out lo
gpiochip0: GPIOs 32-63, parent: platform/43810080.gpio, 43810080.gpio:
gpio-50 ( |nPBOUT ) in hi IRQ ACTIVE LOW
gpio-60 ( |sda ) in lo
gpio-61 ( |scl ) out lo
gpiochip1: GPIOs 64-95, parent: platform/43820080.gpio, 43820080.gpio:
gpiochip2: GPIOs 96-127, parent: platform/43830080.gpio, 43830080.gpio:
Am writing C++ code to interact with gpios, I wanted to test this input gpio by export it and read it value but I can't. Could anyone help me out to be able to read the value of the gpio (I am connecting the gpio pin to GND and 3.3V pins for testing)