]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/i915: group display-related register calls
authorLucas De Marchi <lucas.demarchi@intel.com>
Sat, 13 Feb 2021 04:27:54 +0000 (20:27 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Sat, 13 Feb 2021 20:52:57 +0000 (12:52 -0800)
intel_gt_driver_register() may be called earlier than
intel_opregion_register() and acpi_video_register(), so move it up.

intel_display_debugfs_register() may be called later, together with the
other display-related initializations. There is a slight change in
behavior that sysfs files will show up before the display-related
debugfs files, but that shouldn't be a problem - userspace shouldn't be
relying in debugfs.

This allows us to group all the display-related calls under a single
check for "HAS_DISPLAY()" that can be later moved to a better place.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20210213042756.953007-2-lucas.demarchi@intel.com
drivers/gpu/drm/i915/i915_drv.c

index 67e4d91df0c083796e538e6b3e90a531ff79a3b5..4e8caf88f32ca5cc9bef436183418a464f9450e0 100644 (file)
@@ -671,38 +671,39 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
        }
 
        i915_debugfs_register(dev_priv);
-       if (HAS_DISPLAY(dev_priv))
-               intel_display_debugfs_register(dev_priv);
        i915_setup_sysfs(dev_priv);
 
        /* Depends on sysfs having been initialized */
        i915_perf_register(dev_priv);
 
+       intel_gt_driver_register(&dev_priv->gt);
+
        if (HAS_DISPLAY(dev_priv)) {
+               intel_display_debugfs_register(dev_priv);
+
                /* Must be done after probing outputs */
                intel_opregion_register(dev_priv);
                acpi_video_register();
-       }
 
-       intel_gt_driver_register(&dev_priv->gt);
-
-       intel_audio_init(dev_priv);
+               intel_audio_init(dev_priv);
 
-       /*
-        * Some ports require correctly set-up hpd registers for detection to
-        * work properly (leading to ghost connected connector status), e.g. VGA
-        * on gm45.  Hence we can only set up the initial fbdev config after hpd
-        * irqs are fully enabled. We do it last so that the async config
-        * cannot run before the connectors are registered.
-        */
-       intel_fbdev_initial_config_async(dev);
+               /*
+                * Some ports require correctly set-up hpd registers for
+                * detection to work properly (leading to ghost connected
+                * connector status), e.g. VGA on gm45.  Hence we can only set
+                * up the initial fbdev config after hpd irqs are fully
+                * enabled. We do it last so that the async config cannot run
+                * before the connectors are registered.
+                */
+               intel_fbdev_initial_config_async(dev);
 
-       /*
-        * We need to coordinate the hotplugs with the asynchronous fbdev
-        * configuration, for which we use the fbdev->async_cookie.
-        */
-       if (HAS_DISPLAY(dev_priv))
+               /*
+                * We need to coordinate the hotplugs with the asynchronous
+                * fbdev configuration, for which we use the
+                * fbdev->async_cookie.
+                */
                drm_kms_helper_poll_init(dev);
+       }
 
        intel_power_domains_enable(dev_priv);
        intel_runtime_pm_enable(&dev_priv->runtime_pm);
@@ -726,20 +727,23 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
        intel_runtime_pm_disable(&dev_priv->runtime_pm);
        intel_power_domains_disable(dev_priv);
 
-       intel_fbdev_unregister(dev_priv);
-       intel_audio_deinit(dev_priv);
+       if (HAS_DISPLAY(dev_priv)) {
+               intel_fbdev_unregister(dev_priv);
+               intel_audio_deinit(dev_priv);
+
+               /*
+                * After flushing the fbdev (incl. a late async config which
+                * will have delayed queuing of a hotplug event), then flush
+                * the hotplug events.
+                */
+               drm_kms_helper_poll_fini(&dev_priv->drm);
+               drm_atomic_helper_shutdown(&dev_priv->drm);
 
-       /*
-        * After flushing the fbdev (incl. a late async config which will
-        * have delayed queuing of a hotplug event), then flush the hotplug
-        * events.
-        */
-       drm_kms_helper_poll_fini(&dev_priv->drm);
-       drm_atomic_helper_shutdown(&dev_priv->drm);
+               acpi_video_unregister();
+               intel_opregion_unregister(dev_priv);
+       }
 
        intel_gt_driver_unregister(&dev_priv->gt);
-       acpi_video_unregister();
-       intel_opregion_unregister(dev_priv);
 
        i915_perf_unregister(dev_priv);
        i915_pmu_unregister(dev_priv);