2024-04-23 13:11:21

by Claudiu

[permalink] [raw]
Subject: [PATCH] serial: sh-sci: Call device_set_wakeup_path() for serial console

From: Claudiu Beznea <[email protected]>

In case the SCI is used as a UART console, no_console_suspend is
available in bootargs and SCI is part of a software-controlled power
domain we need to call device_set_wakeup_path(). This lets the power
domain core code knows that this domain should not be powered off
durring system suspend. Otherwise, the SCI power domain is turned off,
nothing is printed while suspending and the suspend/resume process is
blocked. This was detected on the RZ/G3S SoC while adding support
for power domains.

Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/tty/serial/sh-sci.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 97031db26ae4..57a7f18e16e4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3441,8 +3441,12 @@ static __maybe_unused int sci_suspend(struct device *dev)
{
struct sci_port *sport = dev_get_drvdata(dev);

- if (sport)
+ if (sport) {
+ if (uart_console(&sport->port) && !console_suspend_enabled)
+ device_set_wakeup_path(dev);
+
uart_suspend_port(&sci_uart_driver, &sport->port);
+ }

return 0;
}
--
2.39.2