0001-Revert-serial-8250_omap-Drop-pm_runtime_irq_safe.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. From cc255f5132cf39e9154340cf58780f8c763c6481 Mon Sep 17 00:00:00 2001
  2. From: Ross Burton <ross.burton@arm.com>
  3. Date: Thu, 23 Jan 2025 17:06:08 +0000
  4. Subject: [PATCH] Revert "serial: 8250_omap: Drop pm_runtime_irq_safe()"
  5. This reverts commit 8700a7ea5519fb0b3bad2362adfeac358c2119ce.
  6. Upstream-Status: Inappropriate
  7. Signed-off-by: Ross Burton <ross.burton@arm.com>
  8. ---
  9. drivers/tty/serial/8250/8250_omap.c | 29 ++++++++---------------------
  10. 1 file changed, 8 insertions(+), 21 deletions(-)
  11. diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
  12. index 0dd68bdbfbcf7..db24d7d1dcb67 100644
  13. --- a/drivers/tty/serial/8250/8250_omap.c
  14. +++ b/drivers/tty/serial/8250/8250_omap.c
  15. @@ -8,7 +8,6 @@
  16. *
  17. */
  18. -#include <linux/atomic.h>
  19. #include <linux/clk.h>
  20. #include <linux/device.h>
  21. #include <linux/io.h>
  22. @@ -134,7 +133,6 @@ struct omap8250_priv {
  23. u8 tx_trigger;
  24. u8 rx_trigger;
  25. - atomic_t active;
  26. bool is_suspending;
  27. int wakeirq;
  28. u32 latency;
  29. @@ -636,23 +634,14 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
  30. unsigned int iir, lsr;
  31. int ret;
  32. - pm_runtime_get_noresume(port->dev);
  33. -
  34. - /* Shallow idle state wake-up to an IO interrupt? */
  35. - if (atomic_add_unless(&priv->active, 1, 1)) {
  36. - priv->latency = priv->calc_latency;
  37. - schedule_work(&priv->qos_work);
  38. - }
  39. -
  40. #ifdef CONFIG_SERIAL_8250_DMA
  41. if (up->dma) {
  42. ret = omap_8250_dma_handle_irq(port);
  43. - pm_runtime_mark_last_busy(port->dev);
  44. - pm_runtime_put(port->dev);
  45. return IRQ_RETVAL(ret);
  46. }
  47. #endif
  48. + serial8250_rpm_get(up);
  49. lsr = serial_port_in(port, UART_LSR);
  50. iir = serial_port_in(port, UART_IIR);
  51. ret = serial8250_handle_irq(port, iir);
  52. @@ -701,8 +690,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
  53. schedule_delayed_work(&up->overrun_backoff, delay);
  54. }
  55. - pm_runtime_mark_last_busy(port->dev);
  56. - pm_runtime_put(port->dev);
  57. + serial8250_rpm_put(up);
  58. return IRQ_RETVAL(ret);
  59. }
  60. @@ -1314,8 +1302,11 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
  61. u16 status;
  62. u8 iir;
  63. + serial8250_rpm_get(up);
  64. +
  65. iir = serial_port_in(port, UART_IIR);
  66. if (iir & UART_IIR_NO_INT) {
  67. + serial8250_rpm_put(up);
  68. return IRQ_HANDLED;
  69. }
  70. @@ -1348,6 +1339,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
  71. uart_unlock_and_check_sysrq(port);
  72. + serial8250_rpm_put(up);
  73. return 1;
  74. }
  75. @@ -1539,6 +1531,8 @@ static int omap8250_probe(struct platform_device *pdev)
  76. if (!of_get_available_child_count(pdev->dev.of_node))
  77. pm_runtime_set_autosuspend_delay(&pdev->dev, -1);
  78. + pm_runtime_irq_safe(&pdev->dev);
  79. +
  80. pm_runtime_get_sync(&pdev->dev);
  81. omap_serial_fill_features_erratas(&up, priv);
  82. @@ -1776,7 +1770,6 @@ static int omap8250_runtime_suspend(struct device *dev)
  83. priv->latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE;
  84. schedule_work(&priv->qos_work);
  85. - atomic_set(&priv->active, 0);
  86. return 0;
  87. }
  88. @@ -1786,10 +1779,6 @@ static int omap8250_runtime_resume(struct device *dev)
  89. struct omap8250_priv *priv = dev_get_drvdata(dev);
  90. struct uart_8250_port *up = NULL;
  91. - /* Did the hardware wake to a device IO interrupt before a wakeirq? */
  92. - if (atomic_read(&priv->active))
  93. - return 0;
  94. -
  95. if (priv->line >= 0)
  96. up = serial8250_get_port(priv->line);
  97. @@ -1805,10 +1794,8 @@ static int omap8250_runtime_resume(struct device *dev)
  98. uart_port_unlock_irq(&up->port);
  99. }
  100. - atomic_set(&priv->active, 1);
  101. priv->latency = priv->calc_latency;
  102. schedule_work(&priv->qos_work);
  103. -
  104. return 0;
  105. }
  106. --
  107. 2.43.0