From 5a3e76dce9cd36d40a295d48c9c20f3264d152fd Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Fri, 14 Nov 2025 15:58:26 +0800 Subject: [PATCH] drivers: interrupt: pint: Add API to get pin used IRQ slot PINT connects GPIO pin to seperate IRQ slot. This info is hidden in PINT driver, there is no way to know which IRQ actually the GPIO pin is connected to. Add new API to get which IRQ slot is connected to, based on pin index. Signed-off-by: Jason Yu --- drivers/interrupt_controller/intc_nxp_pint.c | 16 ++++++++++++++++ .../drivers/interrupt_controller/nxp_pint.h | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/interrupt_controller/intc_nxp_pint.c b/drivers/interrupt_controller/intc_nxp_pint.c index 7ed5a8741c008..ad95e78b6a063 100644 --- a/drivers/interrupt_controller/intc_nxp_pint.c +++ b/drivers/interrupt_controller/intc_nxp_pint.c @@ -175,6 +175,22 @@ void nxp_pint_pin_unset_callback(uint8_t pin) pint_irq_cfg[slot].callback = NULL; } +int nxp_pint_pin_get_slot_index(uint8_t pin) +{ + int slot; + + if (pin > ARRAY_SIZE(pin_pint_id)) { + return -EINVAL; + } + + slot = pin_pint_id[pin]; + if (slot == NO_PINT_ID) { + return -EINVAL; + } + + return slot; +} + /* NXP PINT ISR handler- called with PINT slot ID */ static void nxp_pint_isr(uint8_t *slot) { diff --git a/include/zephyr/drivers/interrupt_controller/nxp_pint.h b/include/zephyr/drivers/interrupt_controller/nxp_pint.h index 6bf6d586d83e1..def135616641a 100644 --- a/include/zephyr/drivers/interrupt_controller/nxp_pint.h +++ b/include/zephyr/drivers/interrupt_controller/nxp_pint.h @@ -79,5 +79,12 @@ int nxp_pint_pin_set_callback(uint8_t pin, nxp_pint_cb_t cb, void *data); */ void nxp_pint_pin_unset_callback(uint8_t pin); +/** + * @brief Get PINT slot index the pin is allocated to + * + * @param pin: The pin to get the PINT slot index for + * @return The allocated slot index, if not allocated, return -EINVAL. + */ +int nxp_pint_pin_get_slot_index(uint8_t pin); #endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_NXP_PINT_H_ */