drm/sti: Use drm_fbdev_generic_setup()

The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

If drm_fbdev_generic_setup() fails, an error is printed by the function.

drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
In that case it retries fbdev setup on the next .output_poll_changed.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-14-noralf@tronnes.org
This commit is contained in:
Noralf Trønnes 2018-09-08 15:46:41 +02:00
parent 30f7b5e7c2
commit 0f26e5ce3e
1 changed files with 1 additions and 7 deletions

View File

@ -121,7 +121,6 @@ err:
static const struct drm_mode_config_funcs sti_mode_config_funcs = { static const struct drm_mode_config_funcs sti_mode_config_funcs = {
.fb_create = drm_gem_fb_create, .fb_create = drm_gem_fb_create,
.output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
}; };
@ -206,7 +205,6 @@ static void sti_cleanup(struct drm_device *ddev)
{ {
struct sti_private *private = ddev->dev_private; struct sti_private *private = ddev->dev_private;
drm_fb_cma_fbdev_fini(ddev);
drm_kms_helper_poll_fini(ddev); drm_kms_helper_poll_fini(ddev);
component_unbind_all(ddev->dev, ddev); component_unbind_all(ddev->dev, ddev);
kfree(private); kfree(private);
@ -236,11 +234,7 @@ static int sti_bind(struct device *dev)
drm_mode_config_reset(ddev); drm_mode_config_reset(ddev);
if (ddev->mode_config.num_connector) { drm_fbdev_generic_setup(ddev, 32);
ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
if (ret)
DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
}
return 0; return 0;