Commit 7a418e34 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Move registration actions to connector->late_register

With the introduction of a connector->func for callback from
drm_connector_register() we can move all the tasks that we want to do
upon registration into that callback. Later, this will allow us to
reorder the registration and defer it until after the device is setup
and ready for userspace.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466773227-7994-2-git-send-email-chris@chris-wilson.co.uk
parent fda9ee98
...@@ -1249,35 +1249,18 @@ intel_dp_aux_fini(struct intel_dp *intel_dp) ...@@ -1249,35 +1249,18 @@ intel_dp_aux_fini(struct intel_dp *intel_dp)
kfree(intel_dp->aux.name); kfree(intel_dp->aux.name);
} }
static int static void
intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector) intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
{ {
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
enum port port = intel_dig_port->port; enum port port = intel_dig_port->port;
int ret;
intel_aux_reg_init(intel_dp); intel_aux_reg_init(intel_dp);
drm_dp_aux_init(&intel_dp->aux);
/* Failure to allocate our preferred name is not critical */
intel_dp->aux.name = kasprintf(GFP_KERNEL, "DPDDC-%c", port_name(port)); intel_dp->aux.name = kasprintf(GFP_KERNEL, "DPDDC-%c", port_name(port));
if (!intel_dp->aux.name)
return -ENOMEM;
intel_dp->aux.dev = connector->base.kdev;
intel_dp->aux.transfer = intel_dp_aux_transfer; intel_dp->aux.transfer = intel_dp_aux_transfer;
DRM_DEBUG_KMS("registering %s bus for %s\n",
intel_dp->aux.name,
connector->base.kdev->kobj.name);
ret = drm_dp_aux_register(&intel_dp->aux);
if (ret < 0) {
DRM_ERROR("drm_dp_aux_register() for %s failed (%d)\n",
intel_dp->aux.name, ret);
kfree(intel_dp->aux.name);
return ret;
}
return 0;
} }
static int static int
...@@ -4520,6 +4503,20 @@ intel_dp_set_property(struct drm_connector *connector, ...@@ -4520,6 +4503,20 @@ intel_dp_set_property(struct drm_connector *connector,
return 0; return 0;
} }
static int
intel_dp_connector_register(struct drm_connector *connector)
{
struct intel_dp *intel_dp = intel_attached_dp(connector);
i915_debugfs_connector_add(connector);
DRM_DEBUG_KMS("registering %s bus for %s\n",
intel_dp->aux.name, connector->kdev->kobj.name);
intel_dp->aux.dev = connector->kdev;
return drm_dp_aux_register(&intel_dp->aux);
}
static void static void
intel_dp_connector_unregister(struct drm_connector *connector) intel_dp_connector_unregister(struct drm_connector *connector)
{ {
...@@ -4648,6 +4645,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = { ...@@ -4648,6 +4645,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_set_property, .set_property = intel_dp_set_property,
.atomic_get_property = intel_connector_atomic_get_property, .atomic_get_property = intel_connector_atomic_get_property,
.late_register = intel_dp_connector_register,
.early_unregister = intel_dp_connector_unregister, .early_unregister = intel_dp_connector_unregister,
.destroy = intel_dp_connector_destroy, .destroy = intel_dp_connector_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
...@@ -5515,7 +5513,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -5515,7 +5513,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
struct drm_device *dev = intel_encoder->base.dev; struct drm_device *dev = intel_encoder->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
enum port port = intel_dig_port->port; enum port port = intel_dig_port->port;
int type, ret; int type;
if (WARN(intel_dig_port->max_lanes < 1, if (WARN(intel_dig_port->max_lanes < 1,
"Not enough lanes (%d) for DP on port %c\n", "Not enough lanes (%d) for DP on port %c\n",
...@@ -5574,6 +5572,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -5574,6 +5572,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
connector->interlace_allowed = true; connector->interlace_allowed = true;
connector->doublescan_allowed = 0; connector->doublescan_allowed = 0;
intel_dp_aux_init(intel_dp, intel_connector);
INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, INIT_DELAYED_WORK(&intel_dp->panel_vdd_work,
edp_panel_vdd_work); edp_panel_vdd_work);
...@@ -5608,10 +5608,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -5608,10 +5608,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
BUG(); BUG();
} }
ret = intel_dp_aux_init(intel_dp, intel_connector);
if (ret)
goto fail;
/* init MST on ports that can support it */ /* init MST on ports that can support it */
if (HAS_DP_MST(dev) && if (HAS_DP_MST(dev) &&
(port == PORT_B || port == PORT_C || port == PORT_D)) (port == PORT_B || port == PORT_C || port == PORT_D))
...@@ -5635,8 +5631,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -5635,8 +5631,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
} }
i915_debugfs_connector_add(connector);
return true; return true;
fail: fail:
......
...@@ -477,9 +477,11 @@ static void intel_dp_register_mst_connector(struct drm_connector *connector) ...@@ -477,9 +477,11 @@ static void intel_dp_register_mst_connector(struct drm_connector *connector)
{ {
struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_connector *intel_connector = to_intel_connector(connector);
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
intel_connector_add_to_fbdev(intel_connector); intel_connector_add_to_fbdev(intel_connector);
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
drm_connector_register(&intel_connector->base); drm_connector_register(&intel_connector->base);
} }
......
...@@ -2177,6 +2177,16 @@ intel_sdvo_set_property(struct drm_connector *connector, ...@@ -2177,6 +2177,16 @@ intel_sdvo_set_property(struct drm_connector *connector,
#undef CHECK_PROPERTY #undef CHECK_PROPERTY
} }
static int
intel_sdvo_connector_register(struct drm_connector *connector)
{
struct intel_sdvo *sdvo = intel_attached_sdvo(connector);
return sysfs_create_link(&connector->kdev->kobj,
&sdvo->ddc.dev.kobj,
sdvo->ddc.dev.kobj.name);
}
static void static void
intel_sdvo_connector_unregister(struct drm_connector *connector) intel_sdvo_connector_unregister(struct drm_connector *connector)
{ {
...@@ -2193,6 +2203,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = { ...@@ -2193,6 +2203,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_sdvo_set_property, .set_property = intel_sdvo_set_property,
.atomic_get_property = intel_connector_atomic_get_property, .atomic_get_property = intel_connector_atomic_get_property,
.late_register = intel_sdvo_connector_register,
.early_unregister = intel_sdvo_connector_unregister, .early_unregister = intel_sdvo_connector_unregister,
.destroy = intel_sdvo_destroy, .destroy = intel_sdvo_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
...@@ -2384,16 +2395,8 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector, ...@@ -2384,16 +2395,8 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
if (ret < 0) if (ret < 0)
goto err1; goto err1;
ret = sysfs_create_link(&drm_connector->kdev->kobj,
&encoder->ddc.dev.kobj,
encoder->ddc.dev.kobj.name);
if (ret < 0)
goto err2;
return 0; return 0;
err2:
drm_connector_unregister(drm_connector);
err1: err1:
drm_connector_cleanup(drm_connector); drm_connector_cleanup(drm_connector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment