0006-surface-sam.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From b81f708b2a9b753fbd5f785be2a30c71befec1a9 Mon Sep 17 00:00:00 2001
  2. From: Maximilian Luz <luzmaximilian@gmail.com>
  3. Date: Tue, 3 Oct 2023 02:15:04 +0200
  4. Subject: [PATCH] wip! serial: core: Disable runtime-suspend by default
  5. Commit 84a9582fd203 ("serial: core: Start managing serial controllers to
  6. enable runtime PM"), broke suspend on various Microsoft Surface devices.
  7. In particular, devices with the Surface Aggregator Module (SAM) EC
  8. connected via the Surface Serial Hub (SSH), a UART device.
  9. The core issue is that any UART communication is blocked when the UART
  10. port is in runtime suspend. Data sent during that time will be cached
  11. and transferred only after the device has been runtime-resumed.
  12. Unfortunately, any runtime PM transitions are blocked right before
  13. entering normal suspend and only unblocked after resuming. This means,
  14. that if we enter normal suspend when the port is runtime suspended, any
  15. communication will be blocked until the device resumes.
  16. Unfortunately, however, we need to tell the SAM EC when we are
  17. suspending and resuming to quiesce / re-enable events, turn off the
  18. keyboard backlight, and transition it to a lower power mode. This is
  19. currently done in prepare()/complete() and suspend()/resume(). With the
  20. commit mentioned above, these operations now time out, causing suspend
  21. to fail.
  22. As a temporary workaround: Disable runtime PM on the UART ports.
  23. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
  24. Patchset: surface-sam
  25. ---
  26. drivers/tty/serial/serial_port.c | 2 ++
  27. 1 file changed, 2 insertions(+)
  28. diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c
  29. index 862423237007..6ceacea5e790 100644
  30. --- a/drivers/tty/serial/serial_port.c
  31. +++ b/drivers/tty/serial/serial_port.c
  32. @@ -55,6 +55,8 @@ static int serial_port_probe(struct device *dev)
  33. pm_runtime_set_autosuspend_delay(dev, SERIAL_PORT_AUTOSUSPEND_DELAY_MS);
  34. pm_runtime_use_autosuspend(dev);
  35. + pm_runtime_forbid(dev);
  36. +
  37. return 0;
  38. }
  39. --
  40. 2.42.0