Skip to content

Commit a582e25

Browse files
committed
drivers: serial: uart_nrfx_uarte: Avoid incorrect UARTE disable when using runtime PM
When CONFIG_PM_DEVICE_RUNTIME is enabled, the code can incorrectly call nrf_uarte_disable() after TXSTOPPED, even though runtime power management is supposed to handle disabling the UARTE. This happens if the UARTE_FLAG_POLL_OUT flag is not set — in that case, the call to pm_device_runtime_put() is skipped, and nrf_uarte_disable() is called directly instead, which isn't correct when runtime PM is active. This fix prevents nrf_uarte_disable() from being called in this scenario, so that the UARTE is only disabled by the PM system when appropriate. Signed-off-by: Vivek Sahi <[email protected]>
1 parent ca954a6 commit a582e25

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,11 @@ static void uarte_nrfx_isr_int(const void *arg)
353353
if (txstopped && (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(config))) {
354354
unsigned int key = irq_lock();
355355

356-
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) &&
357-
(data->flags & UARTE_FLAG_POLL_OUT)) {
358-
data->flags &= ~UARTE_FLAG_POLL_OUT;
359-
pm_device_runtime_put(dev);
356+
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
357+
if (data->flags & UARTE_FLAG_POLL_OUT) {
358+
data->flags &= ~UARTE_FLAG_POLL_OUT;
359+
pm_device_runtime_put(dev);
360+
}
360361
} else {
361362
nrf_uarte_disable(uarte);
362363
}

0 commit comments

Comments
 (0)