mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] media: rc: meson-ir: wake the system from the remote
@ 2026-11-06 10:19 christian.koever-draxl
  2026-11-06 10:19 ` [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source christian.koever-draxl
  2026-11-06 10:19 ` [PATCH v2 2/2] media: rc: meson-ir: allow the receiver to wake the system christian.koever-draxl
  0 siblings, 2 replies; 4+ messages in thread
From: christian.koever-draxl @ 2026-11-06 10:19 UTC (permalink / raw)
  To: mchehab, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, sean
  Cc: linux-media, devicetree, linux-arm-kernel, linux-amlogic,
	linux-kernel, Christian Stefan Kövér-Draxl

From: Christian Stefan Kövér-Draxl <ckoever@outlook.de>

The suspend callback switches the decoder off, so a remote can never
wake the system from s2idle. With the wakeup-source property, keep the
decoder running and arm its interrupt as a wake source instead.

Suspend to RAM is not affected on S4: there the firmware watches the IR
receiver itself while the SoC is down and wakes the board on the power
key without this series.

Tested on an S905W2 box in s2idle: with the series the remote's power
key wakes it; with wakeup disabled for the receiver it does not.

Changes in v2:
- Commit message and cover: the series is about s2idle; deep suspend is
  woken by the firmware. The v1 test (suspend to RAM) did not exercise
  the change; replaced by an s2idle test with and without it (Martin).
- No code changes.
- Link to v1: https://lore.kernel.org/r/20261025192320.209446-1-christian.koever-draxl@student.uibk.ac.at

Tool use (Documentation/process/generated-content.rst):
This work was done with the help of an AI coding assistant, Claude
(Anthropic), used through Claude Code over many sessions. It did a large
part of the hands-on work: it read the vendor kernel and the firmware
interfaces, probed registers on the board, drafted the code and the
changelogs, and ran the builds, checkpatch, dt_binding_check and the
tests on the hardware. I directed the work, reviewed every change and
the final patches, and take responsibility for them. There is no single
prompt to quote; the sessions were of the form "find out why X fails on
this board, fix it, test it on the box".

Tested on an Amediatech X98Q TV box (Amlogic S905W2, S4 family, 2 GiB),
vendor U-Boot and BL31/OP-TEE, Linux 7.3 plus this work.

Christian Stefan Kövér-Draxl (2):
  dt-bindings: media: amlogic,meson6-ir: allow wakeup-source
  media: rc: meson-ir: allow the receiver to wake the system

 .../bindings/media/amlogic,meson6-ir.yaml       |  2 ++
 drivers/media/rc/meson-ir.c                     | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)


base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614
-- 
2.56.0


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

