diff --git a/drivers/interrupt_controller/intc_nxp_pint.c b/drivers/interrupt_controller/intc_nxp_pint.c index 2a11fd7ad45..f794a0a2979 100644 --- a/drivers/interrupt_controller/intc_nxp_pint.c +++ b/drivers/interrupt_controller/intc_nxp_pint.c @@ -12,7 +12,8 @@ #include #include -#include + +#include "intc_nxp_pint/power.h" #define DT_DRV_COMPAT nxp_pint @@ -94,14 +95,8 @@ int nxp_pint_pin_enable(uint8_t pin, enum nxp_pint_trigger trigger, bool wake) * 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); - irq_enable(pint_irq_cfg[slot].irq); - } -#endif + nxp_pint_pin_deep_sleep_irq(pint_irq_cfg[slot].irq, wake); + return 0; } diff --git a/drivers/interrupt_controller/intc_nxp_pint/power.h b/drivers/interrupt_controller/intc_nxp_pint/power.h new file mode 100644 index 00000000000..0be24a5c6d0 --- /dev/null +++ b/drivers/interrupt_controller/intc_nxp_pint/power.h @@ -0,0 +1,39 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This file abstracts operations exposed by fsl_power.h from NXP HAL, + * for cases when that driver can't be compiled (DSP targets). + */ + +#ifndef __ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_NXP_PINT_POWER_H__ +#define __ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_NXP_PINT_POWER_H__ + +#include +#include +#include + +#if defined(FSL_FEATURE_SOC_PMC_COUNT) && FSL_FEATURE_SOC_PMC_COUNT > 0 +#include +#endif + +static inline void nxp_pint_pin_deep_sleep_irq(uint8_t irq, bool wake) +{ +#if (defined(FSL_FEATURE_SOC_PMC_COUNT) && FSL_FEATURE_SOC_PMC_COUNT > 0) && \ + !(defined(FSL_FEATURE_POWERLIB_EXTEND) && (FSL_FEATURE_POWERLIB_EXTEND != 0)) + if (wake) { + EnableDeepSleepIRQ(irq); + } else { + DisableDeepSleepIRQ(irq); + irq_enable(irq); + } +#else + ARG_UNUSED(irq); + ARG_UNUSED(wake); +#endif +} + +#endif