diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d02451f951cf..886718dc83e6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2475,6 +2475,13 @@ static void clk_change_rate(struct clk_core *core) if (core->flags & CLK_RECALC_NEW_RATES) (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 * for certain clock types. @@ -2490,6 +2497,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); } diff --git a/include/linux/clk.h b/include/linux/clk.h index 851a0f2cf42c..09064fcd4c76 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -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