Skip to content

gpio: add wakeup source support #78011

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

Conversation

RomainPelletant
Copy link
Contributor

  • Update GPIO API with wakeup source read function
  • Update GPIO Kconfig to add experimental support
  • Add a sample with silabs gecko implementation

Fixes #74272

- Update GPIO API with wakeup source read function
- Update GPIO Kconfig to add experimental support
- Add a sample with silabs gecko implementation

Fixes zephyrproject-rtos#74272

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
@bjarki-andreasen
Copy link
Collaborator

bjarki-andreasen commented Sep 5, 2024

Have you considered the existing function gpio_get_pending_int()? This is intended to be used to check if any interrupt is pending, which matches the GPIO_INT_WAKEUP trigger used to configure the GPIO wakeup.

The function you are adding here does have an additional feature, being that it can return a mask of which specific GPIO/GPIOs triggered the interrupt, which I think could be a useful addition. I would agree with adding a new API (which would deprecate gpio_get_pending_int()) which provides an optional pin mask argument:

int gpio_get_pending_interrupts(const struct device *dev, gpio_port_pins_t *mask);

Notice the shift away from including wakeup_source in the API, since this can be used for any interrupts, whatever their trigger. Also using the gpio_port_pins_t for the mask instead of uint32_t

Do note that many GPIO controller's don't store which pin triggered a wakeup interrupt, only which port, so the mask argument has to be optional, as in, if the mask arg it is not NULL, and the GPIO controller can't specify the actual pin that has triggered the interrupt, the API should return -EINVAL or something :)

@RomainPelletant
Copy link
Contributor Author

@bjarki-andreasen you are right. Support for EM4 is specific to current sleep mode: I am thinking about how could we manage that.
Thanks for your message

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Dec 21, 2024
@github-actions github-actions bot closed this Jan 5, 2025
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.

Wakeup source API in hwinfo
4 participants