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:
Benjamin Gaignard
2016-06-21 15:09:39 +02:00
committed by Daniel Vetter
부모 a104299b94
커밋 83af0a483a
16개의 변경된 파일198개의 추가작업 그리고 69개의 파일을 삭제

파일 보기

@@ -112,6 +112,7 @@ struct sti_tvout {
struct drm_encoder *hdmi;
struct drm_encoder *hda;
struct drm_encoder *dvo;
bool debugfs_registered;
};
struct sti_tvout_encoder {
@@ -625,8 +626,37 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
kfree(sti_encoder);
}
static int sti_tvout_late_register(struct drm_encoder *encoder)
{
struct sti_tvout *tvout = to_sti_tvout(encoder);
int ret;
if (tvout->debugfs_registered)
return 0;
ret = tvout_debugfs_init(tvout, encoder->dev->primary);
if (ret)
return ret;
tvout->debugfs_registered = true;
return 0;
}
static void sti_tvout_early_unregister(struct drm_encoder *encoder)
{
struct sti_tvout *tvout = to_sti_tvout(encoder);
if (!tvout->debugfs_registered)
return;
tvout_debugfs_exit(tvout, encoder->dev->primary);
tvout->debugfs_registered = false;
}
static const struct drm_encoder_funcs sti_tvout_encoder_funcs = {
.destroy = sti_tvout_encoder_destroy,
.late_register = sti_tvout_late_register,
.early_unregister = sti_tvout_early_unregister,
};
static void sti_dvo_encoder_enable(struct drm_encoder *encoder)
@@ -813,9 +843,6 @@ static int sti_tvout_bind(struct device *dev, struct device *master, void *data)
sti_tvout_create_encoders(drm_dev, tvout);
if (tvout_debugfs_init(tvout, drm_dev->primary))
DRM_ERROR("TVOUT debugfs setup failed\n");
return 0;
}
@@ -823,11 +850,8 @@ static void sti_tvout_unbind(struct device *dev, struct device *master,
void *data)
{
struct sti_tvout *tvout = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
sti_tvout_destroy_encoders(tvout);
tvout_debugfs_exit(tvout, drm_dev->primary);
}
static const struct component_ops sti_tvout_ops = {