From: Tomeu Vizoso Date: Wed, 11 Mar 2015 10:34:25 +0000 (+0100) Subject: clk: Expose clk_hw_reparent() to providers X-Git-Tag: KARO-TXA5-2015-06-26~139^2~1^2~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f002cb771dd61ab37d60367ad560d5774e61d061;p=karo-tx-linux.git clk: Expose clk_hw_reparent() to providers To be used by clock implementations for switching to a new parent during rate change. Signed-off-by: Tomeu Vizoso Acked-by: Mike Turquette Signed-off-by: Thierry Reding --- diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index eb0152961d3c..f7930257b33b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1968,6 +1968,14 @@ static void clk_core_reparent(struct clk_core *clk, __clk_recalc_rates(clk, POST_RATE_CHANGE); } +void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent) +{ + if (!hw) + return; + + clk_core_reparent(hw->core, !new_parent ? NULL : new_parent->core); +} + /** * clk_has_parent - check if a clock is a possible parent for another * @clk: clock source diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5591ea71a8d1..28abf1badb40 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -589,6 +589,7 @@ long __clk_mux_determine_rate_closest(struct clk_hw *hw, unsigned long rate, unsigned long max_rate, unsigned long *best_parent_rate, struct clk_hw **best_parent_p); +void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src) {