[PATCH v2 1/2] rpmsg: glink: Support waking up on channel rx

From: David Heidelberg via B4 Relay

Date: Sun Nov 22 2026 - 15:24:47 EST


From: Casey Connolly <casey.connolly@xxxxxxxxxx>

Configure all channels as wakeup capable and report a wakeup event
when data is received.

This allows userspace to "subscribe" to a particular channel where
it is useful to wake up to process new data. The expected usecase
is to allow for handling incoming SMS or phone calls where the only
notification mechanism is via QRTR on the IPCRTR glink channel.

As this behaviour is likely undesirable for most users, this patch
doesn't enable a wakeup_source for any channels by default.

Signed-off-by: Casey Connolly <casey.connolly@xxxxxxxxxx>
Co-developed-by: David Heidelberg <david@xxxxxxx>
Signed-off-by: David Heidelberg <david@xxxxxxx>
---
drivers/rpmsg/qcom_glink_native.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index f848ab46161d1..02ac790251303 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -993,16 +993,17 @@ static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail)
if (!left_size) {
spin_lock(&channel->recv_lock);
if (channel->ept.cb) {
channel->ept.cb(channel->ept.rpdev,
intent->data,
intent->offset,
channel->ept.priv,
RPMSG_ADDR_ANY);
+ pm_wakeup_hard_event(&channel->ept.rpdev->dev);
}
spin_unlock(&channel->recv_lock);

intent->offset = 0;
channel->buf = NULL;

qcom_glink_rx_done(glink, channel, intent);
}
@@ -1684,16 +1685,27 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid,
rpdev->dev.of_node = node;
rpdev->dev.parent = glink->dev;
rpdev->dev.release = qcom_glink_rpdev_release;

ret = rpmsg_register_device(rpdev);
if (ret)
goto rcid_remove;

+ /*
+ * Declare all channels as wakeup capable, but don't enable
+ * waking up by default.
+ *
+ * Userspace may wish to be woken up for incoming messages on a
+ * specific channel, for example to handle incoming calls or SMS
+ * messages on the IPCRTR channel. This can be done by enabling
+ * the wakeup source via sysfs.
+ */
+ device_set_wakeup_capable(&rpdev->dev, true);
+
channel->rpdev = rpdev;
}

return 0;

rcid_remove:
spin_lock_irqsave(&glink->idr_lock, flags);
idr_remove(&glink->rcids, channel->rcid);

--
2.55.0