public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arun Kumar Neelakantam <aneela@codeaurora.org>
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 <aneela@codeaurora.org>
Subject: [PATCH 5/5] rpmsg: glink: Convert the native signals to TIOCM
Date: Wed,  3 Oct 2018 17:04:23 +0530	[thread overview]
Message-ID: <1538566463-24627-6-git-send-email-aneela@codeaurora.org> (raw)
In-Reply-To: <1538566463-24627-1-git-send-email-aneela@codeaurora.org>

Native signals over SMEM transport are different from Linux TIOCM signals.
Add a macro to convert signals when sent or received from clients.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index ff8751b..3054c86 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -18,6 +18,7 @@
 #include <linux/rpmsg.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
+#include <linux/termios.h>
 #include <linux/workqueue.h>
 #include <linux/mailbox_client.h>
 
@@ -211,6 +212,11 @@ struct glink_channel {
 
 #define GLINK_FEATURE_INTENTLESS	BIT(1)
 
+#define NATIVE_DTR_SIG BIT(31)
+#define NATIVE_CTS_SIG BIT(30)
+#define NATIVE_CD_SIG BIT(29)
+#define NATIVE_RI_SIG BIT(28)
+
 static void qcom_glink_rx_done_work(struct work_struct *work);
 
 static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink,
@@ -998,6 +1004,18 @@ static int qcom_glink_handle_signals(struct qcom_glink *glink,
 	}
 
 	old = channel->rsigs;
+
+	/* convert signals from NATIVE to TIOCM */
+	if (signals & NATIVE_DTR_SIG)
+		signals |= TIOCM_DSR;
+	if (signals & NATIVE_CTS_SIG)
+		signals |= TIOCM_CTS;
+	if (signals & NATIVE_CD_SIG)
+		signals |= TIOCM_CD;
+	if (signals & NATIVE_RI_SIG)
+		signals |= TIOCM_RI;
+	signals &= 0x0fff;
+
 	channel->rsigs = signals;
 
 	if (channel->ept.sig_cb)
@@ -1387,6 +1405,17 @@ static int qcom_glink_set_sigs(struct rpmsg_endpoint *ept, u32 sigs)
 
 	channel->lsigs = sigs;
 
+	/* convert signals from TIOCM to NATIVE */
+	sigs &= 0x0fff;
+	if (sigs & TIOCM_DTR)
+		sigs |= NATIVE_DTR_SIG;
+	if (sigs & TIOCM_RTS)
+		sigs |= NATIVE_CTS_SIG;
+	if (sigs & TIOCM_CD)
+		sigs |= NATIVE_CD_SIG;
+	if (sigs & TIOCM_RI)
+		sigs |= NATIVE_RI_SIG;
+
 	return qcom_glink_send_signals(glink, channel, sigs);
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


      parent reply	other threads:[~2018-10-03 11:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 11:34 [PATCH 0/5] Add TIOCM Signals support for RPMSG char devices Arun Kumar Neelakantam
2018-10-03 11:34 ` [PATCH 1/5] rpmsg: glink: Add GLINK signal support for RPMSG Arun Kumar Neelakantam
2018-10-04  0:46   ` Bjorn Andersson
2018-10-03 11:34 ` [PATCH 2/5] rpmsg: Add signal callback to rpmsg char device Arun Kumar Neelakantam
2018-10-04  0:26   ` Bjorn Andersson
2018-10-03 11:34 ` [PATCH 3/5] rpmsg: Add TIOCMGET/TIOCMSET ioctl support Arun Kumar Neelakantam
2018-10-04  0:54   ` Bjorn Andersson
2018-10-03 11:34 ` [PATCH 4/5] rpmsg: wakeup poll to notify signal update Arun Kumar Neelakantam
2018-10-04  0:31   ` Bjorn Andersson
2018-10-03 11:34 ` Arun Kumar Neelakantam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1538566463-24627-6-git-send-email-aneela@codeaurora.org \
    --to=aneela@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=clew@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=sricharan@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox