* [PATCH] serial: 2.6.9rc1 pick nearest baud rate divider
@ 2004-09-21 15:34 roger blofeld
0 siblings, 0 replies; only message in thread
From: roger blofeld @ 2004-09-21 15:34 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-21 15:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 15:34 [PATCH] serial: 2.6.9rc1 pick nearest baud rate divider roger blofeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®