]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Merge tag 'tegra-for-5.5-clk-core-v2' of git://git.kernel.org/pub/scm/linux/kernel...
authorStephen Boyd <sboyd@kernel.org>
Wed, 13 Nov 2019 19:16:58 +0000 (11:16 -0800)
committerStephen Boyd <sboyd@kernel.org>
Wed, 13 Nov 2019 19:16:58 +0000 (11:16 -0800)
Pull clk framework change from Thierry Reding:

Contains a single core API addition that allows clock providers to query
the parent index for a given struct clk_hw. This is used to implement
suspend/resume support on Tegra SoCs.

* tag 'tegra-for-5.5-clk-core-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  clk: Add API to get index of the clock parent

drivers/clk/clk.c
include/linux/clk-provider.h

index 1c677d7f7f530739ef2dd91428697d308dee3349..f8ed6e613436973f56284c1cbb10b801c00e8136 100644 (file)
@@ -1674,6 +1674,24 @@ static int clk_fetch_parent_index(struct clk_core *core,
        return i;
 }
 
+/**
+ * clk_hw_get_parent_index - return the index of the parent clock
+ * @hw: clk_hw associated with the clk being consumed
+ *
+ * Fetches and returns the index of parent clock. Returns -EINVAL if the given
+ * clock does not have a current parent.
+ */
+int clk_hw_get_parent_index(struct clk_hw *hw)
+{
+       struct clk_hw *parent = clk_hw_get_parent(hw);
+
+       if (WARN_ON(parent == NULL))
+               return -EINVAL;
+
+       return clk_fetch_parent_index(hw->core, parent->core);
+}
+EXPORT_SYMBOL_GPL(clk_hw_get_parent_index);
+
 /*
  * Update the orphan status of @core and all its children.
  */
index 2fdfe80613635093be0aee02feeeb808d8edb36a..caf4b9df16ebe09ee91eee9fac753422025241b2 100644 (file)
@@ -818,6 +818,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_get_parent_index(struct clk_hw *hw);
 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);