soc: nxp_rw6xx: Add code to fire the GPIO callback
Call the API provided to fire a GPIO interrupt if registered on wakeup from PM Mode 3. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
0cd23dc5b7
commit
8a3dc68996
1 changed files with 24 additions and 0 deletions
|
@ -7,6 +7,10 @@
|
|||
#include <zephyr/pm/pm.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#if CONFIG_GPIO && (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || \
|
||||
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)))
|
||||
#include <zephyr/drivers/gpio/gpio_mcux_lpc.h>
|
||||
#endif
|
||||
|
||||
#include "fsl_power.h"
|
||||
|
||||
|
@ -34,6 +38,9 @@ power_sleep_config_t slp_cfg;
|
|||
|
||||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1))
|
||||
pinctrl_soc_pin_t pin_cfg;
|
||||
#if CONFIG_GPIO
|
||||
const struct device *gpio;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0))
|
||||
|
@ -206,6 +213,15 @@ __weak void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
|
|||
ARG_UNUSED(state);
|
||||
ARG_UNUSED(substate_id);
|
||||
|
||||
#if CONFIG_GPIO && (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || \
|
||||
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)))
|
||||
if (state == PM_STATE_STANDBY) {
|
||||
/* GPIO_0_24 & GPIO_0_25 are used for wakeup */
|
||||
uint32_t pins = PMU->WAKEUP_STATUS &
|
||||
(PMU_WAKEUP_STATUS_PIN0_MASK | PMU_WAKEUP_STATUS_PIN1_MASK);
|
||||
gpio_mcux_lpc_trigger_cb(gpio, (pins << 24));
|
||||
}
|
||||
#endif
|
||||
/* Clear PRIMASK */
|
||||
__enable_irq();
|
||||
}
|
||||
|
@ -247,4 +263,12 @@ void nxp_rw6xx_power_init(void)
|
|||
/* Clear the RTC wakeup bits */
|
||||
POWER_ClearWakeupStatus(DT_IRQN(DT_NODELABEL(rtc)));
|
||||
POWER_DisableWakeup(DT_IRQN(DT_NODELABEL(rtc)));
|
||||
|
||||
#if CONFIG_GPIO && (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || \
|
||||
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)))
|
||||
gpio = DEVICE_DT_GET(DT_NODELABEL(hsgpio0));
|
||||
if (!device_is_ready(gpio)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue