From 5279fc402ae59361a224d641d5823b21b4206232 Mon Sep 17 00:00:00 2001 From: Boris BREZILLON Date: Sat, 21 Dec 2013 10:34:47 +0100 Subject: 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 Signed-off-by: Mike Turquette --- Documentation/clk.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/clk.txt') diff --git a/Documentation/clk.txt b/Documentation/clk.txt index 3aeb5c440442..eb20198783cd 100644 --- a/Documentation/clk.txt +++ b/Documentation/clk.txt @@ -77,6 +77,8 @@ the operations defined in clk.h: int (*set_parent)(struct clk_hw *hw, u8 index); u8 (*get_parent)(struct clk_hw *hw); int (*set_rate)(struct clk_hw *hw, unsigned long); + unsigned long (*recalc_accuracy)(struct clk_hw *hw, + unsigned long parent_accuracy); void (*init)(struct clk_hw *hw); }; @@ -202,6 +204,8 @@ optional or must be evaluated on a case-by-case basis. .set_parent | | | n | y | n | .get_parent | | | n | y | n | | | | | | | +.recalc_accuracy| | | | | | + | | | | | | .init | | | | | | ----------------------------------------------------------- [1] either one of round_rate or determine_rate is required. -- cgit v1.2.3-59-g8ed1b