GPIO driver for Xavier NX

Hello Team,

I am writing one simple GPIO (character) driver for our Custom designed carrier board Xavier NX.

  1. Can i test my gpio driver on GPIO04 . If yes then what value should we use for locating gpio like gpio 4 or gpio 04 …
    e.g. in my code
    #define LED0_GPIO 4 /*As i am testing on GPIO04 */
    #define DEVICE_MAJOR 200
    #define DEVICE_MINOR 0
    #define DEVICE_COUNT 1
    #define GPIO_DEVICE_MODEL_NUMBER “gpio-leds”

    err_check = gpio_is_valid(LED0_GPIO);
    if(err_check == 0)
    printk(“gpio is valid: %d\n”, err_check);
    pr_err(“failed to initialize a structure with an valid gpio number\n%d”, err_check);
    return -1;

but in dmesg , I AM GETTING ERROR AS :-
[ 496.824834] Successfully allocating the range of led char device number[ 496.824844] Succesfully adding the led-gpio diver to system
[ 496.824848] Welcome to gpio-leds Driver.
[ 496.824852] failed to initialize a structure with an valid gpio number

please help me in identifying the mistake.

  1. Can i use any other GPIO pin and how to check whether i can use any other gpio pins or not .I have already read pinmux configuration for nx but could not conclude from it.

hello vinay2010singh,

it’s not 4 for your GPIO04 pin,
please refer to GPIO Changes session, please check the steps obtain the GPIO number of signal name.
in addition,
there’s allocation range for those main gpio and aon gpios. please refer to kernel init messages for the allocation ranges.
for example,

$ dmesg | grep "registered GPIOs "
[    0.784792] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[    0.792896] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[    0.966195] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)

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