Commit 9e4d04ad authored by Jerome Brunet's avatar Jerome Brunet Committed by Michael Turquette

clk: add clk_core_set_phase_nolock function

Create a core function for set_phase, as it is done for set_rate and
set_parent.

This rework is done to ease the integration of "protected" clock
functionality.
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Tested-by: default avatarQuentin Schulz <quentin.schulz@free-electrons.com>
Tested-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: default avatarMichael Turquette <mturquette@baylibre.com>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarMichael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/20171201215200.23523-4-jbrunet@baylibre.com
parent 91baa9ff
......@@ -1966,6 +1966,25 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
}
EXPORT_SYMBOL_GPL(clk_set_parent);
static int clk_core_set_phase_nolock(struct clk_core *core, int degrees)
{
int ret = -EINVAL;
lockdep_assert_held(&prepare_lock);
if (!core)
return 0;
trace_clk_set_phase(core, degrees);
if (core->ops->set_phase)
ret = core->ops->set_phase(core->hw, degrees);
trace_clk_set_phase_complete(core, degrees);
return ret;
}
/**
* clk_set_phase - adjust the phase shift of a clock signal
* @clk: clock signal source
......@@ -1988,7 +2007,7 @@ EXPORT_SYMBOL_GPL(clk_set_parent);
*/
int clk_set_phase(struct clk *clk, int degrees)
{
int ret = -EINVAL;
int ret;
if (!clk)
return 0;
......@@ -1999,17 +2018,7 @@ int clk_set_phase(struct clk *clk, int degrees)
degrees += 360;
clk_prepare_lock();
trace_clk_set_phase(clk->core, degrees);
if (clk->core->ops->set_phase)
ret = clk->core->ops->set_phase(clk->core->hw, degrees);
trace_clk_set_phase_complete(clk->core, degrees);
if (!ret)
clk->core->phase = degrees;
ret = clk_core_set_phase_nolock(clk->core, degrees);
clk_prepare_unlock();
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment