drm: sti: use late_register and early_unregister callbacks
Make sti driver use register callback to move debugfs initialization out of sub-components creation. This will allow to convert driver .load() to drm_dev_alloc() and drm_dev_register(). sti_compositor bring up 2 crtc but only one debugfs init is needed so use drm_crtc_index to do it on the first one. This can't be done in sti_drv because only sti_compositor have access to the devices. It is almost the same for sti_encoder which handle multiple encoder while one only debugfs entry is needed so add a boolean to avoid multiple debugfs initialization Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1466514580-15194-3-git-send-email-benjamin.gaignard@linaro.org
This commit is contained in:

committed by
Daniel Vetter

parent
a104299b94
commit
83af0a483a
@@ -404,24 +404,29 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
|
||||
return connector_status_disconnected;
|
||||
}
|
||||
|
||||
static void sti_dvo_connector_destroy(struct drm_connector *connector)
|
||||
static int sti_dvo_late_register(struct drm_connector *connector)
|
||||
{
|
||||
struct sti_dvo_connector *dvo_connector
|
||||
= to_sti_dvo_connector(connector);
|
||||
struct sti_dvo *dvo = dvo_connector->dvo;
|
||||
|
||||
drm_connector_unregister(connector);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(dvo_connector);
|
||||
if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
|
||||
DRM_ERROR("DVO debugfs setup failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_connector_funcs sti_dvo_connector_funcs = {
|
||||
.dpms = drm_atomic_helper_connector_dpms,
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.detect = sti_dvo_connector_detect,
|
||||
.destroy = sti_dvo_connector_destroy,
|
||||
.destroy = drm_connector_cleanup,
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||
.late_register = sti_dvo_late_register,
|
||||
};
|
||||
|
||||
static struct drm_encoder *sti_dvo_find_encoder(struct drm_device *dev)
|
||||
@@ -502,9 +507,6 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
|
||||
goto err_sysfs;
|
||||
}
|
||||
|
||||
if (dvo_debugfs_init(dvo, drm_dev->primary))
|
||||
DRM_ERROR("DVO debugfs setup failed\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err_sysfs:
|
||||
|
Reference in New Issue
Block a user