diff options
| author | Stephen Boyd <sboyd@kernel.org> | 2019-11-13 11:16:58 -0800 |
|---|---|---|
| committer | Stephen Boyd <sboyd@kernel.org> | 2019-11-13 11:16:58 -0800 |
| commit | 55ae8a11ee2124332cd676d59fa2e5425eb3555c (patch) | |
| tree | eeb57670a444e3530d37377db2b4583fb33bd241 /drivers | |
| parent | 54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c (diff) | |
| parent | d9b86cc48283112f06738d45031b88bd3f9ecb92 (diff) | |
Merge tag 'tegra-for-5.5-clk-core-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into clk-hw-parent-index
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
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/clk/clk.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 1c677d7f7f53..f8ed6e613436 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -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. */ |
