diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-03-02 10:36:45 +0100 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-03-09 01:40:24 +0100 |
commit | f006a8e343e8e85307771021fe88afb8ea15b1d2 (patch) | |
tree | 828b305d94e90402522e7ab4623737a62b6d87f2 | |
parent | f76b06c90c2058965ee490a8e7dc96b959c02841 (diff) |
dm: clk: lookup callbak into CCU-like clock devices
-rw-r--r-- | drivers/clk/clk-uclass.c | 7 | ||||
-rw-r--r-- | include/clk-uclass.h | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index a6a65b2a66..fe52ee8e69 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -133,6 +133,13 @@ int clk_get_by_output_name(const char *output_name, struct clk *clk) dev_of_offset(dev), "clock-output-names", output_name); + + if (idx < 0 && clk_dev_ops(dev)->lookup) { + clk->dev = dev; + if (clk_dev_ops(dev)->lookup(clk, output_name) == 0) + return clk->id; + } + if (idx < 0) continue; diff --git a/include/clk-uclass.h b/include/clk-uclass.h index 07c1065495..b764d77529 100644 --- a/include/clk-uclass.h +++ b/include/clk-uclass.h @@ -90,6 +90,18 @@ struct clk_ops { * @return zero on success, or -ve error code. */ int (*disable)(struct clk *clk); + /** + * lookup - Find a clock from a human-readable name. + * + * The clock core calls this function as a fallback in implementing + * a client's clk_get_by_output_name() call, if an 'output-names' + * property is not present. + * + * @clock: The clock struct to hold the translation result. + * @name: The clock specifier values from device tree. + * @return zero on success, or a negative error code. + */ + int (*lookup)(struct clk *clock, const char *name); }; #endif |