[PATCH v2 2/2] rpmsg: char: Support waking up on endpoint rx
From: David Heidelberg via B4 Relay
Date: Sun Nov 22 2026 - 15:24:39 EST
From: David Heidelberg <david@xxxxxxx>
Configure rpmsg character endpoint devices (/dev/rpmsgX) as wakeup
capable and report a wakeup event when a message is received in
rpmsg_ept_cb().
This allows userspace to opt in to system wakeups per endpoint via
sysfs (/sys/class/rpmsg/rpmsgX/power/wakeup), covering dynamically
created endpoints opened through /dev/rpmsg_ctrlX across all rpmsg
transports without enabling wakeup by default.
Signed-off-by: David Heidelberg <david@xxxxxxx>
---
drivers/rpmsg/rpmsg_char.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index d8868faacdc3a..94307d1e0338b 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -119,16 +119,17 @@ static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len,
skb_put_data(skb, buf, len);
spin_lock(&eptdev->queue_lock);
skb_queue_tail(&eptdev->queue, skb);
spin_unlock(&eptdev->queue_lock);
/* wake up any blocking processes, waiting for new data */
wake_up_interruptible(&eptdev->readq);
+ pm_wakeup_hard_event(&eptdev->dev);
return 0;
}
static int rpmsg_ept_flow_cb(struct rpmsg_device *rpdev, void *priv, bool enable)
{
struct rpmsg_eptdev *eptdev = priv;
@@ -446,16 +447,17 @@ static struct rpmsg_eptdev *rpmsg_chrdev_eptdev_alloc(struct rpmsg_device *rpdev
skb_queue_head_init(&eptdev->queue);
init_waitqueue_head(&eptdev->readq);
device_initialize(dev);
dev->class = &rpmsg_class;
dev->parent = parent;
dev->groups = rpmsg_eptdev_groups;
dev_set_drvdata(dev, eptdev);
+ device_set_wakeup_capable(dev, true);
cdev_init(&eptdev->cdev, &rpmsg_eptdev_fops);
eptdev->cdev.owner = THIS_MODULE;
return eptdev;
}
static int rpmsg_chrdev_eptdev_add(struct rpmsg_eptdev *eptdev, struct rpmsg_channel_info chinfo)
--
2.55.0