export gpio to user space via device tree

Hi everyone,

I tied to export the gpio, eg. GPIO1_CAM_PWR (pin F7) of TX2, to user space by claim it as a gpio node in hardware’s device tree, and then exported the port using gpio_request and gpio_export in its driver.

I already know how to export gpio to userspace via /sys/class/gpio. And it is work.I can pull it up and down.So how to expose GPIO node to user space through the device tree.

Thank you.

hello EthanY,

I would suggest you start from the kernel drivers,
please check the function calls of of_get_named_gpio in the sensor kernel driver for reference,