diff options
| author | Mike Turquette <mturquette@linaro.org> | 2014-02-19 00:21:25 -0500 |
|---|---|---|
| committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-09-27 02:57:38 -0400 |
| commit | e59c5371fb9d8268d1c043172e88cecab9dc934f (patch) | |
| tree | 54acf05ccfffdc1dc17dd3c0adb92f54332e0bb0 /include/linux | |
| parent | cfe4c93b58924b3764cd7269d3d953049405e938 (diff) | |
clk: introduce clk_set_phase function & callback
A common operation for a clock signal generator is to shift the phase of
that signal. This patch introduces a new function to the clk.h API to
dynamically adjust the phase of a clock signal. Additionally this patch
introduces support for the new function in the common clock framework
via the .set_phase call back in struct clk_ops.
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/clk-private.h | 1 | ||||
| -rw-r--r-- | include/linux/clk-provider.h | 5 | ||||
| -rw-r--r-- | include/linux/clk.h | 29 |
3 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index efbf70b9fd84..845be30be50f 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h | |||
| @@ -46,6 +46,7 @@ struct clk { | |||
| 46 | unsigned int enable_count; | 46 | unsigned int enable_count; |
| 47 | unsigned int prepare_count; | 47 | unsigned int prepare_count; |
| 48 | unsigned long accuracy; | 48 | unsigned long accuracy; |
| 49 | int phase; | ||
| 49 | struct hlist_head children; | 50 | struct hlist_head children; |
| 50 | struct hlist_node child_node; | 51 | struct hlist_node child_node; |
| 51 | unsigned int notifier_count; | 52 | unsigned int notifier_count; |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 411dd7eb2653..201a6195a3eb 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
| @@ -129,6 +129,10 @@ struct dentry; | |||
| 129 | * set then clock accuracy will be initialized to parent accuracy | 129 | * set then clock accuracy will be initialized to parent accuracy |
| 130 | * or 0 (perfect clock) if clock has no parent. | 130 | * or 0 (perfect clock) if clock has no parent. |
| 131 | * | 131 | * |
| 132 | * @set_phase: Shift the phase this clock signal in degrees specified | ||
| 133 | * by the second argument. Valid values for degrees are | ||
| 134 | * 0-359. Return 0 on success, otherwise -EERROR. | ||
| 135 | * | ||
| 132 | * @init: Perform platform-specific initialization magic. | 136 | * @init: Perform platform-specific initialization magic. |
| 133 | * This is not not used by any of the basic clock types. | 137 | * This is not not used by any of the basic clock types. |
| 134 | * Please consider other ways of solving initialization problems | 138 | * Please consider other ways of solving initialization problems |
| @@ -177,6 +181,7 @@ struct clk_ops { | |||
| 177 | unsigned long parent_rate, u8 index); | 181 | unsigned long parent_rate, u8 index); |
| 178 | unsigned long (*recalc_accuracy)(struct clk_hw *hw, | 182 | unsigned long (*recalc_accuracy)(struct clk_hw *hw, |
| 179 | unsigned long parent_accuracy); | 183 | unsigned long parent_accuracy); |
| 184 | int (*set_phase)(struct clk_hw *hw, int degrees); | ||
| 180 | void (*init)(struct clk_hw *hw); | 185 | void (*init)(struct clk_hw *hw); |
| 181 | int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); | 186 | int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); |
| 182 | }; | 187 | }; |
diff --git a/include/linux/clk.h b/include/linux/clk.h index fb5e097d8f72..38bdedd3e389 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
| @@ -106,6 +106,25 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); | |||
| 106 | */ | 106 | */ |
| 107 | long clk_get_accuracy(struct clk *clk); | 107 | long clk_get_accuracy(struct clk *clk); |
| 108 | 108 | ||
| 109 | /** | ||
| 110 | * clk_set_phase - adjust the phase shift of a clock signal | ||
| 111 | * @clk: clock signal source | ||
| 112 | * @degrees: number of degrees the signal is shifted | ||
| 113 | * | ||
| 114 | * Shifts the phase of a clock signal by the specified degrees. Returns 0 on | ||
| 115 | * success, -EERROR otherwise. | ||
| 116 | */ | ||
| 117 | int clk_set_phase(struct clk *clk, int degrees); | ||
| 118 | |||
| 119 | /** | ||
| 120 | * clk_get_phase - return the phase shift of a clock signal | ||
| 121 | * @clk: clock signal source | ||
| 122 | * | ||
| 123 | * Returns the phase shift of a clock node in degrees, otherwise returns | ||
| 124 | * -EERROR. | ||
| 125 | */ | ||
| 126 | int clk_get_phase(struct clk *clk); | ||
| 127 | |||
| 109 | #else | 128 | #else |
| 110 | 129 | ||
| 111 | static inline long clk_get_accuracy(struct clk *clk) | 130 | static inline long clk_get_accuracy(struct clk *clk) |
| @@ -113,6 +132,16 @@ static inline long clk_get_accuracy(struct clk *clk) | |||
| 113 | return -ENOTSUPP; | 132 | return -ENOTSUPP; |
| 114 | } | 133 | } |
| 115 | 134 | ||
| 135 | static inline long clk_set_phase(struct clk *clk, int phase) | ||
| 136 | { | ||
| 137 | return -ENOTSUPP; | ||
| 138 | } | ||
| 139 | |||
| 140 | static inline long clk_get_phase(struct clk *clk) | ||
| 141 | { | ||
| 142 | return -ENOTSUPP; | ||
| 143 | } | ||
| 144 | |||
| 116 | #endif | 145 | #endif |
| 117 | 146 | ||
| 118 | /** | 147 | /** |
