Skip to content

Commit e08e075

Browse files
vsyrjalajlahtine-intel
authored andcommitted
drm/i915/cdclk: Do the full CDCLK dance for min_voltage_level changes
Apparently I forgot about the pipe min_voltage_level when I decoupled the CDCLK calculations from modesets. Even if the CDCLK frequency doesn't need changing we may still need to bump the voltage level to accommodate an increase in the port clock frequency. Currently, even if there is a full modeset, we won't notice the need to go through the full CDCLK calculations/programming, unless the set of enabled/active pipes changes, or the pipe/dbuf min CDCLK changes. Duplicate the same logic we use the pipe's min CDCLK frequency to also deal with its min voltage level. Note that the 'allow_voltage_level_decrease' stuff isn't really useful here since the min voltage level can only change during a full modeset. But I think sticking to the same approach in the three similar parts (pipe min cdclk, pipe min voltage level, dbuf min cdclk) is a good idea. Cc: stable@vger.kernel.org Tested-by: Mikhail Rudenko <mike.rudenko@gmail.com> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15826 Fixes: ba91b9e ("drm/i915/cdclk: Decouple cdclk from state->modeset") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260325135849.12603-2-ville.syrjala@linux.intel.com Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> (cherry picked from commit 0f21a14987ebae3c05ad1184ea872e7b7a7b8695) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
1 parent 4dfce79 commit e08e075

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_cdclk.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,6 +2971,53 @@ static int intel_cdclk_update_crtc_min_cdclk(struct intel_atomic_state *state,
29712971
return 0;
29722972
}
29732973

2974+
static int intel_cdclk_update_crtc_min_voltage_level(struct intel_atomic_state *state,
2975+
struct intel_crtc *crtc,
2976+
u8 old_min_voltage_level,
2977+
u8 new_min_voltage_level,
2978+
bool *need_cdclk_calc)
2979+
{
2980+
struct intel_display *display = to_intel_display(state);
2981+
struct intel_cdclk_state *cdclk_state;
2982+
bool allow_voltage_level_decrease = intel_any_crtc_needs_modeset(state);
2983+
int ret;
2984+
2985+
if (new_min_voltage_level == old_min_voltage_level)
2986+
return 0;
2987+
2988+
if (!allow_voltage_level_decrease &&
2989+
new_min_voltage_level < old_min_voltage_level)
2990+
return 0;
2991+
2992+
cdclk_state = intel_atomic_get_cdclk_state(state);
2993+
if (IS_ERR(cdclk_state))
2994+
return PTR_ERR(cdclk_state);
2995+
2996+
old_min_voltage_level = cdclk_state->min_voltage_level[crtc->pipe];
2997+
2998+
if (new_min_voltage_level == old_min_voltage_level)
2999+
return 0;
3000+
3001+
if (!allow_voltage_level_decrease &&
3002+
new_min_voltage_level < old_min_voltage_level)
3003+
return 0;
3004+
3005+
cdclk_state->min_voltage_level[crtc->pipe] = new_min_voltage_level;
3006+
3007+
ret = intel_atomic_lock_global_state(&cdclk_state->base);
3008+
if (ret)
3009+
return ret;
3010+
3011+
*need_cdclk_calc = true;
3012+
3013+
drm_dbg_kms(display->drm,
3014+
"[CRTC:%d:%s] min voltage level: %d -> %d\n",
3015+
crtc->base.base.id, crtc->base.name,
3016+
old_min_voltage_level, new_min_voltage_level);
3017+
3018+
return 0;
3019+
}
3020+
29743021
int intel_cdclk_update_dbuf_bw_min_cdclk(struct intel_atomic_state *state,
29753022
int old_min_cdclk, int new_min_cdclk,
29763023
bool *need_cdclk_calc)
@@ -3386,6 +3433,13 @@ static int intel_crtcs_calc_min_cdclk(struct intel_atomic_state *state,
33863433
need_cdclk_calc);
33873434
if (ret)
33883435
return ret;
3436+
3437+
ret = intel_cdclk_update_crtc_min_voltage_level(state, crtc,
3438+
old_crtc_state->min_voltage_level,
3439+
new_crtc_state->min_voltage_level,
3440+
need_cdclk_calc);
3441+
if (ret)
3442+
return ret;
33893443
}
33903444

33913445
return 0;

0 commit comments

Comments
 (0)