ioexpander/gpio driver device names

2021-10-27 Thread Jari van Ewijk
Hi all,

I am currently working with the ioexpander/gpio driver to control GPIO pins 
from an application. I am wondering if anybody is using this interface for more 
practical applications than toggling a pin from the command line (i.e. 
apps/examples/gpio).
I would say the interface is simple but effective. It can read and set pin 
values and pintypes can be changed. That's all I need.

However, I am wondering about the naming of the devices. Pins are registered as 
/dev/gpinN, /dev/gpoutN, or /dev/gpintN (where N is a integer number, of 
course) depending on their pintype.
Now, there is a SETPINTYPE command, which you can use to change pintypes. So 
that means an output pin initially registered as /dev/gpout0 could be changed 
to be an input pin, with it keeping the same name.

Wouldn't it make more sense to register ALL pins as generic /dev/gpioN instead 
of the specific /dev/gpinN, /dev/gpoutN, /dev/gpintN? Maybe there's a good 
reason to keep these distinct names, but it is also really confusing when pin 
types start to change.

Best regards,
Jari van Ewijk


Re: ioexpander/gpio driver device names

2021-10-27 Thread Alan Carvalho de Assis
Hi Jari,

I agree! Also in the Linux its name is just gpioN inside /sys.

But this modification will involve many boards modifications and also
the error message will need to give more details explaining that the
user cannot use that pin as input because it is configured to output
and vice-versa. Also an input without interruption support needs to be
handled correctly case someone try to wait for a signal event on the
gpio.

BR,

Alan

On 10/27/21, Jari van Ewijk  wrote:
> Hi all,
>
> I am currently working with the ioexpander/gpio driver to control GPIO pins
> from an application. I am wondering if anybody is using this interface for
> more practical applications than toggling a pin from the command line (i.e.
> apps/examples/gpio).
> I would say the interface is simple but effective. It can read and set pin
> values and pintypes can be changed. That's all I need.
>
> However, I am wondering about the naming of the devices. Pins are registered
> as /dev/gpinN, /dev/gpoutN, or /dev/gpintN (where N is a integer number, of
> course) depending on their pintype.
> Now, there is a SETPINTYPE command, which you can use to change pintypes. So
> that means an output pin initially registered as /dev/gpout0 could be
> changed to be an input pin, with it keeping the same name.
>
> Wouldn't it make more sense to register ALL pins as generic /dev/gpioN
> instead of the specific /dev/gpinN, /dev/gpoutN, /dev/gpintN? Maybe there's
> a good reason to keep these distinct names, but it is also really confusing
> when pin types start to change.
>
> Best regards,
> Jari van Ewijk
>