Skip to content

Commit e960979

Browse files
committed
drivers: serial: Implement serial wrapper to add DTR
This driver wraps an existing UART device and adds DTR (Data Terminal Ready) functionality for 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 376ca57 commit e960979

File tree

5 files changed

+561
-0
lines changed

5 files changed

+561
-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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
help
12+
Enable UART DTR wrapper driver. This driver wraps an existing UART
13+
device and adds DTR (Data Terminal Ready) functionality for runtime
14+
power management. When DTR is asserted, the underlying UART is
15+
powered on. When DTR is deasserted, the UART is powered off.
16+
17+
The driver acts as a child node of the UART it controls and provides
18+
full UART API compatibility while managing the parent device's power
19+
state through a GPIO-controlled DTR signal.
20+
21+
config UART_DTR_INIT_PRIORITY
22+
int "UART DTR driver init priority"
23+
default 60
24+
depends on UART_DTR
25+
help
26+
UART DTR wrapper driver initialization priority. This should be
27+
higher than the underlying UART driver but lower than devices
28+
that depend on it. Generally set higher than CONFIG_UART_INIT_PRIORITY.

0 commit comments

Comments
 (0)