Skip to content

Commit dcad2e0

Browse files
mmahadevan108kartben
authored andcommitted
drivers: nxp_pint: Add power handlers for the NXP PINT driver
This is needed to restore state on wakeup from certain low power modes. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
1 parent b694af6 commit dcad2e0

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

drivers/interrupt_controller/intc_nxp_pint.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <zephyr/irq.h>
1111
#include <errno.h>
1212
#include <zephyr/drivers/interrupt_controller/nxp_pint.h>
13+
#include <zephyr/pm/device.h>
1314

1415
#include <fsl_inputmux.h>
1516

@@ -180,6 +181,24 @@ static void nxp_pint_isr(uint8_t *slot)
180181
}
181182
}
182183

184+
static int intc_nxp_pm_action(const struct device *dev, enum pm_device_action action)
185+
{
186+
switch (action) {
187+
case PM_DEVICE_ACTION_RESUME:
188+
break;
189+
case PM_DEVICE_ACTION_SUSPEND:
190+
break;
191+
case PM_DEVICE_ACTION_TURN_OFF:
192+
break;
193+
case PM_DEVICE_ACTION_TURN_ON:
194+
PINT_Init(pint_base);
195+
break;
196+
default:
197+
return -ENOTSUP;
198+
}
199+
200+
return 0;
201+
}
183202

184203
/* Defines PINT IRQ handler for a given irq index */
185204
#define NXP_PINT_IRQ(idx, node_id) \
@@ -200,10 +219,12 @@ static int intc_nxp_pint_init(const struct device *dev)
200219
* parameter.
201220
*/
202221
LISTIFY(8, NXP_PINT_IRQ, (;), DT_INST(0, DT_DRV_COMPAT));
203-
PINT_Init(pint_base);
204222
memset(pin_pint_id, NO_PINT_ID, ARRAY_SIZE(pin_pint_id));
205-
return 0;
223+
224+
return pm_device_driver_init(dev, intc_nxp_pm_action);
206225
}
207226

208-
DEVICE_DT_INST_DEFINE(0, intc_nxp_pint_init, NULL, NULL, NULL,
227+
PM_DEVICE_DT_INST_DEFINE(0, intc_nxp_pm_action);
228+
229+
DEVICE_DT_INST_DEFINE(0, intc_nxp_pint_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL,
209230
PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL);

dts/arm/nxp/nxp_rw6xx_common.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@
328328
<35 2>, <36 2>, <37 2>, <38 2>;
329329
num-lines = <8>;
330330
num-inputs = <64>;
331+
power-domains = <&power_mode3_domain>;
331332
};
332333

333334
imu: nxp_wifi {

0 commit comments

Comments
 (0)