From patchwork Fri Dec 2 22:03:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9459321 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 BC1C26074E for ; Fri, 2 Dec 2016 22:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD65B2858E for ; Fri, 2 Dec 2016 22:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A244A28599; Fri, 2 Dec 2016 22:04:55 +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=-6.8 required=2.0 tests=BAYES_00,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 4DCC72858E for ; Fri, 2 Dec 2016 22:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755885AbcLBWEy (ORCPT ); Fri, 2 Dec 2016 17:04:54 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36157 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751972AbcLBWE0 (ORCPT ); Fri, 2 Dec 2016 17:04:26 -0500 Received: by mail-pf0-f177.google.com with SMTP id 189so54641934pfz.3 for ; Fri, 02 Dec 2016 14:03:42 -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=qIjcs2RTAJTIO36xaF86nOhJMe/6ZThu/KoGGWXjYx4=; b=HjkdSaGC2w1VUD53FZo1/k/Q2FgxKavoPj4lxUS4YcBR1J/MHmUrg20/aeSaq7DPQF SnO+/Hx/Lxz/G5lmZp7mV8v8meKlPHLMk9Ls1oCihWfT7LR0kALRxjh2ns8ma4xG13MI pnPz7NGVIr5+2e5lbE+AOgwZC1zdubbZj5Z+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qIjcs2RTAJTIO36xaF86nOhJMe/6ZThu/KoGGWXjYx4=; b=QCSq/ww/P+WESRjERC+GB78e8VTuf9sY97otWkWKr1sGYr8PdV0xEVd85iWnamtR/n tMSZcgORQaJJ6ALDnX7bmjbz+wxkZsR8i3i3jTnq3DIuN5oUh4ZTsRj1/imx4iqJ45TG NOVUiF9/R4l6523YEl0EXXAI2gZDztQPUXfHVu2JF9HxgBv6dNunelrnWeia2EWUFo8W LMAEzkSLVYt/iKkZ5s5NUN+1UITT8fO1mNhzxJ5oL4yrWaSsGa4G9zY28cOas/4qcu04 cYpVDNi7FuUKSe+JPCVZj8SfoK+TF+0xtU0YRuRO+ZHHUN0unZKs9Onmg8N03bsAxYYT zGxA== X-Gm-Message-State: AKaTC00kd4MVQNsTo+8C14dRPLEN15rwPBkXJaZcUkb3WaWB5np54AbiQ7TQd7N3lUTuQVCp X-Received: by 10.99.5.21 with SMTP id 21mr82851344pgf.32.1480716222482; Fri, 02 Dec 2016 14:03:42 -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 q20sm9908719pgn.39.2016.12.02.14.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 14:03:41 -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 v2 2/4] rpmsg: qcom_smd: Implement endpoint "poll" Date: Fri, 2 Dec 2016 14:03:35 -0800 Message-Id: <1480716217-23303-2-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1480716217-23303-1-git-send-email-bjorn.andersson@linaro.org> References: <1480716217-23303-1-git-send-email-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 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 3b77320fb8c9..52c4ec570464 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, }; /*