drm/rockchip: analogix_dp: update the check for clearing old output_if

In order to cover more application scenarios, when the crtc changes,
the old output_if should be cleared, rather than when the flag
&drm_crtc_state.active_changed is set to 1.

In addition, it would be more reasonable to name new crtc to 'new_crtc'
rather than 'crtc'.

Change-Id: I5376c44eb5deab75acdbae95782cc5de2e2757d5
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
Damon Ding
2024-12-26 19:54:11 +08:00
committed by Tao Huang
parent f897ad4b39
commit f486e2b73d

View File

@@ -415,26 +415,17 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{
struct rockchip_dp_device *dp = encoder_to_dp(encoder);
struct drm_crtc *crtc;
struct drm_crtc *old_crtc;
struct drm_crtc *old_crtc, *new_crtc;
struct drm_crtc_state *new_crtc_state = NULL;
struct drm_connector *conn;
struct drm_connector_state *old_conn_state;
struct rockchip_crtc_state *s;
int ret;
conn = drm_atomic_get_old_connector_for_encoder(state, encoder);
if (!conn)
return;
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
if (!old_conn_state)
return;
if (!old_conn_state->crtc)
return;
old_crtc = old_conn_state->crtc;
s = to_rockchip_crtc_state(old_crtc->state);
old_crtc = drm_atomic_get_old_crtc_for_encoder(state, encoder);
new_crtc = drm_atomic_get_new_crtc_for_encoder(state, encoder);
if (old_crtc && old_crtc != new_crtc) {
s = to_rockchip_crtc_state(old_crtc->state);
if (old_crtc->state->active_changed) {
if (dp->plat_data.split_mode)
s->output_if &= ~(VOP_OUTPUT_IF_eDP1 | VOP_OUTPUT_IF_eDP0);
else
@@ -442,17 +433,16 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder,
s->output_if_left_panel &= ~(dp->id ? VOP_OUTPUT_IF_eDP1 : VOP_OUTPUT_IF_eDP0);
}
crtc = drm_atomic_get_new_crtc_for_encoder(state, encoder);
/* No crtc means we're doing a full shutdown */
if (!crtc)
if (!new_crtc)
return;
new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc);
/* If we're not entering self-refresh, no need to wait for vact */
if (!new_crtc_state || !new_crtc_state->self_refresh_active)
return;
ret = rockchip_drm_wait_vact_end(crtc, PSR_WAIT_LINE_FLAG_TIMEOUT_MS);
ret = rockchip_drm_wait_vact_end(new_crtc, PSR_WAIT_LINE_FLAG_TIMEOUT_MS);
if (ret)
DRM_DEV_ERROR(dp->dev, "line flag irq timed out\n");
}