diff options
author | Boris BREZILLON <b.brezillon@overkiz.com> | 2013-12-21 10:34:47 +0100 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-12-22 23:14:27 -0800 |
commit | 5279fc402ae59361a224d641d5823b21b4206232 (patch) | |
tree | 0d6ab9695d994cedc85c32b08f6e8d211acf4207 /include/linux/clk.h | |
parent | e8ab2f11bb8fa73280ce7d0fca3c22be456437df (diff) |
clk: add clk accuracy retrieval support
The clock accuracy is expressed in ppb (parts per billion) and represents
the possible clock drift.
Say you have a clock (e.g. an oscillator) which provides a fixed clock of
20MHz with an accuracy of +- 20Hz. This accuracy expressed in ppb is
20Hz/20MHz = 1000 ppb (or 1 ppm).
Clock users may need the clock accuracy information in order to choose
the best clock (the one with the best accuracy) across several available
clocks.
This patch adds clk accuracy retrieval support for common clk framework by
means of a new function called clk_get_accuracy.
This function returns the given clock accuracy expressed in ppb.
In order to get the clock accuracy, this implementation adds one callback
called recalc_accuracy to the clk_ops structure.
This callback is given the parent clock accuracy (if the clock is not a
root clock) and should recalculate the given clock accuracy.
This callback is optional and may be implemented if the clock is not
a perfect clock (accuracy != 0 ppb).
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r-- | include/linux/clk.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index 9a6d04524b1a..0dd91148165e 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -82,6 +82,23 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb); int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); +/** + * clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion) + * for a clock source. + * @clk: clock source + * + * This gets the clock source accuracy expressed in ppb. + * A perfect clock returns 0. + */ +long clk_get_accuracy(struct clk *clk); + +#else + +static inline long clk_get_accuracy(struct clk *clk) +{ + return -ENOTSUPP; +} + #endif /** |