From 2594eae6f13e93c442221501dda593e2b297c344 Mon Sep 17 00:00:00 2001 From: Martin Hoff Date: Fri, 31 Jan 2025 16:57:41 +0100 Subject: [PATCH] drivers: uart: silabs: revert pm deletion for usart_gecko Revert delete of the uart_gecko_pm_action function. Signed-off-by: Martin Hoff --- drivers/serial/uart_gecko.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index 21b2ab21667..bbf7eb007bc 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -669,6 +669,31 @@ static int uart_gecko_init(const struct device *dev) return 0; } +#ifdef CONFIG_PM_DEVICE +static int uart_gecko_pm_action(const struct device *dev, enum pm_device_action action) +{ + __maybe_unused const struct uart_gecko_config *config = dev->config; + + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: +#ifdef USART_STATUS_TXIDLE + /* Wait for TX FIFO to flush before suspending */ + while (!(USART_StatusGet(config->base) & USART_STATUS_TXIDLE)) { + } +#endif + break; + + case PM_DEVICE_ACTION_RESUME: + break; + + default: + return -ENOTSUP; + } + + return 0; +} +#endif + static DEVICE_API(uart, uart_gecko_driver_api) = { .poll_in = uart_gecko_poll_in, .poll_out = uart_gecko_poll_out,