* [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source
  2026-11-06 10:19 [PATCH v2 0/2] media: rc: meson-ir: wake the system from the remote christian.koever-draxl
@ 2026-11-06 10:19 ` christian.koever-draxl
  2026-11-06 13:08   ` Rob Herring
  2026-11-06 10:19 ` [PATCH v2 2/2] media: rc: meson-ir: allow the receiver to wake the system christian.koever-draxl
  1 sibling, 1 reply; 4+ messages in thread
From: christian.koever-draxl @ 2026-11-06 10:19 UTC (permalink / raw)
  To: mchehab, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, sean
  Cc: linux-media, devicetree, linux-arm-kernel, linux-amlogic,
	linux-kernel, Christian Stefan Kövér-Draxl

From: Christian Stefan Kövér-Draxl <ckoever@outlook.de>

The receiver can stay powered across suspend and wake the system when
a remote control key is pressed. Allow boards to mark it as a wakeup
source.

Signed-off-by: Christian Stefan Kövér-Draxl <ckoever@outlook.de>
---
 Documentation/devicetree/bindings/media/amlogic,meson6-ir.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/amlogic,meson6-ir.yaml b/Documentation/devicetree/bindings/media/amlogic,meson6-ir.yaml
index 0f95fe8dd9ac..27c89f8f8c3d 100644
--- a/Documentation/devicetree/bindings/media/amlogic,meson6-ir.yaml
+++ b/Documentation/devicetree/bindings/media/amlogic,meson6-ir.yaml
@@ -30,6 +30,8 @@ properties:
   interrupts:
     maxItems: 1
 
+  wakeup-source: true
+
 required:
   - compatible
   - reg
-- 
2.56.0


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

* [PATCH v2 2/2] media: rc: meson-ir: allow the receiver to wake the system
  2026-11-06 10:19 [PATCH v2 0/2] media: rc: meson-ir: wake the system from the remote christian.koever-draxl
  2026-11-06 10:19 ` [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source christian.koever-draxl
@ 2026-11-06 10:19 ` christian.koever-draxl
  1 sibling, 0 replies; 4+ messages in thread
From: christian.koever-draxl @ 2026-11-06 10:19 UTC (permalink / raw)
  To: mchehab, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, sean
  Cc: linux-media, devicetree, linux-arm-kernel, linux-amlogic,
	linux-kernel, Christian Stefan Kövér-Draxl

From: Christian Stefan Kövér-Draxl <ckoever@outlook.de>

The suspend callback switches the decoder off, so nothing is left to
notice the remote and the receiver can never wake the system from
s2idle, where only Linux interrupts can wake the CPUs.

When the device is a wakeup source, keep the decoder running and arm
its interrupt as a wake interrupt instead. Boards without the
wakeup-source property keep the existing behaviour.

This does not affect suspend to RAM on boards whose firmware watches
the IR receiver itself while the SoC is down, as on S4 where BL31 wakes
the board on the remote's power key.

Tested on an S905W2 board in s2idle: the power key on the remote wakes
it; with wakeup disabled for the receiver it does not.

Signed-off-by: Christian Stefan Kövér-Draxl <ckoever@outlook.de>
---
 drivers/media/rc/meson-ir.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c
index 272ebb0d97c8..6b5b5f71a1b4 100644
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -165,6 +165,7 @@ struct meson_ir {
 	const struct meson_ir_param *param;
 	struct regmap	*reg;
 	struct rc_dev	*rc;
+	int		irq;
 	spinlock_t	lock;
 };
 
@@ -475,6 +476,8 @@ static int meson_ir_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	ir->irq = irq;
+
 	if (ir->param->support_hw_decoder)
 		ir->rc = devm_rc_allocate_device(&pdev->dev,
 						 RC_DRIVER_SCANCODE);
@@ -523,6 +526,8 @@ static int meson_ir_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	device_init_wakeup(dev, of_property_read_bool(node, "wakeup-source"));
+
 	dev_info(dev, "receiver initialized\n");
 
 	return 0;
@@ -571,6 +576,9 @@ static __maybe_unused int meson_ir_resume(struct device *dev)
 {
 	struct meson_ir *ir = dev_get_drvdata(dev);
 
+	if (device_may_wakeup(dev))
+		disable_irq_wake(ir->irq);
+
 	if (ir->param->support_hw_decoder)
 		meson_ir_hw_decoder_init(ir->rc, &ir->rc->enabled_protocols);
 	else
@@ -584,6 +592,15 @@ static __maybe_unused int meson_ir_suspend(struct device *dev)
 	struct meson_ir *ir = dev_get_drvdata(dev);
 	unsigned long flags;
 
+	/*
+	 * Leave the receiver running when it is meant to wake the system up,
+	 * otherwise there is nothing left to notice the remote.
+	 */
+	if (device_may_wakeup(dev)) {
+		enable_irq_wake(ir->irq);
+		return 0;
+	}
+
 	spin_lock_irqsave(&ir->lock, flags);
 	regmap_update_bits(ir->reg, IR_DEC_REG1, IR_DEC_REG1_ENABLE, 0);
 	spin_unlock_irqrestore(&ir->lock, flags);
-- 
2.56.0


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

* Re: [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source
  2026-11-06 10:19 ` [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source christian.koever-draxl
@ 2026-11-06 13:08   ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2026-11-06 13:08 UTC (permalink / raw)
  To: christian.koever-draxl
  Cc: mchehab, krzk+dt, conor+dt, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, sean, linux-media, devicetree,
	linux-arm-kernel, linux-amlogic, linux-kernel,
	Christian Stefan Kövér-Draxl

On Fri, Nov 06, 2026 at 11:19:53AM +0100, christian.koever-draxl@student.uibk.ac.at wrote:
> From: Christian Stefan Kövér-Draxl <ckoever@outlook.de>
> 
> The receiver can stay powered across suspend and wake the system when
> a remote control key is pressed. Allow boards to mark it as a wakeup
> source.
> 
> Signed-off-by: Christian Stefan Kövér-Draxl <ckoever@outlook.de>

Missing Krzysztof's ack...

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

end of thread, other threads:[~2026-11-06 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 10:19 [PATCH v2 0/2] media: rc: meson-ir: wake the system from the remote christian.koever-draxl
2026-11-06 10:19 ` [PATCH v2 1/2] dt-bindings: media: amlogic,meson6-ir: allow wakeup-source christian.koever-draxl
2026-11-06 13:08   ` Rob Herring
2026-11-06 10:19 ` [PATCH v2 2/2] media: rc: meson-ir: allow the receiver to wake the system christian.koever-draxl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®