aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2014-07-14 07:53:27 -0400
committerMaxime Ripard <maxime.ripard@free-electrons.com>2014-09-27 02:57:51 -0400
commit9824cf73c3a5e677bee6fcba43c4807e01ff1b4a (patch)
treec65ac6ebd96730efdc45d405dcacd85a0bed7b28 /drivers/clk
parent355bb165cd8bad2500df37437a9121f0177b6741 (diff)
clk: Add a function to retrieve phase
The current phase API doesn't look into the actual hardware to get the phase value, but will rather get it from a variable only set by the set_phase function. This will cause issue when the client driver will never call the set_phase function, where we can end up having a reported phase that will not match what the hardware has been programmed to by the bootloader or what phase is programmed out of reset. Add a new get_phase function for the drivers to implement so that we can get this value. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d87661af0c72..113d75db371d 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1934,6 +1934,16 @@ int __clk_init(struct device *dev, struct clk *clk)
1934 clk->accuracy = 0; 1934 clk->accuracy = 0;
1935 1935
1936 /* 1936 /*
1937 * Set clk's phase.
1938 * Since a phase is by definition relative to its parent, just
1939 * query the current clock phase, or just assume it's in phase.
1940 */
1941 if (clk->ops->get_phase)
1942 clk->phase = clk->ops->get_phase(clk->hw);
1943 else
1944 clk->phase = 0;
1945
1946 /*
1937 * Set clk's rate. The preferred method is to use .recalc_rate. For 1947 * Set clk's rate. The preferred method is to use .recalc_rate. For
1938 * simple clocks and lazy developers the default fallback is to use the 1948 * simple clocks and lazy developers the default fallback is to use the
1939 * parent's rate. If a clock doesn't have a parent (or is orphaned) 1949 * parent's rate. If a clock doesn't have a parent (or is orphaned)