linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support
@ 2024-08-07 14:12 Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property Markus Schneider-Pargmann
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

Hi,

v2
--

In Version 2 I removed the Partial-IO specific patches as these can't be
tested due to power issues in Partial-IO on am62-lp-sk and similar
boards.

I added a patch to add DT 'wakeup-source' support.

Series
------

To support wakeup from several low power modes on am62, don't always
enable device wakeup. Instead only set it to wakeup capable. A
devicetree property 'wakeup-source' can be used to enable wakeup. The
user is also able to control if wakeup is enabled through sysfs.

Base
----
v6.11-rc1

Tests
-----
I tested these patches on am62-lp-sk.

Previous versions
-----------------
v1: https://lore.kernel.org/lkml/20240523075819.1285554-1-msp@baylibre.com/

Changes in v2
-------------
 - Remove Partial-IO patches
 - Replace device_init_wakeup with device_set_wakeup_capable in
   omap8250_remove as well

Best,
Markus

Markus Schneider-Pargmann (5):
  dt-bindings: serial: 8250_omap: Add wakeup-source property
  serial: 8250: omap: Remove unused wakeups_enabled
  serial: 8250: omap: Cleanup on error in request_irq
  serial: 8250: omap: Set wakeup capable, do not enable
  serial: 8250: omap: Parse DT wakeup-source proerty

 .../devicetree/bindings/serial/8250_omap.yaml          |  1 +
 drivers/tty/serial/8250/8250_omap.c                    | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
@ 2024-08-07 14:12 ` Markus Schneider-Pargmann
  2024-08-07 16:31   ` Conor Dooley
  2024-08-07 14:12 ` [PATCH v2 2/5] serial: 8250: omap: Remove unused wakeups_enabled Markus Schneider-Pargmann
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

Add the wakeup-source to enable this device as a wakeup source if
defined in DT.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
 Documentation/devicetree/bindings/serial/8250_omap.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/serial/8250_omap.yaml b/Documentation/devicetree/bindings/serial/8250_omap.yaml
index 6a7be42da523..4b78de6b46a2 100644
--- a/Documentation/devicetree/bindings/serial/8250_omap.yaml
+++ b/Documentation/devicetree/bindings/serial/8250_omap.yaml
@@ -76,6 +76,7 @@ properties:
   clock-frequency: true
   current-speed: true
   overrun-throttle-ms: true
+  wakeup-source: true
 
 required:
   - compatible
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/5] serial: 8250: omap: Remove unused wakeups_enabled
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property Markus Schneider-Pargmann
@ 2024-08-07 14:12 ` Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 3/5] serial: 8250: omap: Cleanup on error in request_irq Markus Schneider-Pargmann
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

This field seems to be unused for quite some time already. Remove it.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
 drivers/tty/serial/8250/8250_omap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 1af9aed99c65..02d4f3073696 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -144,7 +144,6 @@ struct omap8250_priv {
 	atomic_t active;
 	bool is_suspending;
 	int wakeirq;
-	int wakeups_enabled;
 	u32 latency;
 	u32 calc_latency;
 	struct pm_qos_request pm_qos_request;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/5] serial: 8250: omap: Cleanup on error in request_irq
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 2/5] serial: 8250: omap: Remove unused wakeups_enabled Markus Schneider-Pargmann
@ 2024-08-07 14:12 ` Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 4/5] serial: 8250: omap: Set wakeup capable, do not enable Markus Schneider-Pargmann
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

If devm_request_irq fails, the code does not cleanup many things that
were setup before. Instead of directly returning ret we should jump to
err.

Fixes: fef4f600319e ("serial: 8250: omap: Fix life cycle issues for interrupt handlers")
Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
 drivers/tty/serial/8250/8250_omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 02d4f3073696..01d430de9c64 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1587,7 +1587,7 @@ static int omap8250_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev, up.port.irq, omap8250_irq, 0,
 			       dev_name(&pdev->dev), priv);
 	if (ret < 0)
-		return ret;
+		goto err;
 
 	priv->wakeirq = irq_of_parse_and_map(np, 1);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/5] serial: 8250: omap: Set wakeup capable, do not enable
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
                   ` (2 preceding siblings ...)
  2024-08-07 14:12 ` [PATCH v2 3/5] serial: 8250: omap: Cleanup on error in request_irq Markus Schneider-Pargmann
@ 2024-08-07 14:12 ` Markus Schneider-Pargmann
  2024-08-07 14:12 ` [PATCH v2 5/5] serial: 8250: omap: Parse DT wakeup-source proerty Markus Schneider-Pargmann
  2024-08-07 18:55 ` [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Kevin Hilman
  5 siblings, 0 replies; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

The driver sets wakeup enable by default. But not all UARTs are meant to
be wakeup enabled. Change the default to be wakeup capable but not
enabled. The user can enable wakeup when needed.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 01d430de9c64..7a6dfd40af9e 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1529,7 +1529,7 @@ static int omap8250_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
-	device_init_wakeup(&pdev->dev, true);
+	device_set_wakeup_capable(&pdev->dev, true);
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_use_autosuspend(&pdev->dev);
 
@@ -1628,7 +1628,7 @@ static void omap8250_remove(struct platform_device *pdev)
 	flush_work(&priv->qos_work);
 	pm_runtime_disable(&pdev->dev);
 	cpu_latency_qos_remove_request(&priv->pm_qos_request);
-	device_init_wakeup(&pdev->dev, false);
+	device_set_wakeup_capable(&pdev->dev, false);
 }
 
 static int omap8250_prepare(struct device *dev)
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/5] serial: 8250: omap: Parse DT wakeup-source proerty
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
                   ` (3 preceding siblings ...)
  2024-08-07 14:12 ` [PATCH v2 4/5] serial: 8250: omap: Set wakeup capable, do not enable Markus Schneider-Pargmann
