serial: 8250: omap: Add am62 wakeup support
Subsystems (2)
v2 cover serial: 8250: omap: Add am62 wakeup support
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/[email protected]/
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(-)
Signature · 1 line
2.45.2
PATCH v2 1/5 dt-bindings: serial: 8250_omap: Add wakeup-source property
Add the wakeup-source to enable this device as a wakeup source if defined in DT.
--- Documentation/devicetree/bindings/serial/8250_omap.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/8250_omap.yaml +1 -0
@@ -76,6 +76,7 @@ properties: clock-frequency: true current-speed: true overrun-throttle-ms: true + wakeup-source: true required: - compatible
Signature · 1 line
2.45.2
Re: [PATCH v2 1/5] dt-bindings: serial: 8250_omap: Add wakeup-source property
Quoted 4 lines · Markus Schneider-Pargmann
Add the wakeup-source to enable this device as a wakeup source if defined in DT.
Signed-off-by Markus Schneider-Pargmann <[email protected]>
PATCH v2 2/5 serial: 8250: omap: Remove unused wakeups_enabled
In reply to Markus Schneider-PargmannThis field seems to be unused for quite some time already. Remove it.
--- drivers/tty/serial/8250/8250_omap.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +0 -1
@@ -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;
Signature · 1 line
2.45.2
PATCH v2 3/5 serial: 8250: omap: Cleanup on error in request_irq
In reply to Markus Schneider-PargmannIf 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.
--- drivers/tty/serial/8250/8250_omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +1 -1
@@ -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 );
Signature · 1 line
2.45.2
PATCH v2 4/5 serial: 8250: omap: Set wakeup capable, do not enable
In reply to Markus Schneider-PargmannThe 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.
--- drivers/tty/serial/8250/8250_omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
@@ -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)
Signature · 1 line
2.45.2
PATCH v2 5/5 serial: 8250: omap: Parse DT wakeup-source proerty
In reply to Markus Schneider-PargmannIf the wakeup-source property is present, enable wakeup from this device.
--- drivers/tty/serial/8250/8250_omap.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/8250/8250_omap.c +3 -0
@@ -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);
Signature · 1 line
2.45.2
Quoted 9 lines · Markus Schneider-Pargmann
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.
Quoted 7 lines
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.
Kevin
[1] https://lore.kernel.org/all/20240805-lpm-v6-10-constraints-pmdomain-v1-0-d186b68ded4c@baylibre.com/