[PATCH 8/8] pl2303: add two comments concerning the supported baud rates with HX chips

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

 



I've found some new datasheets which describe some additionally supported
standard baud rates and I've verified them with my HX (rev. 3A) device.
But adding support for individual (chip type specific) baud rates would add a
good amount of extra code (especially when support for further chips will be
added to the driver one day), which makes no sense as long as we are not using
the direct baud rate encoding method for newer chips.
So for now, just drop a comment about these additionally supported baud rates.

The second comment is about the baud rate differences between the two encoding
methods. In theory, we could optimize the code a bit by comparing the resulting
baud rates of both methods and selecting the one which is closer to the
requested baud rate. But that seems to be a bit overkill, because the
differences are very small and the device likely uses the same baud rate
generator for both methods so that the resulting baud rate would be the same.

Signed-off-by: Frank Schäfer <fschaefer.oss@xxxxxxxxxxxxxx>
---
 drivers/usb/serial/pl2303.c |   12 ++++++++++++
 1 Datei geändert, 12 Zeilen hinzugefügt(+)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 93a6465..c66c350 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -278,6 +278,12 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type,
 				 4800, 7200, 9600, 14400, 19200, 28800, 38400,
 				 57600, 115200, 230400, 460800, 614400, 921600,
 				 1228800, 2457600, 3000000, 6000000 };
+	/*
+	 * NOTE: The pl2303hx (tested with rev. 3A) also supports the following
+	 * baud rates: 128000, 134400, 161280, 201600, 268800, 403200, 806400.
+	 * As long as we are not using this encoding method for them, there is
+	 * no point in complicating the code to support them.
+	 */
 	int i;
 
 	/* Set baudrate to nearest supported value */
@@ -391,6 +397,12 @@ static void pl2303_encode_baudrate(struct tty_struct *tty,
 	 *    => supported by all chip types
 	 * 2) Divisor based method: encodes a divisor to a base value (12MHz*32)
 	 *    => supported by HX chips (and likely not by type_0/1 chips)
+	 *
+	 * NOTE: Although the divisor based baud rate encoding method is much
+	 * more flexible, some of the standard baud rate values can not be
+	 * realized exactly. But the difference is very small (max. 0.2%) and
+	 * the device likely uses the same baud rate generator for both methods
+	 * so that there is likley no difference.
 	 */
 	if (type != HX)
 		baud = pl2303_baudrate_encode_direct(baud, type, buf);
-- 
1.7.10.4

--
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