@ 2024-08-07 14:12 ` Markus Schneider-Pargmann
  2024-08-07 18:55 ` [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Kevin Hilman
  5 siblings, 0 replies; 8+ messages in thread
From: Markus Schneider-Pargmann @ 2024-08-07 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Schneider-Pargmann, Tony Lindgren,
	Vignesh Raghavendra, Ronald Wahl, Uwe Kleine-König,
	Thomas Richard, Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Kevin Hilman, Dhruva Gole, linux-kernel,
	linux-serial, devicetree

If the wakeup-source property is present, enable wakeup from this
device.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
 drivers/tty/serial/8250/8250_omap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 7a6dfd40af9e..ccb83c05be20 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1530,6 +1530,9 @@ static int omap8250_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, priv);
 
 	device_set_wakeup_capable(&pdev->dev, true);
+	if (of_property_read_bool(np, "wakeup-source"))
+		device_set_wakeup_enable(&pdev->dev, true);
+
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_use_autosuspend(&pdev->dev);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property
  2024-08-07 14:12 ` [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property Markus Schneider-Pargmann
@ 2024-08-07 16:31   ` Conor Dooley
  0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2024-08-07 16:31 UTC (permalink / raw)
  To: Markus Schneider-Pargmann
  Cc: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Tony Lindgren, Vignesh Raghavendra, Ronald Wahl,
	Uwe Kleine-König, Thomas Richard, Thomas Gleixner,
	Udit Kumar, Andy Shevchenko, Vibhore Vardhan, Kevin Hilman,
	Dhruva Gole, linux-kernel, linux-serial, devicetree

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

On Wed, Aug 07, 2024 at 04:12:23PM +0200, Markus Schneider-Pargmann wrote:
> Add the wakeup-source to enable this device as a wakeup source if
> defined in DT.
> 
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support
  2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
                   ` (4 preceding siblings ...)
  2024-08-07 14:12 ` [PATCH v2 5/5] serial: 8250: omap: Parse DT wakeup-source proerty Markus Schneider-Pargmann
@ 2024-08-07 18:55 ` Kevin Hilman
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2024-08-07 18:55 UTC (permalink / raw)
  To: Markus Schneider-Pargmann, Greg Kroah-Hartman, Jiri Slaby,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Markus Schneider-Pargmann, Tony Lindgren, Vignesh Raghavendra,
	Ronald Wahl, Uwe Kleine-König, Thomas Richard,
	Thomas Gleixner, Udit Kumar, Andy Shevchenko
  Cc: Vibhore Vardhan, Dhruva Gole, linux-kernel, linux-serial,
	devicetree

Markus Schneider-Pargmann <msp@baylibre.com> writes:

> v2
> --
>
> In Version 2 I removed the Partial-IO specific patches as these can't be
> tested due to power issues in Partial-IO on am62-lp-sk and similar
> boards.
>
> I added a patch to add DT 'wakeup-source' support.
>
> Series
> ------
>
> To support wakeup from several low power modes on am62, don't always
> enable device wakeup. Instead only set it to wakeup capable. A
> devicetree property 'wakeup-source' can be used to enable wakeup. The
> user is also able to control if wakeup is enabled through sysfs.

For my low-power constraints series[1], it's also important to not have
the UART wakeups unconditionally enabled, so I like the defaults
proposed in this series.  Thanks!

I tested on k3-am62a7-sk along with my constraints changes and all is well.

Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>

Kevin

[1] https://lore.kernel.org/all/20240805-lpm-v6-10-constraints-pmdomain-v1-0-d186b68ded4c@baylibre.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-08-07 18:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 14:12 [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Markus Schneider-Pargmann
2024-08-07 14:12 ` [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property Markus Schneider-Pargmann
2024-08-07 16:31   ` Conor Dooley
2024-08-07 14:12 ` [PATCH v2 2/5] serial: 8250: omap: Remove unused wakeups_enabled Markus Schneider-Pargmann
2024-08-07 14:12 ` [PATCH v2 3/5] serial: 8250: omap: Cleanup on error in request_irq Markus Schneider-Pargmann
2024-08-07 14:12 ` [PATCH v2 4/5] serial: 8250: omap: Set wakeup capable, do not enable Markus Schneider-Pargmann
2024-08-07 14:12 ` [PATCH v2 5/5] serial: 8250: omap: Parse DT wakeup-source proerty Markus Schneider-Pargmann
2024-08-07 18:55 ` [PATCH v2 0/5] serial: 8250: omap: Add am62 wakeup support Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).