forked from Minki/linux
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:
parent
96051465fd
commit
7b8909940a
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user