diff options
-rw-r--r-- | drivers/clk/clk.c | 10 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d87661af0c72..113d75db371d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1934,6 +1934,16 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1934 | clk->accuracy = 0; | 1934 | clk->accuracy = 0; |
1935 | 1935 | ||
1936 | /* | 1936 | /* |
1937 | * Set clk's phase. | ||
1938 | * Since a phase is by definition relative to its parent, just | ||
1939 | * query the current clock phase, or just assume it's in phase. | ||
1940 | */ | ||
1941 | if (clk->ops->get_phase) | ||
1942 | clk->phase = clk->ops->get_phase(clk->hw); | ||
1943 | else | ||
1944 | clk->phase = 0; | ||
1945 | |||
1946 | /* | ||
1937 | * Set clk's rate. The preferred method is to use .recalc_rate. For | 1947 | * Set clk's rate. The preferred method is to use .recalc_rate. For |
1938 | * simple clocks and lazy developers the default fallback is to use the | 1948 | * simple clocks and lazy developers the default fallback is to use the |
1939 | * parent's rate. If a clock doesn't have a parent (or is orphaned) | 1949 | * parent's rate. If a clock doesn't have a parent (or is orphaned) |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 69b20d4c1e1a..abec961092a7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -130,6 +130,10 @@ struct dentry; | |||
130 | * set then clock accuracy will be initialized to parent accuracy | 130 | * set then clock accuracy will be initialized to parent accuracy |
131 | * or 0 (perfect clock) if clock has no parent. | 131 | * or 0 (perfect clock) if clock has no parent. |
132 | * | 132 | * |
133 | * @get_phase: Queries the hardware to get the current phase of a clock. | ||
134 | * Returned values are 0-359 degrees on success, negative | ||
135 | * error codes on failure. | ||
136 | * | ||
133 | * @set_phase: Shift the phase this clock signal in degrees specified | 137 | * @set_phase: Shift the phase this clock signal in degrees specified |
134 | * by the second argument. Valid values for degrees are | 138 | * by the second argument. Valid values for degrees are |
135 | * 0-359. Return 0 on success, otherwise -EERROR. | 139 | * 0-359. Return 0 on success, otherwise -EERROR. |
@@ -182,6 +186,7 @@ struct clk_ops { | |||
182 | unsigned long parent_rate, u8 index); | 186 | unsigned long parent_rate, u8 index); |
183 | unsigned long (*recalc_accuracy)(struct clk_hw *hw, | 187 | unsigned long (*recalc_accuracy)(struct clk_hw *hw, |
184 | unsigned long parent_accuracy); | 188 | unsigned long parent_accuracy); |
189 | int (*get_phase)(struct clk_hw *hw); | ||
185 | int (*set_phase)(struct clk_hw *hw, int degrees); | 190 | int (*set_phase)(struct clk_hw *hw, int degrees); |
186 | void (*init)(struct clk_hw *hw); | 191 | void (*init)(struct clk_hw *hw); |
187 | int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); | 192 | int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); |