Gpiod_ * vs gpio_ * in the Linux kernel

Which GPIO API is preferable in programming a Linux device driver, and under what conditions: gpio_set_value()or gpiod_set_value()?

One accepts GPIO desc as an object, while the other accepts GPIO, which is processed from the device tree.

+4
source share
1 answer

For all new drivers, it is recommended to use the gpiod_*API. The old API gpio_*is deprecated.

From this commit:

gpiolib: GPIO interface based on export descriptor

API- gpiod_*, GPIO. gpiod API gpio:

  • gpio , gpiod ,
  • gpiod get/set GPIO
  • gpio <linux/gpio/consumer.h> , <linux/gpio/driver.h>

API gpio gpiod.

gpiod API:

+7

Source: https://habr.com/ru/post/1652198/


All Articles