[PATCH] serial: 2.6.9rc1 pick nearest baud rate divider

From: roger blofeld
Date: Tue Sep 21 2004 - 10:38:37 EST


This patch modifies uart_get_divisor to select the nearest baud rate
divider rather than the lowest. It minimizes baud rate errors.

For example, if uartclk is 33000000 and baud is 115200 the ratio is
about 17.9
The current code selects 17 (5% error) but should select 18 (0.5%
error)

-roger

===== drivers/serial/serial_core.c 1.87 vs edited =====
--- 1.87/drivers/serial/serial_core.c 2004-06-29 09:43:58 -05:00
+++ edited/drivers/serial/serial_core.c 2004-09-15 14:04:34 -05:00
@@ -403,7 +403,7 @@
if (baud == 38400 && (port->flags & UPF_SPD_MASK) ==
UPF_SPD_CUST)
quot = port->custom_divisor;
else
- quot = port->uartclk / (16 * baud);
+ quot = (port->uartclk + (8 * baud)) / (16 * baud);

return quot;
}


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/