[v2,36/64] drm/sun4i: Switch to drm_mode_config_create_initial_state
Commit Message
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().
Acked-by: Chen-Yu Tsai <wens@kernel.org>
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_drv.c | 4 +++-
drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 6 +++---
drivers/gpu/drm/sun4i/sun4i_framebuffer.h | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
@@ -102,11 +102,13 @@ static int sun4i_drv_bind(struct device *dev)
/* Remove early framebuffers (ie. simplefb) */
ret = aperture_remove_all_conflicting_devices(sun4i_drv_driver.name);
if (ret)
goto unbind_all;
- sun4i_framebuffer_init(drm);
+ ret = sun4i_framebuffer_init(drm);
+ if (ret)
+ goto unbind_all;
/* Enable connectors polling */
drm_kms_helper_poll_init(drm);
ret = drm_dev_register(drm, 0);
@@ -22,16 +22,16 @@ static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = {
static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers = {
.atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
};
-void sun4i_framebuffer_init(struct drm_device *drm)
+int sun4i_framebuffer_init(struct drm_device *drm)
{
- drm_mode_config_reset(drm);
-
drm->mode_config.max_width = 8192;
drm->mode_config.max_height = 8192;
drm->mode_config.normalize_zpos = true;
drm->mode_config.funcs = &sun4i_de_mode_config_funcs;
drm->mode_config.helper_private = &sun4i_de_mode_config_helpers;
+
+ return drm_mode_config_create_initial_state(drm);
}
@@ -7,8 +7,8 @@
*/
#ifndef _SUN4I_FRAMEBUFFER_H_
#define _SUN4I_FRAMEBUFFER_H_
-void sun4i_framebuffer_init(struct drm_device *drm);
+int sun4i_framebuffer_init(struct drm_device *drm);
#endif /* _SUN4I_FRAMEBUFFER_H_ */