diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2017-01-11 06:35:11 -0800 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2020-04-15 01:24:40 +0200 |
commit | 75f3d51937d7a99bf37a17132077e4d11d3ec50d (patch) | |
tree | 0137cd3e18ba565b484690cc88291a8cc35506ff | |
parent | ab2682d02d92d08c8299acaae935ed5b825b281c (diff) |
rpmsg: qcom_smd: Implement endpoint "poll"
Add support for polling the status of the write buffer so that user
space can use rpmsg character devices in non-blocking mode.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r-- | drivers/rpmsg/qcom_smd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 312cb7fec5b0..011d9bb8a6ae 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -923,6 +923,21 @@ static int qcom_smd_trysend(struct rpmsg_endpoint *ept, void *data, int len) return __qcom_smd_send(qsept->qsch, data, len, false); } +static unsigned int qcom_smd_poll(struct rpmsg_endpoint *ept, + struct file *filp, poll_table *wait) +{ + struct qcom_smd_endpoint *qsept = to_smd_endpoint(ept); + struct qcom_smd_channel *channel = qsept->qsch; + unsigned int mask = 0; + + poll_wait(filp, &channel->fblockread_event, wait); + + if (qcom_smd_get_tx_avail(channel) > 20) + mask |= POLLOUT | POLLWRNORM; + + return mask; +} + /* * Finds the device_node for the smd child interested in this channel. */ @@ -955,6 +970,7 @@ static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = { .destroy_ept = qcom_smd_destroy_ept, .send = qcom_smd_send, .trysend = qcom_smd_trysend, + .poll = qcom_smd_poll, }; /* |