From patchwork Wed Jan 11 14:35:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9511591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7BBFF60231 for ; Wed, 11 Jan 2017 22:35:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CEED28697 for ; Wed, 11 Jan 2017 22:35:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6166A286BB; Wed, 11 Jan 2017 22:35:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0BC728697 for ; Wed, 11 Jan 2017 22:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934798AbdAKWem (ORCPT ); Wed, 11 Jan 2017 17:34:42 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33986 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757610AbdAKWej (ORCPT ); Wed, 11 Jan 2017 17:34:39 -0500 Received: by mail-pf0-f171.google.com with SMTP id 127so1065384pfg.1 for ; Wed, 11 Jan 2017 14:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=okvr56895jXvH64FjHPeNrxml23/jaXqTOLoXtYql/A=; b=JTbthkBKLHdDwF2AHyWq82IPnp/j9ib/2sO/IxtZO8yCcuVJvoe7kIGj9UYbczntv+ 4pgX/SFIhKRxhIBD7OrW8XjBi0k5XM+JRB/8cSy2DKR46vFyr6lm5tKGI0Ym7t0kn68x ++39xhq+6hc7EiwN74yd8mPPJ6e1W8O7POTyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=okvr56895jXvH64FjHPeNrxml23/jaXqTOLoXtYql/A=; b=YSVriiMffcTPo49rIr4o9pSC6z7AlO4qs4e2f+Njv25dqXbP38rutSBUf5qpbyAgj5 D+KmhYsfYvln/uxfOnPsUGQ6EE6s4D1q8l9/IVWYDHJuJHlY+YzEgY4yKfJU50JYBt1Y HjeSzEjV+penySX/ngbcUd5GD6B0CDa/3AyUhwaU/rZncB+6gz/pqIg8yM3kmdaLJq9o eqUvlGgyvaLoKBq/R6b/kABs1oRdXsBbHxZY7kn4gY+tzQvIwn78gZ1aqvzAJaERBByf 4Bp1fALU1WzE2+cp3TaxHqgmR4ejOB/u3sLjHK1j1/UYeghumM/6BAfXGnpcLRBnAHJo sxMQ== X-Gm-Message-State: AIkVDXLh6i6+bA/00FeOC18/9l32VXyFUTW0Y4N1XkWDg+n8xgCJLGy88ouYD+MNL8Fgjd7y X-Received: by 10.84.225.150 with SMTP id u22mr16758016plj.157.1484174078871; Wed, 11 Jan 2017 14:34:38 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id o89sm16128591pfi.26.2017.01.11.14.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 14:34:37 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 2/4] rpmsg: qcom_smd: Implement endpoint "poll" Date: Wed, 11 Jan 2017 06:35:11 -0800 Message-Id: <20170111143513.32251-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111143513.32251-1-bjorn.andersson@linaro.org> References: <20170111143513.32251-1-bjorn.andersson@linaro.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes since v2: - None Changes since v1: - New patch drivers/rpmsg/qcom_smd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 3dd73edaa525..9e2af6a18aa2 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -919,6 +919,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. */ @@ -951,6 +966,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, }; /*