drm/rockchip: rgb: 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: I6821e85b0b6f1152cea3057ebb6f3ec9b821ebee
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
Damon Ding
2024-12-26 20:15:32 +08:00
committed by Tao Huang
parent f486e2b73d
commit 131fb30229

View File

@@ -246,11 +246,12 @@ static void rockchip_rgb_encoder_enable(struct drm_encoder *encoder)
}
}
static void rockchip_rgb_encoder_disable(struct drm_encoder *encoder)
static void rockchip_rgb_encoder_atomic_disable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{
struct rockchip_rgb *rgb = encoder_to_rgb(encoder);
struct drm_crtc *crtc = encoder->crtc;
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state);
struct drm_crtc *old_crtc, *new_crtc;
struct rockchip_crtc_state *s;
if (rgb->panel) {
drm_panel_disable(rgb->panel);
@@ -267,8 +268,14 @@ static void rockchip_rgb_encoder_disable(struct drm_encoder *encoder)
pinctrl_pm_select_sleep_state(rgb->dev);
if (crtc->state->active_changed)
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);
s->output_if &= ~(VOP_OUTPUT_IF_RGB | VOP_OUTPUT_IF_BT656 | VOP_OUTPUT_IF_BT1120);
}
}
static int
@@ -420,7 +427,7 @@ rockchip_rgb_encoder_mode_valid(struct drm_encoder *encoder,
static const
struct drm_encoder_helper_funcs rockchip_rgb_encoder_helper_funcs = {
.enable = rockchip_rgb_encoder_enable,
.disable = rockchip_rgb_encoder_disable,
.atomic_disable = rockchip_rgb_encoder_atomic_disable,
.atomic_check = rockchip_rgb_encoder_atomic_check,
.mode_valid = rockchip_rgb_encoder_mode_valid,
};