drm/i915: Store max lane count in intel_digital_port
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 8 Dec 2015 17:59:38 +0000 (19:59 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 12 Jan 2016 13:59:58 +0000 (15:59 +0200)
Rather than having open coded checks for the DDI A/E configuration,
just store the max supported lane count in intel_digital_port.

We had an open coded check for DDI A, but not for DDI E. So we may
have been vilating the DDI E max lane count.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c

index a69db463557fa864f21726a0e1c3628077b7d755..1e9d292d4037279d2b41f4bb198be2b645bee261 100644 (file)
@@ -3319,15 +3319,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
                return;
        }
 
-       if (WARN(max_lanes == 0,
-                "No lanes for port %c\n", port_name(port)))
-               return;
-
-       if (WARN(init_hdmi && max_lanes < 4,
-                "Not enough lanes (%d) for HDMI on port %c\n",
-                max_lanes, port_name(port)))
-               init_hdmi = false;
-
        intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
        if (!intel_dig_port)
                return;
@@ -3351,6 +3342,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
        intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
                                          (DDI_BUF_PORT_REVERSAL |
                                           DDI_A_4_LANES);
+       intel_dig_port->max_lanes = max_lanes;
 
        /*
         * Bspec says that DDI_A_4_LANES is the only supported configuration
index 5332eb7657e1fde9d2079ffafca300ae55354f33..9e02dd789b86d4c6b9f7a1c1fd62f2d9f8c660b6 100644 (file)
@@ -157,14 +157,9 @@ intel_dp_max_link_bw(struct intel_dp  *intel_dp)
 static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
 {
        struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-       struct drm_device *dev = intel_dig_port->base.base.dev;
        u8 source_max, sink_max;
 
-       source_max = 4;
-       if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
-           (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
-               source_max = 2;
-
+       source_max = intel_dig_port->max_lanes;
        sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
 
        return min(source_max, sink_max);
@@ -5839,6 +5834,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
        enum port port = intel_dig_port->port;
        int type, ret;
 
+       if (WARN(intel_dig_port->max_lanes < 1,
+                "Not enough lanes (%d) for DP on port %c\n",
+                intel_dig_port->max_lanes, port_name(port)))
+               return false;
+
        intel_dp->pps_pipe = INVALID_PIPE;
 
        /* intel_dp vfuncs */
@@ -6037,6 +6037,7 @@ intel_dp_init(struct drm_device *dev,
        intel_dig_port->port = port;
        dev_priv->dig_port_map[port] = intel_encoder;
        intel_dig_port->dp.output_reg = output_reg;
+       intel_dig_port->max_lanes = 4;
 
        intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
        if (IS_CHERRYVIEW(dev)) {
index bdfe4035e0744a4b4acc4da4912f8efcf333b085..32de7e478f8fca81c97601e0cf4e6e691172e41a 100644 (file)
@@ -845,6 +845,7 @@ struct intel_digital_port {
        struct intel_hdmi hdmi;
        enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
        bool release_cl2_override;
+       uint8_t max_lanes;
        /* for communication with audio component; protected by av_mutex */
        const struct drm_connector *audio_connector;
 };
index 054aa76133909047f89a2ce34e3049df1c558b15..d4ed7aa9927e48238b9b41f22ad93196b9dc7583 100755 (executable)
@@ -2033,6 +2033,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
        enum port port = intel_dig_port->port;
        uint8_t alternate_ddc_pin;
 
+       if (WARN(intel_dig_port->max_lanes < 4,
+                "Not enough lanes (%d) for HDMI on port %c\n",
+                intel_dig_port->max_lanes, port_name(port)))
+               return;
+
        drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
                           DRM_MODE_CONNECTOR_HDMIA);
        drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
@@ -2218,6 +2223,7 @@ void intel_hdmi_init(struct drm_device *dev,
        dev_priv->dig_port_map[port] = intel_encoder;
        intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
        intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
+       intel_dig_port->max_lanes = 4;
 
        intel_hdmi_init_connector(intel_dig_port, intel_connector);
 }