mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
clk: add of_clk_src_onecell_get() support
For those SoCs that have hundreds of clock outputs, their clock DT bindings could reasonably define #clock-cells as 1 and require the client device specify the index of the clock it consumes in the cell of its "clocks" phandle. Add a generic of_clk_src_onecell_get() function for this purpose. Signed-off-by: Shawn Guo <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
This commit is contained in:
parent
09b9b2b204
commit
494bfec999
2 changed files with 19 additions and 0 deletions
|
|
@ -1587,6 +1587,20 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(of_clk_src_simple_get);
|
||||
|
||||
struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
|
||||
{
|
||||
struct clk_onecell_data *clk_data = data;
|
||||
unsigned int idx = clkspec->args[0];
|
||||
|
||||
if (idx >= clk_data->clk_num) {
|
||||
pr_err("%s: invalid clock index %d\n", __func__, idx);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
return clk_data->clks[idx];
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_clk_src_onecell_get);
|
||||
|
||||
/**
|
||||
* of_clk_add_provider() - Register a clock provider for a node
|
||||
* @np: Device node pointer associated with clock provider
|
||||
|
|
|
|||
Loading…
Reference in a new issue