diff options
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 42bdca47c5d6..4f2a38181491 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -2083,11 +2083,44 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
2083 | } | 2083 | } |
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | /* XXX this is probably wrong for multiple downstream ports */ | ||
2086 | static enum drm_connector_status | 2087 | static enum drm_connector_status |
2087 | intel_dp_detect_dpcd(struct intel_dp *intel_dp) | 2088 | intel_dp_detect_dpcd(struct intel_dp *intel_dp) |
2088 | { | 2089 | { |
2089 | if (intel_dp_get_dpcd(intel_dp)) | 2090 | uint8_t *dpcd = intel_dp->dpcd; |
2091 | bool hpd; | ||
2092 | uint8_t type; | ||
2093 | |||
2094 | if (!intel_dp_get_dpcd(intel_dp)) | ||
2095 | return connector_status_disconnected; | ||
2096 | |||
2097 | /* if there's no downstream port, we're done */ | ||
2098 | if (!(dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT)) | ||
2099 | return connector_status_connected; | ||
2100 | |||
2101 | /* If we're HPD-aware, SINK_COUNT changes dynamically */ | ||
2102 | hpd = !!(intel_dp->downstream_ports[0] & DP_DS_PORT_HPD); | ||
2103 | if (hpd) { | ||
2104 | uint8_t sink_count; | ||
2105 | if (!intel_dp_aux_native_read_retry(intel_dp, DP_SINK_COUNT, | ||
2106 | &sink_count, 1)) | ||
2107 | return connector_status_unknown; | ||
2108 | sink_count &= DP_SINK_COUNT_MASK; | ||
2109 | return sink_count ? connector_status_connected | ||
2110 | : connector_status_disconnected; | ||
2111 | } | ||
2112 | |||
2113 | /* If no HPD, poke DDC gently */ | ||
2114 | if (drm_probe_ddc(&intel_dp->adapter)) | ||
2090 | return connector_status_connected; | 2115 | return connector_status_connected; |
2116 | |||
2117 | /* Well we tried, say unknown for unreliable port types */ | ||
2118 | type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK; | ||
2119 | if (type == DP_DS_PORT_TYPE_VGA || type == DP_DS_PORT_TYPE_NON_EDID) | ||
2120 | return connector_status_unknown; | ||
2121 | |||
2122 | /* Anything else is out of spec, warn and ignore */ | ||
2123 | DRM_DEBUG_KMS("Broken DP branch device, ignoring\n"); | ||
2091 | return connector_status_disconnected; | 2124 | return connector_status_disconnected; |
2092 | } | 2125 | } |
2093 | 2126 | ||