clk: tegra: Add subtree change notifications

Added PRE_SUBTREE_CHANGE and POST_SUBTREE_CHANGE that called before
and after rate change is propagated down the sub-tree rooted in clk.
This would allow children to be aware that next set rate operation
is triggered by downward rate propagation, rather than direct set rate
on a child clock.

Bug 200267979

Change-Id: I6f2acbeca7cead0ecd385dcb2e58ced32448e998
Signed-off-by: Alex Frid <afrid@nvidia.com>
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
(cherry picked from commit 62f0d763fcb6c9d5bd9a373d22d802503ab0fdc5)
Reviewed-on: https://git-master.nvidia.com/r/1558143
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
This commit is contained in:
Alex Frid
2017-01-16 18:28:38 -08:00
committed by Thomas Makin
parent 40e516ee4b
commit 5d5fa5fea6
2 changed files with 19 additions and 0 deletions

View File

@@ -2554,6 +2554,13 @@ static void clk_change_rate(struct clk_core *core)
if (core->ops->post_rate_change)
core->ops->post_rate_change(core->hw, old_rate, core->rate);
/*
* Allow children to be aware that next set rate operation is triggered
* by downward rate propagation, rather than direct set rate on itself.
*/
if (core->notifier_count)
__clk_notify(core, PRE_SUBTREE_CHANGE, old_rate, core->rate);
/*
* Use safe iteration, as change_rate can actually swap parents
* for certain clock types.
@@ -2569,6 +2576,9 @@ static void clk_change_rate(struct clk_core *core)
if (core->new_child)
clk_change_rate(core->new_child);
if (core->notifier_count)
__clk_notify(core, POST_SUBTREE_CHANGE, old_rate, core->rate);
clk_pm_runtime_put(core);
}

View File

@@ -35,10 +35,19 @@ struct of_phandle_args;
* POST_RATE_CHANGE - called after the clk rate change has successfully
* completed. Callbacks must always return NOTIFY_DONE or NOTIFY_OK.
*
* PRE_SUBTREE_UPDATE - called before rate change is propagated down to
* sub-tree rooted in clk. Callbacks must always return NOTIFY_DONE
* or NOTIFY_OK.
*
* POST_SUBTREE_UPDATE - called after rate change is propagated down to
* sub-tree rooted in clk. Callbacks must always return NOTIFY_DONE
* or NOTIFY_OK.
*/
#define PRE_RATE_CHANGE BIT(0)
#define POST_RATE_CHANGE BIT(1)
#define ABORT_RATE_CHANGE BIT(2)
#define PRE_SUBTREE_CHANGE BIT(3)
#define POST_SUBTREE_CHANGE BIT(4)
/**
* struct clk_notifier - associate a clk with a notifier