dect
/
linux-2.6
Archived
13
0
Fork 0

cpm2: Round the baud-rate clock divider to the nearest integer.

Instead of rounding the divider down, improve the baud-rate generators
accuracy by rounding to the nearest integer.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This commit is contained in:
Laurent Pinchart 2008-11-20 13:32:23 +01:00 committed by Kumar Gala
parent 96051465fd
commit 7b8909940a
1 changed files with 2 additions and 1 deletions

View File

@ -129,7 +129,8 @@ void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src)
brg -= 4;
}
bp += brg;
val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src;
/* Round the clock divider to the nearest integer. */
val = (((clk * 2 / rate) - 1) & ~1) | CPM_BRG_EN | src;
if (div16)
val |= CPM_BRG_DIV16;