Skip to content

Commit 2f7b1f9

Browse files
shawn1221ZhengShunQian
authored andcommitted
clk: Don't show the incorrect clock phase
[ Upstream commit 1f9c63e ] It's found that the clock phase output from clk_summary is wrong compared to the actual phase reading from the register. cat /sys/kernel/debug/clk/clk_summary | grep sdio_sample sdio_sample 0 1 0 50000000 0 -22 It exposes an issue that clk core, clk_core_get_phase, always returns the cached core->phase which should be either updated by calling clk_set_phase or directly from the first place the clk was registered. When registering the clk, the core->phase geting from ->get_phase() may return negative value indicating error. This is quite common since the clk's phase may be highly related to its parent chain, but it was temporarily orphan when registered, since its parent chains hadn't be ready at that time, so the clk drivers decide to return error in this case. However, if no clk_set_phase is called or maybe the ->set_phase() isn't even implemented, the core->phase would never be updated. This is wrong, and we should try to update it when all its parent chains are settled down, like the way of updating clock rate for that. But it's not deserved to complicate the code now and just update it anyway when calling clk_core_get_phase, which would be much simple and enough. Signed-off-by: Shawn Lin <[email protected]> Acked-by: Jerome Brunet <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c9284b7 commit 2f7b1f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ static int clk_core_get_phase(struct clk_core *core)
19451945
int ret;
19461946

19471947
clk_prepare_lock();
1948-
/* Always try to update cached phase if possible since */
1948+
/* Always try to update cached phase if possible */
19491949
if (core->ops->get_phase)
19501950
core->phase = core->ops->get_phase(core->hw);
19511951
ret = core->phase;

0 commit comments

Comments
 (0)