From 1cfa8f220b9eb02255d2ae9a8d066578ff56fdc5 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 21 Aug 2026 16:39:38 +0200 Subject: [PATCH] drm/rockchip: vop2: Convert to atomic_create_state The rockchip vop2 crtc implementation provides a custom reset hook. However, this hook only allocates the state, initializes it with __drm_atomic_helper_crtc_reset(), and frees the previous state. It does not perform any hardware reset. Since this is exactly what the atomic_create_state hook is meant to do, minus the old state cleanup which the caller handles, convert the implementation to use atomic_create_state with __drm_atomic_helper_crtc_state_init() instead. Reviewed-by: Heiko Stuebner Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20260821-drm-no-more-crtc-reset-v1-62-fb793475c05a@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 4cce3e336f5b..b2f3a579bbe5 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2300,24 +2300,24 @@ static void vop2_crtc_destroy_state(struct drm_crtc *crtc, kfree(vcstate); } -static void vop2_crtc_reset(struct drm_crtc *crtc) +static struct drm_crtc_state *vop2_crtc_create_state(struct drm_crtc *crtc) { - struct rockchip_crtc_state *vcstate = kzalloc_obj(*vcstate); + struct rockchip_crtc_state *vcstate; - if (crtc->state) - vop2_crtc_destroy_state(crtc, crtc->state); + vcstate = kzalloc_obj(*vcstate); + if (!vcstate) + return ERR_PTR(-ENOMEM); - if (vcstate) - __drm_atomic_helper_crtc_reset(crtc, &vcstate->base); - else - __drm_atomic_helper_crtc_reset(crtc, NULL); + __drm_atomic_helper_crtc_state_init(&vcstate->base, crtc); + + return &vcstate->base; } static const struct drm_crtc_funcs vop2_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .destroy = drm_crtc_cleanup, - .reset = vop2_crtc_reset, + .atomic_create_state = vop2_crtc_create_state, .atomic_duplicate_state = vop2_crtc_duplicate_state, .atomic_destroy_state = vop2_crtc_destroy_state, .enable_vblank = vop2_crtc_enable_vblank,