Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451507 > unrolled thread

[PATCH 2/2] sc16is7xx: add reading CTS

Started byPascal JEAN <epsilonrt@gmail.com>
First post2016-07-27 23:00 +0200
Last post2016-07-27 23:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] sc16is7xx: add reading CTS Pascal JEAN <epsilonrt@gmail.com> - 2016-07-27 23:00 +0200

#1451507 — [PATCH 2/2] sc16is7xx: add reading CTS

FromPascal JEAN <epsilonrt@gmail.com>
Date2016-07-27 23:00 +0200
Subject[PATCH 2/2] sc16is7xx: add reading CTS
Message-ID<rZE5P-4nL-13@gated-at.bofh.it>
Signed-off-by: Pascal JEAN <epsilonrt@gmail.com>
---
 drivers/tty/serial/sc16is7xx.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 3e65079..8833a18 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -818,10 +818,19 @@ static unsigned int sc16is7xx_tx_empty(struct uart_port *port)
 
 static unsigned int sc16is7xx_get_mctrl(struct uart_port *port)
 {
-	/* DCD and DSR are not wired and CTS/RTS is handled automatically
-	 * so just indicate all inputs asserted
-	 */
-	return TIOCM_DSR | TIOCM_CAR | TIOCM_RI | TIOCM_CTS;
+	/* DCD, DSR and RI are not wired so just indicate asserted */
+	unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_RI;
+
+	if (port->status & UPSTAT_CTS_ENABLE)
+		/* CTS handled automatically, indicates that it is always
+		 * asserted, this is required for proper management of
+		 * the upper layer
+		 */
+		mctrl |= TIOCM_CTS;
+	else {
+		/* CTS is not managed automatically, returns its actual state
+		 * the upper layer
+		 */
+		u8 msr = sc16is7xx_port_read(port, SC16IS7XX_MSR_REG);
+
+		mctrl |= (msr & SC16IS7XX_MSR_CTS_BIT) ? TIOCM_CTS : 0;
+	}
+	return mctrl;
 }
 
 static void sc16is7xx_set_mctrl(struct uart_port *port, unsigned int mctrl)
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web