• Ville Syrjälä's avatar
    drm/i915/cdclk: Fix voltage_level programming edge case · 34d127e2
    Ville Syrjälä authored
    Currently we only consider the relationship of the
    old and new CDCLK frequencies when determining whether
    to do the repgramming from intel_set_cdclk_pre_plane_update()
    or intel_set_cdclk_post_plane_update().
    
    It is technically possible to have a situation where the
    CDCLK frequency is decreasing, but the voltage_level is
    increasing due a DDI port. In this case we should bump
    the voltage level already in intel_set_cdclk_pre_plane_update()
    (so that the voltage_level will have been increased by the
    time the port gets enabled), while leaving the CDCLK frequency
    unchanged (as active planes/etc. may still depend on it).
    We can then reduce the CDCLK frequency to its final value
    from intel_set_cdclk_post_plane_update().
    
    In order to handle that correctly we shall construct a
    suitable amalgam of the old and new cdclk states in
    intel_set_cdclk_pre_plane_update().
    
    And we can simply call intel_set_cdclk() unconditionally
    in both places as it will not do anything if nothing actually
    changes vs. the current hw state.
    
    v2: Handle cdclk_state->disable_pipes
    v3: Only synchronize the cd2x update against the pipe's vblank
        when the cdclk frequency is changing during the current
        commit phase (Gustavo)
    
    Cc: stable@vger.kernel.org
    Cc: Gustavo Sousa <gustavo.sousa@intel.com>
    Reviewed-by: default avatarUma Shankar <uma.shankar@intel.com>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240402155016.13733-3-ville.syrjala@linux.intel.com
    34d127e2
intel_cdclk.c 112 KB