Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed GPIOs for high-level drivers #11937

Open
tobiasjaster opened this issue Mar 18, 2024 · 1 comment
Open

Mixed GPIOs for high-level drivers #11937

tobiasjaster opened this issue Mar 18, 2024 · 1 comment

Comments

@tobiasjaster
Copy link

Hello,
I would like to write a service driver for an LCD display. My hardware is designed so that most of the GPIOs are internal. However, due to many other peripheral devices, additional GPIO expanders could not be avoided. The LCD is therefore connected to an expander for the reset line and a less important line. Unlike Linux via systfs, internal and external GPIOs cannot be abstracted together as far as I know, which is why I cannot write my driver in a generalised way. So I can either use the ioexpander interface or the gpio interface, right?

I have tried to provide the GPIOs of my STM32F4 via ioexpander, which works in principle, but is certainly not intended that way.

Does it make sense to include something in nuttx that provides a similar abstraction as the systfs in Linux?

If this possibility already exists, I would be very pleased about corresponding references.

Tobias

@acassis
Copy link
Contributor

acassis commented Mar 18, 2024

Hi @tobiasjaster I think you found a common issue that many people face when trying to write generic drivers using external GPIO on NuttX. Actually since Linux kernel 4.7/4.8 the GPIO export over /sysfs was replaces with something called gpiolib that exports GPIOs as char devices, similar to NuttX DEV_GPIO:

https://microhobby.com.br/blog/2020/02/02/new-linux-kernel-5-5-new-interfaces-in-gpiolib/
https://blog.lxsang.me/post/id/33

Yes, something similar to gpiolib should be useful to keep NuttX more compatible with Linux and also fix this asymmetry when using internal GPIO vs external GPIO (via ioexpander).

@xiaoxiang781216 do you already implemented something similar to it? I think it is important to verify because otherwise @tobiasjaster could spend time on something that already exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants