Skip to content

Commit

Permalink
clk: composite: allow read-only clocks
Browse files Browse the repository at this point in the history
This allows readl-only composite clocks by making mux_ops->set_parent and
divider_ops->round_rate/set_rate optional.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-By: Max Schwarz <max.schwarz@online.de>
Tested-By: Max Schwarz <max.schwarz@online.de>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Heiko Stübner authored and Mike Turquette committed Jul 13, 2014
1 parent 3eb635f commit 0c02cf2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/clk/clk-composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,16 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
clk_composite_ops = &composite->ops;

if (mux_hw && mux_ops) {
if (!mux_ops->get_parent || !mux_ops->set_parent) {
if (!mux_ops->get_parent) {
clk = ERR_PTR(-EINVAL);
goto err;
}

composite->mux_hw = mux_hw;
composite->mux_ops = mux_ops;
clk_composite_ops->get_parent = clk_composite_get_parent;
clk_composite_ops->set_parent = clk_composite_set_parent;
if (mux_ops->set_parent)
clk_composite_ops->set_parent = clk_composite_set_parent;
if (mux_ops->determine_rate)
clk_composite_ops->determine_rate = clk_composite_determine_rate;
}
Expand All @@ -232,10 +233,6 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
if (rate_ops->set_rate) {
clk_composite_ops->set_rate = clk_composite_set_rate;
}
} else {
WARN(rate_ops->set_rate,
"%s: missing round_rate op is required\n",
__func__);
}

composite->rate_hw = rate_hw;
Expand Down

0 comments on commit 0c02cf2

Please sign in to comment.