serial: 2.6.9rc1 pick nearest baud rate divider
PATCH 1/1 serial: 2.6.9rc1 pick nearest baud rate divider
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 =====
drivers/serial/serial_core.c 2004-09-15 14:04:34 -05:00 renamed from drivers/serial/serial_core.c 2004-06-29 09:43:58 -05:00 +0 -0
@@ -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