The P divider should be set based on the min and max values of
the fin pll which may vary between different platforms.
These ranges are defined per platform, but hard-coded values
were used instead which resulted in a smaller range available
on the i.MX8M[MNP] than what was possible.

Fixes: 846307185f0f ("drm/bridge: samsung-dsim: update PLL reference clock")
Signed-off-by: Adam Ford <aford...@gmail.com>

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c 
b/drivers/gpu/drm/bridge/samsung-dsim.c
index be5914caa17d..239d253a7d71 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -573,8 +573,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct 
samsung_dsim *dsi,
        u16 _m, best_m;
        u8 _s, best_s;
 
-       p_min = DIV_ROUND_UP(fin, (12 * MHZ));
-       p_max = fin / (6 * MHZ);
+       p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * MHZ));
+       p_max = fin / (driver_data->pll_fin_min * MHZ);
 
        for (_p = p_min; _p <= p_max; ++_p) {
                for (_s = 0; _s <= 5; ++_s) {
-- 
2.40.1

Reply via email to