Re: [PATCH v2] gpio: Allow setting gpio device id via device tree alias

From: Linus Walleij
Date: Sun Mar 27 2022 - 19:07:42 EST


On Tue, Mar 22, 2022 at 11:16 AM Bough Chen <haibo.chen@xxxxxxx> wrote:

> For users, usually, they will open /dev/gpiochipx to handle gpio related option.

That makes sense, it is intuitive in a way.

> By the way, how can user get the labels and device names of GPIO chips?

The way to get metadata for any /dev/* device such as topology on
buses is through sysfs.

It is also possible to get labels for all gpiochips by iterating over them.

The most user-friendly thing to do is however to make use of libgpiod
and associated example tools such as gpiodetect:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/

Yours,
Linus Walleij