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>
Signed-off-by: Thomas Makin <halorocker89@gmail.com>
This commit is contained in:
Alex Frid
2017-01-16 18:28:38 -08:00
committed by Thomas Makin
parent eeb92feb05
commit 13c3818949
2 changed files with 19 additions and 0 deletions

View File

@@ -2475,6 +2475,13 @@ static void clk_change_rate(struct clk_core *core)
if (core->flags & CLK_RECALC_NEW_RATES) if (core->flags & CLK_RECALC_NEW_RATES)
(void)clk_calc_new_rates(core, core->new_rate); (void)clk_calc_new_rates(core, core->new_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 * Use safe iteration, as change_rate can actually swap parents
* for certain clock types. * for certain clock types.
@@ -2490,6 +2497,9 @@ static void clk_change_rate(struct clk_core *core)
if (core->new_child) if (core->new_child)
clk_change_rate(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); 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 * POST_RATE_CHANGE - called after the clk rate change has successfully
* completed. Callbacks must always return NOTIFY_DONE or NOTIFY_OK. * 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 PRE_RATE_CHANGE BIT(0)
#define POST_RATE_CHANGE BIT(1) #define POST_RATE_CHANGE BIT(1)
#define ABORT_RATE_CHANGE BIT(2) #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 * struct clk_notifier - associate a clk with a notifier