Skip to contentSkip to conversation

Add Sifive uart suspend and resume

PATCH Superseded Nick Hu 2 participants 6 messages Aug 9, 2023 – Aug 14, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Nick Hu

author
#0 lore raw

v2 cover Add Sifive uart suspend and resume

Add Sifive uart suspend and resume functions for system suspend.

Changes in v2:
- Change Signed-off-by: Ben Dooks to Reviewed-by: Ben Dooks
- Remove the unnecessary check

Nick Hu (1):
serial: sifive: Add suspend and resume operations

 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/1 serial: sifive: Add suspend and resume operations

If the Sifive Uart is not used as the wake up source, suspend the uart before the system enter the suspend state to prevent it woken up by unexpected uart interrupt. Resume the uart once the system woken up.

---
 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/tty/serial/sifive.c +18 -0
index a19db49327e2..939dd351a058 100644
@@ -1022,6 +1022,23 @@ static int sifive_serial_remove(struct platform_device *dev)
 	return 0;
 }
 
+static int sifive_serial_suspend(struct device *dev)
+{
+	struct sifive_serial_port *ssp = dev_get_drvdata(dev);
+
+	return uart_suspend_port(&sifive_serial_uart_driver, &ssp->port);
+}
+
+static int sifive_serial_resume(struct device *dev)
+{
+	struct sifive_serial_port *ssp = dev_get_drvdata(dev);
+
+	return uart_resume_port(&sifive_serial_uart_driver, &ssp->port);
+}
+
+DEFINE_SIMPLE_DEV_PM_OPS(sifive_uart_pm_ops, sifive_serial_suspend,
+			 sifive_serial_resume);
+
 static const struct of_device_id sifive_serial_of_match[] = {
 	{ .compatible = "sifive,fu540-c000-uart0" },
 	{ .compatible = "sifive,uart0" },
@@ -1034,6 +1051,7 @@ static struct platform_driver sifive_serial_platform_driver = {
 	.remove		= sifive_serial_remove,
 	.driver		= {
 		.name	= SIFIVE_SERIAL_NAME,
+		.pm = pm_sleep_ptr(&sifive_uart_pm_ops),
 		.of_match_table = of_match_ptr(sifive_serial_of_match),
 	},
 };
Signature · 1 line
2.34.1
maintainer
#2 lore raw
In reply to Nick Hu
Quoted 6 lines · Nick Hu

Add Sifive uart suspend and resume functions for system suspend.

Changes in v2:
- Change Signed-off-by: Ben Dooks to Reviewed-by: Ben Dooks
- Remove the unnecessary check

Quoted 9 lines

Nick Hu (1):
serial: sifive: Add suspend and resume operations

 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Signature · 1 line
2.34.1

Does not apply to my tree :(

author
#3 lore raw

Hi Greg

Quoted 11 lines · Greg KH
Quoted 9 lines · Nick Hu

Add Sifive uart suspend and resume functions for system suspend.

Changes in v2:
- Change Signed-off-by: Ben Dooks to Reviewed-by: Ben Dooks
- Remove the unnecessary check

Nick Hu (1):
serial: sifive: Add suspend and resume operations

Quoted 8 lines
Quoted 6 lines
 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--
2.34.1

Does not apply to my tree :(

Is there any reason that it doesn't apply to your tree? Which tree should I go?

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

maintainer
#4 lore raw
Quoted 17 lines · Nick Hu

Hi Greg

Quoted 14 lines · Greg KH
Quoted 12 lines · Nick Hu

Add Sifive uart suspend and resume functions for system suspend.

Changes in v2:
- Change Signed-off-by: Ben Dooks to Reviewed-by: Ben Dooks
- Remove the unnecessary check

Nick Hu (1):
serial: sifive: Add suspend and resume operations

 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

--
2.34.1

Does not apply to my tree :(

Is there any reason that it doesn't apply to your tree? Which tree should I go?

Which tree did you make it against? It doesn't apply due to conflicts. Perhaps either regenerate it against the tty-next branch of the tty.git tree, or linux-next?

thanks,

greg k-h

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#5 lore raw

Hi Greg

Quoted 27 lines · Greg KH
Quoted 17 lines · Nick Hu

Hi Greg

Quoted 14 lines · Greg KH
Quoted 12 lines · Nick Hu

Add Sifive uart suspend and resume functions for system suspend.

Changes in v2:
- Change Signed-off-by: Ben Dooks to Reviewed-by: Ben Dooks
- Remove the unnecessary check

Nick Hu (1):
serial: sifive: Add suspend and resume operations

 drivers/tty/serial/sifive.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

--
2.34.1

Does not apply to my tree :(

Is there any reason that it doesn't apply to your tree? Which tree should I go?

Quoted 7 lines

Which tree did you make it against? It doesn't apply due to conflicts. Perhaps either regenerate it against the tty-next branch of the tty.git tree, or linux-next?

thanks,

greg k-h

I'm using the mainline linux kernel.
Thanks for the information.
I can reproduce it in tty-next branch of the tty.git! I'll fix it in v3.

Regards,
Nick

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv