Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2476611imm; Wed, 3 Oct 2018 04:36:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV60eWV0qen5diAvBdCDbn4TsEkuvQtKk9Z1Qok95sgq3spDMnlDtJksbC6jDBejjv8xBODmp X-Received: by 2002:a17:902:50e3:: with SMTP id c32-v6mr1197285plj.194.1538566619132; Wed, 03 Oct 2018 04:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538566619; cv=none; d=google.com; s=arc-20160816; b=d/OxPNkZztug39C0qO+juT2A3LY8G9Lu1/B5MJNdEgeeDL6ynj6WaWxR/AbSyxxSr2 pP/WEs4bzc7JpyF6Ug4RALalyY/gZCYs9ts2AahPIobbUAL1GebvydAdpFoxaFUeRRCR yxd3MCLmAkjVFRNs1lljKn6A809yq4Cm+4pkYrjyJwOEUp7jQB+4qZGhiThGbBf4nNoj S0Ab6cNDTX6t7JxoRK87Ne5Fbdaq4xG0B9iKXlv0sxzJMC+Krh6MPUT5dBj+WvC0AskC tw7ENobHcobwrQ3yAzFnlxETm7KBBNcjDa47tY3g2nkiePqxpbLqIfLSOw6nBCPLumv9 JNRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=QeBa/mVcDbI8kKvS5ooxPgfg3wnYIgKPEv/qQNUUtbM=; b=JyAXCyWMz6ltUWG9XdvW3PT35laMV0vrGaxtlNvc6tn0OebqxgLmGDZjAsrBST5LyT r+vQoaQdVtPoD6M3nYJBBUf+xmkbfSjur2f+V2vBYtWOzxQlioyOjD3njzWRvX8JXvAC f0XPv8gZGOEKvRaxQcaU5rBGINY8SmE2lzBWQK3/6cNIW5iG2Rbuq70Qn7Q9hoRmSH6J 4EBNVw412a32W9Pvmgk9wvuxLCgoid+yRHAgVK1jt1puSP9RXh+LAbxyCDmxLf72Vxbi BhV300GFffhwNen87OIwAfNANG1fPXmXNPkXB9BV9rcy+NLO7SNVM8LVRw0uWrC6wvDx hpVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=GqqltBA5; dkim=pass header.i=@codeaurora.org header.s=default header.b=GqqltBA5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si1325320plb.197.2018.10.03.04.36.44; Wed, 03 Oct 2018 04:36:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=GqqltBA5; dkim=pass header.i=@codeaurora.org header.s=default header.b=GqqltBA5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727180AbeJCSXL (ORCPT + 99 others); Wed, 3 Oct 2018 14:23:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55364 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbeJCSXK (ORCPT ); Wed, 3 Oct 2018 14:23:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C790960C62; Wed, 3 Oct 2018 11:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566509; bh=q8HwYztCvotKOrqEFcstvdFfANwvR5OGFj7Il4/+IVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqqltBA51WMDvB7vknEvRGUsu0nvX0TOEnjHFk+qOx62rP5QsjNOA+rn3IFHBrnss h5tVsatsfK7q+a2wJHtHkF0cR6tk5M3D002QgKdSmjTL8sz+KBchspOZAYATfDy1EE 0NqhAetpU9bs0KxLMrEfYdICQ+gM2jIGBZkIUzos= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C8D0460B26; Wed, 3 Oct 2018 11:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566509; bh=q8HwYztCvotKOrqEFcstvdFfANwvR5OGFj7Il4/+IVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqqltBA51WMDvB7vknEvRGUsu0nvX0TOEnjHFk+qOx62rP5QsjNOA+rn3IFHBrnss h5tVsatsfK7q+a2wJHtHkF0cR6tk5M3D002QgKdSmjTL8sz+KBchspOZAYATfDy1EE 0NqhAetpU9bs0KxLMrEfYdICQ+gM2jIGBZkIUzos= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C8D0460B26 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam Subject: [PATCH 3/5] rpmsg: Add TIOCMGET/TIOCMSET ioctl support Date: Wed, 3 Oct 2018 17:04:21 +0530 Message-Id: <1538566463-24627-4-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538566463-24627-1-git-send-email-aneela@codeaurora.org> References: <1538566463-24627-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add TICOMGET and TIOCMSET ioctl support for rpmsg char device nodes to get/set the low level transport signals. Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/rpmsg_char.c | 54 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index 86003d5..c983d6c 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -274,15 +275,62 @@ static __poll_t rpmsg_eptdev_poll(struct file *filp, poll_table *wait) return mask; } +static int rpmsg_eptdev_tiocmset(struct file *fp, unsigned int cmd, + unsigned long arg) +{ + struct rpmsg_eptdev *eptdev = fp->private_data; + u32 lsigs, rsigs, val; + int ret; + + ret = get_user(val, (u32 *)arg); + if (ret) + return ret; + + ret = rpmsg_get_sigs(eptdev->ept, &lsigs, &rsigs); + if (ret < 0) + return ret; + + switch (cmd) { + case TIOCMBIS: + lsigs |= val; + break; + case TIOCMBIC: + lsigs &= ~val; + break; + case TIOCMSET: + lsigs = val; + break; + } + + ret = rpmsg_set_sigs(eptdev->ept, lsigs); + return ret; +} + static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) { struct rpmsg_eptdev *eptdev = fp->private_data; + u32 lsigs, rsigs; + int ret; - if (cmd != RPMSG_DESTROY_EPT_IOCTL) - return -EINVAL; + switch (cmd) { + case TIOCMGET: + ret = rpmsg_get_sigs(eptdev->ept, &lsigs, &rsigs); + if (!ret) + ret = put_user(rsigs, (u32 *)arg); + break; + case TIOCMSET: + case TIOCMBIS: + case TIOCMBIC: + ret = rpmsg_eptdev_tiocmset(fp, cmd, arg); + break; + case RPMSG_DESTROY_EPT_IOCTL: + ret = rpmsg_eptdev_destroy(&eptdev->dev, NULL); + default: + ret = -EINVAL; + } - return rpmsg_eptdev_destroy(&eptdev->dev, NULL); + return ret; } static const struct file_operations rpmsg_eptdev_fops = { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project