Browse Source

drm/bridge: cdns-mhdp: Print error if DP link BW isn't enough for mode

Print an error message if the negotiated DisplayPort link does not
have enough bandwidth to transmit the requested video mode. The video
enablement may also fail a bit later of there is not enough room for
transfer unit framing on the link. Add an error print for that too.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Jyri Sarha 6 years ago
parent
commit
8a1c5b0752
1 changed files with 14 additions and 1 deletions
  1. 14 1
      drivers/gpu/drm/bridge/cdns-mhdp.c

+ 14 - 1
drivers/gpu/drm/bridge/cdns-mhdp.c

@@ -1581,6 +1581,14 @@ static int cdns_mhdp_sst_enable(struct drm_bridge *bridge)
 
 
 	bpp = cdns_mhdp_get_bpp(&mhdp->display_fmt);
 	bpp = cdns_mhdp_get_bpp(&mhdp->display_fmt);
 
 
+	if (!cdns_mhdp_bandwidth_ok(mhdp, mode, mhdp->link.num_lanes,
+				    mhdp->link.rate)) {
+		dev_err(mhdp->dev, "%s: Not enough BW for %s (%u lanes at %u Mbps)\n",
+			__func__, mode->name, mhdp->link.num_lanes,
+			mhdp->link.rate / 100);
+		return -EINVAL;
+	}
+
 	/* find optimal tu_size */
 	/* find optimal tu_size */
 	required_bandwidth = pxlclock * bpp / 8;
 	required_bandwidth = pxlclock * bpp / 8;
 	available_bandwidth = mhdp->link.num_lanes * rate;
 	available_bandwidth = mhdp->link.num_lanes * rate;
@@ -1597,8 +1605,13 @@ static int cdns_mhdp_sst_enable(struct drm_bridge *bridge)
 	} while ((vs == 1 || ((vs_f > 850 || vs_f < 100) && vs_f != 0) ||
 	} while ((vs == 1 || ((vs_f > 850 || vs_f < 100) && vs_f != 0) ||
 		  tu_size - vs < 2) && tu_size < 64);
 		  tu_size - vs < 2) && tu_size < 64);
 
 
-	if (vs > 64)
+	if (vs > 64) {
+		dev_err(mhdp->dev,
+			"%s: No space for framing %s (%u lanes at %u Mbps)\n",
+			__func__, mode->name, mhdp->link.num_lanes,
+			mhdp->link.rate / 100);
 		return -EINVAL;
 		return -EINVAL;
+	}
 
 
 	cdns_mhdp_reg_write(mhdp, CDNS_DP_FRAMER_TU,
 	cdns_mhdp_reg_write(mhdp, CDNS_DP_FRAMER_TU,
 			    CDNS_DP_FRAMER_TU_VS(vs) |
 			    CDNS_DP_FRAMER_TU_VS(vs) |