aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Schäfer <fschaefer.oss@googlemail.com>2013-07-30 15:49:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-31 21:12:38 -0400
commitb8bdad608213caffa081a97d2e937e5fe08c4046 (patch)
tree6c58e7f0f1c1a30bdf780829590299641a504160
parentd4f09e28d7bc5c1adde8229b1e89401f23fb44f9 (diff)
USB: pl2303: restrict the divisor based baud rate encoding method to the "HX" chip type
It's not clear if the type_0 and type_1 chips support the divisor based baud rate encoding method, so don't use it until anyone with such chip has tested it to avoid regressions with the following patches. Even if it has been working fine with these chips since the code has been added 2 years ago, this change will not cause any regressions, because the baud rates currently supported/allowed with the divisor based method are supported with the direct method, too. The code for the divisor based method also isn't entirely correct (yet), so that the direct encoding method actually works better (sets the baud rate more precisely). Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/pl2303.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 1e6de4cd079d..244820193e10 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -305,10 +305,14 @@ static void pl2303_encode_baudrate(struct tty_struct *tty,
305 if (spriv->type != HX) 305 if (spriv->type != HX)
306 baud = min_t(int, baud, 1228800); 306 baud = min_t(int, baud, 1228800);
307 307
308 if (baud <= 115200) { 308 if (spriv->type != HX || baud <= 115200) {
309 /* Direct (standard) baud rate encoding method */
309 put_unaligned_le32(baud, buf); 310 put_unaligned_le32(baud, buf);
310 } else { 311 } else {
311 /* 312 /*
313 * NOTE: it's not clear if the type_0/1 chips
314 * support this method
315 *
312 * Apparently the formula for higher speeds is: 316 * Apparently the formula for higher speeds is:
313 * baudrate = 12M * 32 / (2^buf[1]) / buf[0] 317 * baudrate = 12M * 32 / (2^buf[1]) / buf[0]
314 */ 318 */