NVIDIA Tegra
DRIVE 5.0 Linux Open Source Software

Development Guide
5.0.10.3 Release


 
Accessing GPIO User Space
 
Exporting GPIOs through /sys Interface
Exporting with the API
This topic explains how GPIOs may be exposed to user space by exporting GPIOs through the /sys interface.
Exporting GPIOs through /sys Interface
Note:
If a GPIO is meant to be used within the kernel, it should not be exported.
The kernel in your NVIDIA DRIVE product supports the standard GPIO kernel interfaces as described in the kernel tree at:
Documentation/gpio.txt
These interfaces allow the available GPIOs to be used by kernel drivers. Use the following procedure to export GPIOs from kernel space to user space.
Exporting with the API
You can use the Kernel APIs to get the GPIO settings for your platform.
To export GPIOs to user space with the Kernel API
Implement the following code:
gpio_request(gpio); /* or gpio_request_one() or */
/* gpio_request_array(), as required */
gpio_export(gpio);
Where GPIO is the GPIO to be exported.