Skip to content

Commit 2e31ca7

Browse files
committed
drivers: serial: Implement serial wrapper to add DTR
This driver wraps an existing UART device and adds DTR (Data Terminal Ready) GPIO output for a runtime power management. When the UART is powered off, DTR is deasserted. When the UART is powered on, DTR is asserted. This allows remote end to shut down the UART when DTR is deasserted. Signed-off-by: Seppo Takalo <[email protected]>
1 parent 59d4d9d commit 2e31ca7

File tree

5 files changed

+542
-0
lines changed

5 files changed

+542
-0
lines changed

drivers/serial/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ zephyr_library_sources_ifdef(CONFIG_UART_CC23X0 uart_cc23x0.c)
3232
zephyr_library_sources_ifdef(CONFIG_UART_CC32XX uart_cc32xx.c)
3333
zephyr_library_sources_ifdef(CONFIG_UART_CDNS uart_cdns.c)
3434
zephyr_library_sources_ifdef(CONFIG_UART_CMSDK_APB uart_cmsdk_apb.c)
35+
zephyr_library_sources_ifdef(CONFIG_UART_DTR uart_dtr.c)
3536
zephyr_library_sources_ifdef(CONFIG_UART_EFINIX_SAPPIHIRE uart_efinix_sapphire.c)
3637
zephyr_library_sources_ifdef(CONFIG_UART_EMUL uart_emul.c)
3738
zephyr_library_sources_ifdef(CONFIG_UART_ENE_KB106X uart_ene_kb106x.c)

drivers/serial/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ rsource "Kconfig.cc23x0"
173173
rsource "Kconfig.cc32xx"
174174
rsource "Kconfig.cdns"
175175
rsource "Kconfig.cmsdk_apb"
176+
rsource "Kconfig.dtr"
176177
rsource "Kconfig.efinix_sapphire"
177178
rsource "Kconfig.emul"
178179
rsource "Kconfig.ene"

drivers/serial/Kconfig.dtr

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# DTR wrapper UART configuration options
2+
3+
# Copyright (c) 2025 Nordic Semiconductor ASA
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config UART_DTR
7+
bool "UART DTR wrapper driver"
8+
default y
9+
depends on DT_HAS_ZEPHYR_UART_DTR_ENABLED
10+
depends on GPIO
11+
depends on PM_DEVICE_RUNTIME
12+
help
13+
Enable UART DTR wrapper driver. This driver wraps an existing UART
14+
device and adds DTR (Data Terminal Ready) functionality for runtime
15+
power management. When UART is powered, the DTR signal is asserted,
16+
and when the UART is powered down, the DTR signal is de-asserted.
17+
The driver acts as a child node of the actual UART.
18+
19+
config UART_DTR_INIT_PRIORITY
20+
int "UART DTR driver init priority"
21+
default 60
22+
depends on UART_DTR
23+
help
24+
UART DTR wrapper driver initialization priority. This should be
25+
higher than the underlying UART driver but lower than devices
26+
that depend on it. Generally set higher than CONFIG_UART_INIT_PRIORITY.

0 commit comments

Comments
 (0)