mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
lib: isolate rational fractions helper function
Provide a helper function to determine optimum numerator denominator value pairs taking into account restricted register size. Useful especially with PLL and other clock configurations. Signed-off-by: Oskar Schirmer <os@emlix.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9f322ad064
commit
8759ef32d9
4 changed files with 85 additions and 0 deletions
19
include/linux/rational.h
Normal file
19
include/linux/rational.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* rational fractions
|
||||
*
|
||||
* Copyright (C) 2009 emlix GmbH, Oskar Schirmer <os@emlix.com>
|
||||
*
|
||||
* helper functions when coping with rational numbers,
|
||||
* e.g. when calculating optimum numerator/denominator pairs for
|
||||
* pll configuration taking into account restricted register size
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_RATIONAL_H
|
||||
#define _LINUX_RATIONAL_H
|
||||
|
||||
void rational_best_approximation(
|
||||
unsigned long given_numerator, unsigned long given_denominator,
|
||||
unsigned long max_numerator, unsigned long max_denominator,
|
||||
unsigned long *best_numerator, unsigned long *best_denominator);
|
||||
|
||||
#endif /* _LINUX_RATIONAL_H */
|
Loading…
Add table
Add a link
Reference in a new issue