]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
clk: core: introduce clk_hw_set_parent()
authorNeil Armstrong <narmstrong@baylibre.com>
Wed, 31 Jul 2019 08:40:16 +0000 (10:40 +0200)
committerJerome Brunet <jbrunet@baylibre.com>
Fri, 9 Aug 2019 10:09:52 +0000 (12:09 +0200)
Introduce the clk_hw_set_parent() provider call to change parent of
a clock by using the clk_hw pointers.

This eases the clock reparenting from clock rate notifiers and
implementing DVFS with simpler code avoiding the boilerplates
functions as __clk_lookup(clk_hw_get_name()) then clk_set_parent().

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
drivers/clk/clk.c
include/linux/clk-provider.h

index c0990703ce5403c1092bda6d982c56dffd70e6a0..c11b1781d24ae95b929feecc5910207372ef4190 100644 (file)
@@ -2487,6 +2487,12 @@ static int clk_core_set_parent_nolock(struct clk_core *core,
        return ret;
 }
 
+int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *parent)
+{
+       return clk_core_set_parent_nolock(hw->core, parent->core);
+}
+EXPORT_SYMBOL_GPL(clk_hw_set_parent);
+
 /**
  * clk_set_parent - switch the parent of a mux clk
  * @clk: the mux clk whose input we are switching
index 2ae7604783dd1b4e12f4a3f36ed4b976dde3faf8..dce5521a9bf6e13a293d6c15bab042e168178930 100644 (file)
@@ -817,6 +817,7 @@ unsigned int clk_hw_get_num_parents(const struct clk_hw *hw);
 struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw);
 struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
                                          unsigned int index);
+int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent);
 unsigned int __clk_get_enable_count(struct clk *clk);
 unsigned long clk_hw_get_rate(const struct clk_hw *hw);
 unsigned long __clk_get_flags(struct clk *clk);