mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
FROMLIST: clk: adjust clocks to their requested rate after parent changes
Given a hirarchy of clk1 -> [div] -> clk2, when the rate of clk1 gets changed, clk2 changes as well as the divider stays the same. There may be cases where a user of clk2 needs it at a specific rate, so clk2 needs to be readjusted for the changed rate of clk1. So if a rate was requested for the clock, and its rate changed during the underlying rate-change, with this change the clock framework now tries to readjust the rate back to/near the requested one. The whole process is protected by a new clock-flag to not force this behaviour change onto every clock defined in the ccf. (am from https://patchwork.kernel.org/patch/8993761/) Change-Id: Ie2636710cb4e66815ee45b28ec86eeaaa47c55c7 Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
committed by
Tao Huang
parent
679371c2f0
commit
12da448610
@@ -1753,6 +1753,9 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
|
||||
return fail_clk;
|
||||
}
|
||||
|
||||
static int clk_core_set_rate_nolock(struct clk_core *core,
|
||||
unsigned long req_rate);
|
||||
|
||||
/*
|
||||
* walk down a subtree and set the new rates notifying the rate
|
||||
* change on the way
|
||||
@@ -1851,6 +1854,12 @@ static void clk_change_rate(struct clk_core *core)
|
||||
if (core->new_child)
|
||||
clk_change_rate(core->new_child);
|
||||
|
||||
/* handle a changed clock that needs to readjust its rate */
|
||||
if (core->flags & CLK_KEEP_REQ_RATE && core->req_rate
|
||||
&& core->new_rate != old_rate
|
||||
&& core->new_rate != core->req_rate)
|
||||
clk_core_set_rate_nolock(core, core->req_rate);
|
||||
|
||||
clk_pm_runtime_put(core);
|
||||
}
|
||||
|
||||
@@ -1920,10 +1929,11 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
|
||||
goto err;
|
||||
}
|
||||
|
||||
core->req_rate = req_rate;
|
||||
|
||||
/* change the rates */
|
||||
clk_change_rate(top);
|
||||
|
||||
core->req_rate = req_rate;
|
||||
err:
|
||||
clk_pm_runtime_put(core);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#define CLK_OPS_PARENT_ENABLE BIT(12)
|
||||
/* duty cycle call may be forwarded to the parent clock */
|
||||
#define CLK_DUTY_CYCLE_PARENT BIT(13)
|
||||
#define CLK_KEEP_REQ_RATE BIT(14) /* keep reqrate on parent rate change */
|
||||
|
||||
struct clk;
|
||||
struct clk_hw;
|
||||
|
||||
Reference in New Issue
Block a user