On Wed, Aug 13, 2014 at 07:51:52AM +0300, Lauri Hintsala wrote: Please describe your change also in the message body. > This change has been tested to work with PL-2303HX at 115200, 500000, > 1000000, 2000000, 2500000, 3000000 and 4000000 baud rates. 115200 and 3Mbaud can be set directly and are thus handled in the same way also after this change. > Signed-off-by: Lauri Hintsala <lauri.hintsala@xxxxxxxxxxxx> > --- > CC: Johan Hovold <jhovold@xxxxxxxxx> > CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > CC: linux-usb@xxxxxxxxxxxxxxx > > drivers/usb/serial/pl2303.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c > index b3d5a35..51f2420 100644 > --- a/drivers/usb/serial/pl2303.c > +++ b/drivers/usb/serial/pl2303.c > @@ -394,16 +394,14 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty, > if (spriv->type->max_baud_rate) > baud = min_t(speed_t, baud, spriv->type->max_baud_rate); > /* > - * Set baud rate to nearest supported value. > - * > - * NOTE: Baud rate 500k can only be set using divisors. > + * Use direct method for supported baud rates, otherwise use divisors. > */ > baud_sup = pl2303_get_supported_baud_rate(baud); > > - if (baud == 500000) > - baud = pl2303_encode_baud_rate_divisor(buf, baud); > + if (baud == baud_sup) > + baud = pl2303_encode_baud_rate_direct(buf, baud); > else > - baud = pl2303_encode_baud_rate_direct(buf, baud_sup); > + baud = pl2303_encode_baud_rate_divisor(buf, baud); The reason this hasn't been done already is partly that there are a bunch of devices out there that apparently cannot handle the divisor encoding. There were also some concerns raised about the accuracy of the current divisor calculations. Did you measure the resulting baud rates? We'd want to restrict the divisor encoding to chip types that support it (500 kbaud is only there for legacy reasons). Frank Schäfer did a great job at sorting out the details and there's some info in the git logs in some patches from him (that were prematurely merged and later reverted). Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html