]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Move connector registration to driver registration
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Jun 2016 13:00:16 +0000 (14:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Jun 2016 13:43:26 +0000 (14:43 +0100)
Defer connector registration from during construction to the driver
registration phase. This is important for ordering the action correctly,
e.g. not using debugfs before it is ready.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466773227-7994-4-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_tv.c

index e28c0ddc0837039efbf00b8601342fa50b8492ae..29521c4b87a5f8e3641eafaaf166bad92890b610 100644 (file)
@@ -1398,6 +1398,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
                I915_WRITE(vgtif_reg(display_ready), VGT_DRV_DISPLAY_READY);
 
        i915_setup_sysfs(dev);
+       intel_modeset_register(dev_priv);
 
        if (INTEL_INFO(dev_priv)->num_pipes) {
                /* Must be done after probing outputs */
@@ -1430,6 +1431,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
        intel_gpu_ips_teardown();
        acpi_video_unregister();
        intel_opregion_unregister(dev_priv);
+       intel_modeset_unregister(dev_priv);
        i915_teardown_sysfs(dev_priv->dev);
        i915_gem_shrinker_cleanup(dev_priv);
 }
index 42298a87db7e75865e7f1e53cd4baa2fb3223d94..73683b54da7aa6eb0cd3596f60161ac6f0fba404 100644 (file)
@@ -3734,6 +3734,8 @@ extern void intel_modeset_init_hw(struct drm_device *dev);
 extern void intel_modeset_init(struct drm_device *dev);
 extern void intel_modeset_gem_init(struct drm_device *dev);
 extern void intel_modeset_cleanup(struct drm_device *dev);
+extern void intel_modeset_register(struct drm_i915_private *dev_priv);
+extern void intel_modeset_unregister(struct drm_i915_private *dev_priv);
 extern int intel_connector_register(struct drm_connector *);
 extern void intel_connector_unregister(struct drm_connector *);
 extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
index 8d7d48c74751da64633461108fe07e37113338a8..165e4b9015484b9a9da6b079031c6f96a0102475 100644 (file)
@@ -880,8 +880,6 @@ void intel_crt_init(struct drm_device *dev)
 
        drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
 
-       drm_connector_register(connector);
-
        if (!I915_HAS_HOTPLUG(dev))
                intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
 
index 12897d11df60fa45c9da859e8e5e44605681ba8d..798c175c37bf4a863c4f563deee91fcbbdc21bc6 100644 (file)
@@ -15551,6 +15551,16 @@ void intel_modeset_init_hw(struct drm_device *dev)
        intel_enable_gt_powersave(dev_priv);
 }
 
+void intel_modeset_register(struct drm_i915_private *dev_priv)
+{
+       drm_connector_register_all(dev_priv->dev);
+}
+
+void intel_modeset_unregister(struct drm_i915_private *dev_priv)
+{
+       drm_connector_unregister_all(dev_priv->dev);
+}
+
 /*
  * Calculate what we think the watermarks should be for the state we've read
  * out of the hardware and then immediately program those watermarks so that
@@ -16365,8 +16375,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
        /* flush any delayed tasks or pending work */
        flush_scheduled_work();
 
-       drm_connector_unregister_all(dev);
-
        drm_mode_config_cleanup(dev);
 
        intel_cleanup_overlay(dev_priv);
index 30d410173816a2400e5f23b7ff599d5693eaa87c..c3742a04f6112fb50b24071638e971abda0d43aa 100644 (file)
@@ -5583,7 +5583,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
                          edp_panel_vdd_work);
 
        intel_connector_attach_encoder(intel_connector, intel_encoder);
-       drm_connector_register(connector);
 
        if (HAS_DDI(dev))
                intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
@@ -5639,7 +5638,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
        return true;
 
 fail:
-       drm_connector_unregister(connector);
        drm_connector_cleanup(connector);
 
        return false;
index 80cc0f9de6c99065f88b93b4ff1a328d5e1ef898..63b720061bd2317669ac401594d3c5d4ff4c24e0 100644 (file)
@@ -1592,8 +1592,6 @@ void intel_dsi_init(struct drm_device *dev)
 
        intel_dsi_add_properties(intel_connector);
 
-       drm_connector_register(connector);
-
        return;
 
 err:
index 669eae46ffa940b9cfa0a4163a29ec494f4bac0f..14b1d3f333a4595140023a16c4b81672b02304fa 100644 (file)
@@ -551,7 +551,6 @@ void intel_dvo_init(struct drm_device *dev)
                        intel_dvo->panel_wants_dither = true;
                }
 
-               drm_connector_register(connector);
                return;
        }
 
index 48ca48c9faff96d19f59b5fce43a7a27394b8a12..86e1fdb70141253337d9d45e946c24add8724326 100644 (file)
@@ -1915,7 +1915,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
        intel_hdmi_add_properties(intel_hdmi, connector);
 
        intel_connector_attach_encoder(intel_connector, intel_encoder);
-       drm_connector_register(connector);
        intel_hdmi->attached_connector = intel_connector;
 
        /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
index d4d06fb8de2e1796f016d774fb08fcd522de12f3..cf680661454b722bd13b84e3b83dd36e6883a202 100644 (file)
@@ -1134,7 +1134,6 @@ out:
                DRM_DEBUG_KMS("lid notifier registration failed\n");
                lvds_connector->lid_notifier.notifier_call = NULL;
        }
-       drm_connector_register(connector);
 
        return;
 
index c0c0a65fabf3dc95089bcf15b6f7b5d9126bb147..ba28f5141687d222bba824ffb3eb5ddedc184725 100644 (file)
@@ -2396,16 +2396,8 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
        connector->base.get_hw_state = intel_sdvo_connector_get_hw_state;
 
        intel_connector_attach_encoder(&connector->base, &encoder->base);
-       ret = drm_connector_register(drm_connector);
-       if (ret < 0)
-               goto err1;
 
        return 0;
-
-err1:
-       drm_connector_cleanup(drm_connector);
-
-       return ret;
 }
 
 static void
@@ -2532,7 +2524,6 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
        return true;
 
 err:
-       drm_connector_unregister(connector);
        intel_sdvo_destroy(connector);
        return false;
 }
@@ -2611,7 +2602,6 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
        return true;
 
 err:
-       drm_connector_unregister(connector);
        intel_sdvo_destroy(connector);
        return false;
 }
index 83fe6706a1885917853c7a59ac60e92028bbc7ed..153190475ebdf5eacabcc5461b05bbc968ac1277 100644 (file)
@@ -1642,5 +1642,4 @@ intel_tv_init(struct drm_device *dev)
        drm_object_attach_property(&connector->base,
                                   dev->mode_config.tv_bottom_margin_property,
                                   intel_tv->margin[TV_MARGIN_BOTTOM]);
-       drm_connector_register(connector);
 }