[47/83] drm/sun4i: Switch to drm_mode_config_create_initial_state

Message ID 20261105-drm-no-more-config-reset-v1-47-763560c2cc3f@kernel.org (mailing list archive)
State New
Headers
Series drm: Switch drivers to drm_mode_config_create_initial_state |

Commit Message

Maxime Ripard Nov. 5, 2026, 2:08 p.m. UTC
drm_mode_config_reset() has a dual role: it creates the initial KMS
state at probe time, and resets hardware and software state during
suspend/resume cycles.

Since the two roles need different behaviors (notably for objects like
drm_private_obj that must persist across suspend/resume),
drm_mode_config_create_initial_state() was introduced to handle only
the initial state creation at probe time.

Switch to drm_mode_config_create_initial_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
Cc: Chen-Yu Tsai <wens@kernel.org>
Cc: Samuel Holland <samuel@sholland.org>
Cc: linux-sunxi@lists.linux.dev
---
 drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Chen-Yu Tsai Nov. 5, 2026, 3:28 p.m. UTC | #1
On Thu, Nov 5, 2026 at 10:10 PM Maxime Ripard <mripard@kernel.org> wrote:
>
> drm_mode_config_reset() has a dual role: it creates the initial KMS
> state at probe time, and resets hardware and software state during
> suspend/resume cycles.
>
> Since the two roles need different behaviors (notably for objects like
> drm_private_obj that must persist across suspend/resume),
> drm_mode_config_create_initial_state() was introduced to handle only
> the initial state creation at probe time.
>
> Switch to drm_mode_config_create_initial_state().
>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>

Acked-by: Chen-Yu Tsai <wens@kernel.org>
  

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
index fc822bc2c62b..0ce3691dedad 100644
--- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
@@ -11,4 +11,5 @@ 
 #include <drm/drm_blend.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_print.h>
 
 #include "sun4i_drv.h"
@@ -27,5 +28,6 @@  static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers =
 void sun4i_framebuffer_init(struct drm_device *drm)
 {
-	drm_mode_config_reset(drm);
+	drm_WARN(drm, drm_mode_config_create_initial_state(drm),
+		 "Failed to create state\n");
 
 	drm->mode_config.max_width = 8192;