Skip to content

Commit 170b763

Browse files
bebarinorobclark
authored andcommitted
drm/msm/dsi: Stash away calculated vco frequency on recalc
A problem was reported on CoachZ devices where the display wouldn't come up, or it would be distorted. It turns out that the PLL code here wasn't getting called once dsi_pll_10nm_vco_recalc_rate() started returning the same exact frequency, down to the Hz, that the bootloader was setting instead of 0 when the clk was registered with the clk framework. After commit 001d8dc ("drm/msm/dsi: remove temp data from global pll structure") we use a hardcoded value for the parent clk frequency, i.e. VCO_REF_CLK_RATE, and we also hardcode the value for FRAC_BITS, instead of getting it from the config structure. This combination of changes to the recalc function allows us to properly calculate the frequency of the PLL regardless of whether or not the PLL has been clk_prepare()d or clk_set_rate()d. That's a good improvement. Unfortunately, this means that now we won't call down into the PLL clk driver when we call clk_set_rate() because the frequency calculated in the framework matches the frequency that is set in hardware. If the rate is the same as what we want it should be OK to not call the set_rate PLL op. The real problem is that the prepare op in this driver uses a private struct member to stash away the vco frequency so that it can call the set_rate op directly during prepare. Once the set_rate op is never called because recalc_rate told us the rate is the same, we don't set this private struct member before the prepare op runs, so we try to call the set_rate function directly with a frequency of 0. This effectively kills the PLL and configures it for a rate that won't work. Calling set_rate from prepare is really quite bad and will confuse any downstream clks about what the rate actually is of their parent. Fixing that will be a rather large change though so we leave that to later. For now, let's stash away the rate we calculate during recalc so that the prepare op knows what frequency to set, instead of 0. This way things keep working and the display can enable the PLL properly. In the future, we should remove that code from the prepare op so that it doesn't even try to call the set rate function. Cc: Dmitry Baryshkov <[email protected]> Cc: Abhinav Kumar <[email protected]> Fixes: 001d8dc ("drm/msm/dsi: remove temp data from global pll structure") Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent ce86c23 commit 170b763

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ static unsigned long dsi_pll_10nm_vco_recalc_rate(struct clk_hw *hw,
432432
pll_freq += div_u64(tmp64, multiplier);
433433

434434
vco_rate = pll_freq;
435+
pll_10nm->vco_current_rate = vco_rate;
435436

436437
DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",
437438
pll_10nm->phy->id, (unsigned long)vco_rate, dec, frac);

drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw,
460460
pll_freq += div_u64(tmp64, multiplier);
461461

462462
vco_rate = pll_freq;
463+
pll_7nm->vco_current_rate = vco_rate;
463464

464465
DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",
465466
pll_7nm->phy->id, (unsigned long)vco_rate, dec, frac);

0 commit comments

Comments
 (0)