From: Pascal JEAN <epsilonrt@gmail.com>
To: gregkh@linuxfoundation.org
Cc: jslaby@suse.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, Pascal JEAN <epsilonrt@gmail.com>
Subject: [PATCH 2/2] sc16is7xx: add reading CTS
Date: Wed, 27 Jul 2016 22:58:43 +0200 [thread overview]
Message-ID: <1469653123-21867-3-git-send-email-epsilonrt@gmail.com> (raw)
In-Reply-To: <1469653123-21867-1-git-send-email-epsilonrt@gmail.com>
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
next prev parent reply other threads:[~2016-07-27 20:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 20:58 sc16is7xx: fix RTS/CTS implementation and add reading CTS Pascal JEAN
2016-07-27 20:58 ` [PATCH 1/2] sc16is7xx: fix RTS/CTS implementation Pascal JEAN
2016-07-27 21:28 ` Greg KH
2016-07-28 6:56 ` Pascal JEAN
2016-07-28 7:07 ` [PATCH 2/2] sc16is7xx: add reading CTS Pascal JEAN
2016-07-28 14:10 ` Greg KH
2016-07-27 20:58 ` Pascal JEAN [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-07-28 11:16 Maarten Brock
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=1469653123-21867-3-git-send-email-epsilonrt@gmail.com \
--to=epsilonrt@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.