patch "USB: serial: ch341: fix receiver regression" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: serial: ch341: fix receiver regression
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 7c3d02285ad558691f27fde760bcd841baa27eab Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 6 Feb 2020 12:18:19 +0100
Subject: USB: serial: ch341: fix receiver regression
While assumed not to make a difference, not using the factor-2 prescaler makes the receiver more susceptible to errors.
Specifically, there have been reports of problems with devices that cannot generate a 115200 rate with a smaller error than 2.1% (e.g. 117647 bps). But this can also be reproduced with a low-speed RS232 tranceiver at 115200 when the input rate matches the nominal rate.
So whenever possible, enable the factor-2 prescaler and halve the divisor in order to use settings closer to that of the previous algorithm.
--- drivers/usb/serial/ch341.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/usb/serial/ch341.c +10 -0
@@ -205,6 +205,16 @@ static int ch341_get_divisor(speed_t speed) 16 * speed - 16 * CH341_CLKRATE / (clk_div * (div + 1))) div++; +/* +* Prefer lower base clock (fact = 0) if even divisor. +* +* Note that this makes the receiver more tolerant to errors. +*/ +if (fact ==1 && div %2 ==0 ) { + div /=2 ; + fact =0 ; + } +return (0x100 - div) <<8 | fact <<2 | ps; }
Signature · 1 line
2.25.0