Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5e1a7346 authored by Shefali Jain's avatar Shefali Jain Committed by Gerrit - the friendly Code Review server
Browse files

clk: handle reentrant clk_set_rate() calls from clock supply regulators



When clk_set_rate() is called, clk_calc_new_rates() and clk_calc_subtree()
are used to determine the new rate needed for each clock in the affected
subtree as well as to vote for the voltage level needed by each clocks' new
rate. The regulator supplying a given clocks' voltage may itself depend
upon a clock (such as for the I2C bus). This can then result in a reentrant
clk_set_rate() call from within clk_calc_new_rate(). set_rate_nesting_count
only ensures that vdd_class voltage votes are not removed as a result of
reentrant clk_set_rate() calls from clk_change_rate(). Therefore, the
clk_set_rate() call from within clk_calc_new_rates() results in the voltage
votes for old rates being removed before the rates are physically changed
during clk_change_rate(). This can then lead to undervolting and CPU
lock-ups when scaling down the rate of a CPU clock.

Avoid this issue by incrementing set_rate_nesting_count before
clk_calc_new_rates(). This ensures that set_rate_nesting_count > 0
in the recursive clk_set_rate() call. That way, the old rate voltage votes
are correctly removed only upon returning from the original clk_set_rate()
call.

Change-Id: Iec4cc103a8ba09daf413eea07bbcafae1ac71900
Signed-off-by: default avatarShefali Jain <shefjain@codeaurora.org>
parent 3610811d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment