Can't get gpiod and irq at AGX Xavier

Hello,
I am developing a gpio driver. But some gpio calls dont work.
Here is my dts entry;
my_nvidia_gpio {
compatible = “my,nvidia-gpio”;
status = “okay”;
in_gpiod = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 3) 0>;
out_gpiod = <&tegra_main_gpio TEGRA194_MAIN_GPIO(N, 1) 0>;;
};

First of all when I used gpiod_get to get the descriptor of the pin, it returns NULL. Then I used gpiod_get_optional successfully, but this time if I call gpiod_to_irq, -EINVAL error is returned. Pins are not set as wakeable on my pinmux and they are just standart GPIOs.
I tried to set the pin on terminal as the output shown below:
root@jetson-agx-xavier-industrial:~# echo PCC.03 > /sys/class/gpio/export
root@jetson-agx-xavier-industrial:~# [ 1311.875255] irq: IRQ283: trimming hierarchy from :pmc@c360000
After I set the direction and the edge, the folloiwng line is shown when cat /proc/interrupts is called
283: 0 0 0 0 gpio 15 Edge gpiolib
Which seems everything is ok for the pin.
You can find my complete test code in the attachments.
Can you please help me to understand the problem? Why gpiod_get or gpiod_to_irq doesn’t work?
Best Regards
nvidia_my_gpio.txt (3.7 KB)

So does your module work after exporting this pin?
You should also set the direction, but not just exporting.
Or set them via pinmux spreadsheet.

Hi DaveYY,
Yes if I export, set direction and edge via terminal, it works. But on my code it doesn’t work. I really didn’t understand what is wrong with my code. If you can comment on my code, I’ll appreciate.
Thanx, Regards

I mean whether it works or not if you export the pin before probing the module.

For your driver code, please test if you can get it work with

  1. of_get_named_gpio to get the GPIO from device tree.
  2. gpio_is_valid to check whether the GPIO from is valid
  3. gpio_to_irq to convert this gpio for irq.
1 Like

Hi
I’ll create a module, export the pin and then install module. I’ll try it. Thanx.

Hi WayneWWW,
I’ll update it. Thanx.
I’ll share the result.
Regards

Hi WayneWWW, Hi DaneYYY,
It worked fine. Thanx.
Best Regards

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.