]> git.baikalelectronics.ru Git - uboot.git/commit
lib: rational: copy the rational fraction lib routines from Linux
authorTero Kristo <t-kristo@ti.com>
Fri, 11 Jun 2021 08:45:02 +0000 (11:45 +0300)
committerLokesh Vutla <lokeshvutla@ti.com>
Fri, 11 Jun 2021 11:04:52 +0000 (16:34 +0530)
commit2b4b869a140106996e9f5ced6326afa1600f41c8
treebdb88eb5255e85ff5e35815ce0ff85ea1bad0c87
parentef210c8df41a361955f93a5875c97348112b8657
lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>
include/linux/rational.h [new file with mode: 0644]
lib/Kconfig
lib/Makefile
lib/rational.c [new file with mode: 0644]