[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230426234221.1867222-1-minyard@acm.org>
Date: Wed, 26 Apr 2023 18:42:21 -0500
From: minyard@....org
To: Craig Shelley <craig@...rotron.org.uk>,
Johan Hovold <johan@...nel.org>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
linux-usb@...r.kernel.org, Corey Minyard <cmimyard@...sta.com>
Subject: [PATCH] USB: serial: cp210x: work around silicon bug setting break
From: Corey Minyard <cmimyard@...sta.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@...sta.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
Powered by blists - more mailing lists