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

gpio: add wakeup source support #78011

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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

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