drm/i915: Register shadow VGA even when it produces spurious detection results
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 26 Sep 2016 09:20:45 +0000 (12:20 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 6 Oct 2016 14:07:21 +0000 (17:07 +0300)
Having a shadow VGA connector is useful for testing purposes. We
currently skip registering the connector on machines where the
CRT detect falsely reports it as connected. Let's instead move the
the blacklist check to the detect callback (and hpd setup) and
if we get a match we always report the connector as disconnected.
This way we get a shadow VGA connector to help with testing, while
we still avoid the user facing problems from the incorrect
detection results.

commit 8ca4013d702d ("CHROMIUM: i915: Add DMI override to skip CRT
initialization on ZGB") doesn't provide much in the way of details
as to why 'ACER ZGB' was added to the blacklist. Trying to trace it
further leads me to a chromeos bugreport I can't access. So based on
the fact that the commit added the
"/* Skip machines without VGA that falsely report hotplug events */"
comment, I'm going to assume that it was just spurious CRT detection.
So it should be safe to move the blacklist to just block the detection
and hpd without causing a regression on said machine.

In fact Stéphane confirmed on irc that the problem was indeed just
crappy hotplug detect:
"22:29 < marcheu> vsyrjala: the port isn't there, but the load detect is
 improperly stubbed in hw
 22:29 < marcheu> vsyrjala: so it floats"
so this change should be perfectly fine.

v2: Add irc quote from Stéphane

Cc: Duncan Laurie <dlaurie@chromium.org>
Cc: Olof Johansson <olofj@chromium.org>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1474881646-1326-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_crt.c

index ba372c239d486210c6651add48451dc165115ae0..e3753804c619adb24f3c2b7991d3eba29f605729 100644 (file)
@@ -643,6 +643,24 @@ intel_crt_load_detect(struct intel_crt *crt, uint32_t pipe)
        return status;
 }
 
+static int intel_spurious_crt_detect_dmi_callback(const struct dmi_system_id *id)
+{
+       DRM_DEBUG_DRIVER("Skipping CRT detection for %s\n", id->ident);
+       return 1;
+}
+
+static const struct dmi_system_id intel_spurious_crt_detect[] = {
+       {
+               .callback = intel_spurious_crt_detect_dmi_callback,
+               .ident = "ACER ZGB",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"),
+               },
+       },
+       { }
+};
+
 static enum drm_connector_status
 intel_crt_detect(struct drm_connector *connector, bool force)
 {
@@ -659,6 +677,10 @@ intel_crt_detect(struct drm_connector *connector, bool force)
                      connector->base.id, connector->name,
                      force);
 
+       /* Skip machines without VGA that falsely report hotplug events */
+       if (dmi_check_system(intel_spurious_crt_detect))
+               return connector_status_disconnected;
+
        power_domain = intel_display_port_power_domain(intel_encoder);
        intel_display_power_get(dev_priv, power_domain);
 
@@ -808,24 +830,6 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = {
        .destroy = intel_encoder_destroy,
 };
 
-static int intel_no_crt_dmi_callback(const struct dmi_system_id *id)
-{
-       DRM_INFO("Skipping CRT initialization for %s\n", id->ident);
-       return 1;
-}
-
-static const struct dmi_system_id intel_no_crt[] = {
-       {
-               .callback = intel_no_crt_dmi_callback,
-               .ident = "ACER ZGB",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"),
-               },
-       },
-       { }
-};
-
 void intel_crt_init(struct drm_device *dev)
 {
        struct drm_connector *connector;
@@ -835,10 +839,6 @@ void intel_crt_init(struct drm_device *dev)
        i915_reg_t adpa_reg;
        u32 adpa;
 
-       /* Skip machines without VGA that falsely report hotplug events */
-       if (dmi_check_system(intel_no_crt))
-               return;
-
        if (HAS_PCH_SPLIT(dev))
                adpa_reg = PCH_ADPA;
        else if (IS_VALLEYVIEW(dev))
@@ -906,7 +906,8 @@ void intel_crt_init(struct drm_device *dev)
                crt->base.disable = intel_disable_crt;
        }
        crt->base.enable = intel_enable_crt;
-       if (I915_HAS_HOTPLUG(dev))
+       if (I915_HAS_HOTPLUG(dev) &&
+           !dmi_check_system(intel_spurious_crt_detect))
                crt->base.hpd_pin = HPD_CRT;
        if (HAS_DDI(dev)) {
                crt->base.port = PORT_E;