aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/pl2303.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/pl2303.c')
-rw-r--r--drivers/usb/serial/pl2303.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index e9bad928039f..0f872e6b2c87 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -162,6 +162,9 @@ static const struct pl2303_type_data pl2303_type_data[TYPE_COUNT] = {
162 .max_baud_rate = 1228800, 162 .max_baud_rate = 1228800,
163 .quirks = PL2303_QUIRK_LEGACY, 163 .quirks = PL2303_QUIRK_LEGACY,
164 }, 164 },
165 [TYPE_HX] = {
166 .max_baud_rate = 12000000,
167 },
165}; 168};
166 169
167static int pl2303_vendor_read(struct usb_serial *serial, u16 value, 170static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
@@ -395,16 +398,14 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
395 if (spriv->type->max_baud_rate) 398 if (spriv->type->max_baud_rate)
396 baud = min_t(speed_t, baud, spriv->type->max_baud_rate); 399 baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
397 /* 400 /*
398 * Set baud rate to nearest supported value. 401 * Use direct method for supported baud rates, otherwise use divisors.
399 *
400 * NOTE: Baud rate 500k can only be set using divisors.
401 */ 402 */
402 baud_sup = pl2303_get_supported_baud_rate(baud); 403 baud_sup = pl2303_get_supported_baud_rate(baud);
403 404
404 if (baud == 500000) 405 if (baud == baud_sup)
405 baud = pl2303_encode_baud_rate_divisor(buf, baud); 406 baud = pl2303_encode_baud_rate_direct(buf, baud);
406 else 407 else
407 baud = pl2303_encode_baud_rate_direct(buf, baud_sup); 408 baud = pl2303_encode_baud_rate_divisor(buf, baud);
408 409
409 /* Save resulting baud rate */ 410 /* Save resulting baud rate */
410 tty_encode_baud_rate(tty, baud, baud); 411 tty_encode_baud_rate(tty, baud, baud);