clk: composite: support determine_rate using rate_ops->round_rate + mux_ops->set_parent
authorBoris BREZILLON <b.brezillon@overkiz.com>
Wed, 2 Jul 2014 23:56:45 +0000 (01:56 +0200)
committerMike Turquette <mturquette@linaro.org>
Sun, 13 Jul 2014 19:16:08 +0000 (12:16 -0700)
commit3eb635f1ca2d25bd11a697f5bdb52ac3d08c240e
treeabf4cea3e07c44c2049078c35b9cf3e70138192a
parent4c834452aad01531db949414f94f817a86348d59
clk: composite: support determine_rate using rate_ops->round_rate + mux_ops->set_parent

In case the rate_hw does not implement determine_rate, but only round_rate
we fallback to best_parent selection if mux_hw is present and support
reparenting.

This also fixes a rate calculation problem when using the standard div and
mux ops, as in this case currently only the mux->determine_rate is used
in the composite rate calculation.
So when for example the composite clock has two parents at 600 and 800MHz,
the requested rate is 75MHz, which the divider could provide, without this
change the rate would be set 600MHz ignoring the divider completely.
This may be way out of spec for the component.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[heiko@sntech.de: fixed output return a rate instead of the diff]
Acked-By: Max Schwarz <max.schwarz@online.de>
Tested-By: Max Schwarz <max.schwarz@online.de>
Tested-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk-composite.c