diff mbox series

USB: serial: cp210x: work around silicon bug setting break

Message ID 20230426234221.1867222-1-minyard@acm.org
State New
Headers show
Series USB: serial: cp210x: work around silicon bug setting break | expand

Commit Message

Corey Minyard April 26, 2023, 11:42 p.m. UTC
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 mbox series

Patch

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