drm/dp: Make sink count DP 1.2 aware
authorAdam Jackson <ajax@redhat.com>
Thu, 20 Sep 2012 20:42:45 +0000 (16:42 -0400)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 26 Sep 2012 12:26:06 +0000 (14:26 +0200)
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c
include/drm/drm_dp_helper.h

index 4f2a38181491866c7f5480da98529abc31219e70..c63f54e848470789b8d39f8240facbde75c6e548 100644 (file)
@@ -2101,13 +2101,12 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
        /* If we're HPD-aware, SINK_COUNT changes dynamically */
        hpd = !!(intel_dp->downstream_ports[0] & DP_DS_PORT_HPD);
        if (hpd) {
-               uint8_t sink_count;
+               uint8_t reg;
                if (!intel_dp_aux_native_read_retry(intel_dp, DP_SINK_COUNT,
-                                                   &sink_count, 1))
+                                                   &reg, 1))
                        return connector_status_unknown;
-               sink_count &= DP_SINK_COUNT_MASK;
-               return sink_count ? connector_status_connected
-                                 : connector_status_disconnected;
+               return DP_GET_SINK_COUNT(reg) ? connector_status_connected
+                                             : connector_status_disconnected;
        }
 
        /* If no HPD, poke DDC gently */
index 38ffcb4332aa97f2075dccaefa3471699edb839d..fe061489f91f9b188b21dadfbd0e9a71782599f9 100644 (file)
 # define DP_PSR_FRAME_CAPTURE              (1 << 3)
 
 #define DP_SINK_COUNT                      0x200
-# define DP_SINK_COUNT_MASK                (31 << 0)
+/* prior to 1.2 bit 7 was reserved mbz */
+# define DP_GET_SINK_COUNT(x)              ((((x) & 0x80) >> 1) | ((x) & 0x3f))
 # define DP_SINK_CP_READY                  (1 << 6)
 
 #define DP_DEVICE_SERVICE_IRQ_VECTOR       0x201