drm/udl: Init connector before encoder and CRTC

To mimic simple-pipe, we initialize the connector before the rest of
the display pipeline.

v2:
	* remove unnecessary calls to drm_connector_{register,unregister}()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191210084905.5570-2-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2019-12-10 09:48:57 +01:00
parent 919dfb7830
commit e829cf0b30
3 changed files with 18 additions and 9 deletions

View File

@ -104,7 +104,6 @@ static void udl_connector_destroy(struct drm_connector *connector)
struct udl_drm_connector, struct udl_drm_connector,
connector); connector);
drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(udl_connector->edid); kfree(udl_connector->edid);
kfree(connector); kfree(connector);
@ -123,24 +122,22 @@ static const struct drm_connector_funcs udl_connector_funcs = {
.set_property = udl_connector_set_property, .set_property = udl_connector_set_property,
}; };
int udl_connector_init(struct drm_device *dev, struct drm_encoder *encoder) struct drm_connector *udl_connector_init(struct drm_device *dev)
{ {
struct udl_drm_connector *udl_connector; struct udl_drm_connector *udl_connector;
struct drm_connector *connector; struct drm_connector *connector;
udl_connector = kzalloc(sizeof(struct udl_drm_connector), GFP_KERNEL); udl_connector = kzalloc(sizeof(struct udl_drm_connector), GFP_KERNEL);
if (!udl_connector) if (!udl_connector)
return -ENOMEM; return ERR_PTR(-ENOMEM);
connector = &udl_connector->connector; connector = &udl_connector->connector;
drm_connector_init(dev, connector, &udl_connector_funcs, drm_connector_init(dev, connector, &udl_connector_funcs,
DRM_MODE_CONNECTOR_DVII); DRM_MODE_CONNECTOR_DVII);
drm_connector_helper_add(connector, &udl_connector_helper_funcs); drm_connector_helper_add(connector, &udl_connector_helper_funcs);
drm_connector_register(connector);
drm_connector_attach_encoder(connector, encoder);
connector->polled = DRM_CONNECTOR_POLL_HPD | connector->polled = DRM_CONNECTOR_POLL_HPD |
DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
return 0; return connector;
} }

View File

@ -73,7 +73,7 @@ struct udl_device {
int udl_modeset_init(struct drm_device *dev); int udl_modeset_init(struct drm_device *dev);
void udl_modeset_restore(struct drm_device *dev); void udl_modeset_restore(struct drm_device *dev);
void udl_modeset_cleanup(struct drm_device *dev); void udl_modeset_cleanup(struct drm_device *dev);
int udl_connector_init(struct drm_device *dev, struct drm_encoder *encoder); struct drm_connector *udl_connector_init(struct drm_device *dev);
struct drm_encoder *udl_encoder_init(struct drm_device *dev); struct drm_encoder *udl_encoder_init(struct drm_device *dev);

View File

@ -421,7 +421,10 @@ static const struct drm_mode_config_funcs udl_mode_funcs = {
int udl_modeset_init(struct drm_device *dev) int udl_modeset_init(struct drm_device *dev)
{ {
struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
int ret;
drm_mode_config_init(dev); drm_mode_config_init(dev);
dev->mode_config.min_width = 640; dev->mode_config.min_width = 640;
@ -435,13 +438,22 @@ int udl_modeset_init(struct drm_device *dev)
dev->mode_config.funcs = &udl_mode_funcs; dev->mode_config.funcs = &udl_mode_funcs;
connector = udl_connector_init(dev);
if (IS_ERR(connector)) {
ret = PTR_ERR(connector);
goto err_drm_mode_config_cleanup;
}
udl_crtc_init(dev); udl_crtc_init(dev);
encoder = udl_encoder_init(dev); encoder = udl_encoder_init(dev);
drm_connector_attach_encoder(connector, encoder);
udl_connector_init(dev, encoder);
return 0; return 0;
err_drm_mode_config_cleanup:
drm_mode_config_cleanup(dev);
return ret;
} }
void udl_modeset_restore(struct drm_device *dev) void udl_modeset_restore(struct drm_device *dev)