-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Possibility to define pinmux item for Pin Control as a plain input/output #42530
Comments
How are you planning to control the pins when in "GPIO mode"? pinctrl API only allows to set states, but doesn't offer gpio-like access. I'd also like to understand the use-case. |
The idea is to switch between different pin control states (pinmux setups) to achive functionality required for specific device driver mode. |
This is already possible, and one can implement arbitrary custom states.
Note that states are self-contained, so each state contains all pin configuration parameters. You can't define a state that just configures pull-up.
This is already possible, maybe some platforms haven't enabled the capability yet, though. zephyrproject-rtos/hal_stm32#126 |
In fact I need not only add pull-up but I need to reconfigure pinmux for pin - from alternate (special) function to I/O function.
For my platform I found only |
Then, what is the purpose of moving to I/O if pin can't be controlled with pinctrl API? I still fail to see the use case here. One case could be I2C recover, but you'd still need to define
Available pin configuration parameters is really vendor-specific, the pinctrl bindings are the best source of truth right now. |
Supposing that I will use GPIO API flow for described case can be like this:
It looks to be not a big deal, but I need do define each pin in two separate places in DT using different syntax and in case of change in module logic I need to synchronize code changes for 2 different APIs. I understand that some design principles limits functions scope for single module for a good reason but in this case Pin Control is supposed not to drive pin level or something like that but just change pin mode. BTW> Thanks for you quick and patient responses. |
For this workflow, you don't need GPIO API, you can use pinctrl. The only thing you'll need is support from your vendor so that their pinctrl driver allows configuring a pin as regular GPIO IN/OUT (for STM32 you're now allowed to use AF/ANALOG modes only). I'm still curious on why you require |
Hmm... I am a little confused now. |
I guess the first step is to define the use-case, I still haven't been able to understand why this is required. A concrete example would help. |
My use case: |
First I'd check if enabling pull-ups/downs is sufficient while still holding the |
@r2r0 I had a look to what was supported on STM32 Linux pinctrl bindings and could likely be implemented in Zephyr as well (I still need to confirm this), something as follow:
By default, state would be input. To drive the line, additional boolean properties |
@erwango Yes, it looks that it will solve my case(s). |
Is this possible for analog mux on nRF52 chips? (e.g. CD74HC4067 /w nRF52840) |
Is your enhancement proposal related to a problem? Please describe.
My device driver uses pins which need to switch between different pin functions which seems to be perfectly suited job for Pin Control API, but I cannot find a way to switch pin between special function (i.e., UART TX ) and "simple" GPIO function (i.e., input with pull-up).
Unfortunately, it looks that Pin Control API allows only to switch between special pin functions which make it usable only in a very limited way for the cases like described above.
Describe the solution you'd like
pinmux
nodes used to definepinctrl-N
nodes should also accept configuration as normal GPIO pins i.e.,GPIO_INPUT | GPIO_PULL_UP
.Describe alternatives you've considered
GPIO API does not offer configuration options for special pin functions, so this kind of function change can be only achieved using SOC specific low-level functions.
Additional context
My platform is STM32WB.
The text was updated successfully, but these errors were encountered: