mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: minyard@acm.org
To: Craig Shelley <craig@microtron.org.uk>, Johan Hovold <johan@kernel.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-usb@vger.kernel.org, Corey Minyard <cmimyard@mvista.com>
Subject: [PATCH] USB: serial: cp210x: work around silicon bug setting break
Date: Wed, 26 Apr 2023 18:42:21 -0500	[thread overview]
Message-ID: <20230426234221.1867222-1-minyard@acm.org> (raw)
In-Reply-To: <ZEmDs0ASdnEAnpsL@minyard.net>

From: Corey Minyard <cmimyard@mvista.com>

At least on the CP2105, sending this once doesn't work, you have to send
it twice to make it happen.  If you only send it once, you will get a
really short time (a few bits) where the break is sent, right when the
break is turned off, thus it isn't recognised as a break.  Sending it
twice won't hurt anything, so just do it all the time.

Signed-off-by: Corey Minyard <cmimyard@mvista.com>
---
I played with this a bit, and found this change fixes the issue.  It's
not ideal, I suppose, but it works.

 drivers/usb/serial/cp210x.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index cdea1bff3b70..e410a749325b 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1446,6 +1446,15 @@ static void cp210x_break_ctl(struct tty_struct *tty, int break_state)
 	dev_dbg(&port->dev, "%s - turning break %s\n", __func__,
 		state == BREAK_OFF ? "off" : "on");
 	cp210x_write_u16_reg(port, CP210X_SET_BREAK, state);
+	/*
+	 * At least on the CP2105, sending this once doesn't work, you
+	 * have to send it twice to make it happen.  If you only send
+	 * it once, you will get a really short time (a few bits) where
+	 * the break is sent, right when the break is turned off, thus
+	 * it isn't recognised as a break.  Sending it twice won't hurt
+	 * anything, so just do it all the time.
+	 */
+	cp210x_write_u16_reg(port, CP210X_SET_BREAK, state);
 }
 
 #ifdef CONFIG_GPIOLIB
-- 
2.35.7


  reply	other threads:[~2023-04-26 23:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 20:04 Break doesn't work on a CP2105 Corey Minyard
2023-04-26 23:42 ` minyard [this message]
2023-05-22 11:59 ` Johan Hovold
2023-05-22 12:52   ` Corey Minyard
2023-06-02 12:53     ` Johan Hovold
2023-06-02 16:46       ` Corey Minyard
2023-06-04 12:17         ` Johan Hovold
2023-06-04 20:11           ` Corey Minyard
2023-06-05  7:15             ` Johan Hovold
2023-06-05 12:25               ` Corey Minyard

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=20230426234221.1867222-1-minyard@acm.org \
    --to=minyard@acm.org \
    --cc=cmimyard@mvista.com \
    --cc=craig@microtron.org.uk \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®