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

Enhance GPIO hogs for application control and shell commands #81238

Closed

Conversation

vishwamartur
Copy link

Related to #55617

Enhance the GPIO hogs driver to allow application control over GPIO configuration and add a shell command for managing GPIOs.

  • Add gpio_hogs_configure() function in drivers/gpio/gpio_hogs.c to allow application-controlled GPIO configuration.
  • Implement logic to filter GPIOs based on the provided port and mask in gpio_hogs_configure().
  • Modify gpio_hogs_init() in drivers/gpio/gpio_hogs.c to check the GPIO_HOGS_INITIALIZE_BY_APPLICATION Kconfig option.
  • Update shell commands in drivers/gpio/gpio_shell.c to use the line-names property for referencing GPIOs by their names.
  • Add tab completion for GPIO names in the shell commands in drivers/gpio/gpio_shell.c.
  • Add a new Kconfig option GPIO_HOGS_INITIALIZE_BY_APPLICATION in drivers/gpio/Kconfig to enable application-controlled GPIO initialization.

Related to zephyrproject-rtos#55617

Enhance the GPIO hogs driver to allow application control over GPIO configuration and add a shell command for managing GPIOs.

* Add `gpio_hogs_configure()` function in `drivers/gpio/gpio_hogs.c` to allow application-controlled GPIO configuration.
* Implement logic to filter GPIOs based on the provided port and mask in `gpio_hogs_configure()`.
* Modify `gpio_hogs_init()` in `drivers/gpio/gpio_hogs.c` to check the `GPIO_HOGS_INITIALIZE_BY_APPLICATION` Kconfig option.
* Update shell commands in `drivers/gpio/gpio_shell.c` to use the `line-names` property for referencing GPIOs by their names.
* Add tab completion for GPIO names in the shell commands in `drivers/gpio/gpio_shell.c`.
* Add a new Kconfig option `GPIO_HOGS_INITIALIZE_BY_APPLICATION` in `drivers/gpio/Kconfig` to enable application-controlled GPIO initialization.

Signed-off-by: Vishwanath Martur <[email protected]>
Copy link
Member

@henrikbrixandersen henrikbrixandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application-configured GPIO hogs are just... GPIOs. GPIO hogs are intended to be set at boot time, and shouldn't be controlled from the application.

For application-controlled GPIOs, you should introduce a hardware-specific devicetree binding, or use the zephyr,user node as described here: https://docs.zephyrproject.org/latest/build/dts/zephyr-user-node.html#gpios

@henrikbrixandersen
Copy link
Member

Closing as per comment #81238 (review)

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

Successfully merging this pull request may close these issues.

3 participants