Re: [PATCH v3] pl2303: use divisors for unsupported baud rates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 13, 2014 at 03:02:53PM +0300, Lauri Hintsala wrote:
> Use direct method for supported baud rates, otherwise use divisors.
> Limit baud rate to 12 Mbaud with HX type.
> 
> This change has been tested to work with PL-2303HX at 115200, 500000,
> 1000000, 2000000, 2500000, 3000000 and 4000000 baud rates.
> 
> Signed-off-by: Lauri Hintsala <lauri.hintsala@xxxxxxxxxxxx>

Looks good. I'll queue this up after the merge window.

Thanks,
Johan

> ---
> CC: Johan Hovold <jhovold@xxxxxxxxx>
> CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> CC: Frank Schäfer <fschaefer.oss@xxxxxxxxxxxxxx>
> CC: linux-usb@xxxxxxxxxxxxxxx
> 
> Changes since V2:
> * fixed typo in type name
> 
> Changes since V1:
> * added baud rate limit for HX
> 
> 
>  drivers/usb/serial/pl2303.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index b3d5a35..0a9a3b3 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -161,6 +161,9 @@ static const struct pl2303_type_data pl2303_type_data[TYPE_COUNT] = {
>  		.max_baud_rate =	1228800,
>  		.quirks =		PL2303_QUIRK_LEGACY,
>  	},
> +	[TYPE_HX] = {
> +		.max_baud_rate =	12000000,
> +	},
>  };
>  
>  static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
> @@ -394,16 +397,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);
>  
>  	/* Save resulting baud rate */
>  	tty_encode_baud_rate(tty, baud, baud);
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux