drivers: gpio: Update NXP LPC GPIO driver to enable wakeup
Process the GPIO_INT_WAKEUP flag and set appropraite bits in the SoC to wakeup the system from deep sleep mode. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
21e9918260
commit
94540a9dee
3 changed files with 15 additions and 3 deletions
|
|
@ -260,7 +260,7 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
|
|||
}
|
||||
|
||||
/* PINT treats GPIO pins as continuous. Each port has 32 pins */
|
||||
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode);
|
||||
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, (trig & GPIO_INT_WAKEUP));
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <zephyr/drivers/interrupt_controller/nxp_pint.h>
|
||||
|
||||
#include <fsl_inputmux.h>
|
||||
#include <fsl_power.h>
|
||||
|
||||
#define DT_DRV_COMPAT nxp_pint
|
||||
|
||||
|
|
@ -23,6 +24,7 @@ struct pint_irq_slot {
|
|||
void *user_data;
|
||||
uint8_t pin: 6;
|
||||
uint8_t used: 1;
|
||||
uint8_t irq;
|
||||
};
|
||||
|
||||
#define NO_PINT_ID 0xFF
|
||||
|
|
@ -58,9 +60,10 @@ static void attach_pin_to_pint(uint8_t pin, uint8_t pint_slot)
|
|||
* @param pin: pin to use as interrupt source
|
||||
* 0-64, corresponding to GPIO0 pin 1 - GPIO1 pin 31)
|
||||
* @param trigger: one of nxp_pint_trigger flags
|
||||
* @param wake: indicates if the pin should wakeup the system
|
||||
* @return 0 on success, or negative value on error
|
||||
*/
|
||||
int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger)
|
||||
int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger, bool wake)
|
||||
{
|
||||
uint8_t slot = 0U;
|
||||
|
||||
|
|
@ -91,6 +94,13 @@ int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger)
|
|||
* driver handles the IRQ
|
||||
*/
|
||||
PINT_PinInterruptConfig(pint_base, slot, trigger, NULL);
|
||||
#if !(defined(FSL_FEATURE_POWERLIB_EXTEND) && (FSL_FEATURE_POWERLIB_EXTEND != 0))
|
||||
if (wake) {
|
||||
EnableDeepSleepIRQ(pint_irq_cfg[slot].irq);
|
||||
} else {
|
||||
DisableDeepSleepIRQ(pint_irq_cfg[slot].irq);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -184,6 +194,7 @@ static void nxp_pint_isr(uint8_t *slot)
|
|||
DT_IRQ_BY_IDX(node_id, idx, priority), \
|
||||
nxp_pint_isr, &nxp_pint_idx_##idx, 0); \
|
||||
irq_enable(DT_IRQ_BY_IDX(node_id, idx, irq)); \
|
||||
pint_irq_cfg[idx].irq = DT_IRQ_BY_IDX(node_id, idx, irq); \
|
||||
} while (false)))
|
||||
|
||||
static int intc_nxp_pint_init(const struct device *dev)
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ typedef void (*nxp_pint_cb_t) (uint8_t pin, void *user);
|
|||
* @param pin: pin to use as interrupt source
|
||||
* 0-64, corresponding to GPIO0 pin 1 - GPIO1 pin 31)
|
||||
* @param trigger: one of nxp_pint_trigger flags
|
||||
* @param wake: indicates if the pin should wakeup the system
|
||||
*/
|
||||
int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger);
|
||||
int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger, bool wake);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue