diff mbox

[1/6] drm/bridge: tc358767: do no fail on hi-res displays

Message ID 20170727124736.3854-2-andrey.gusakov@cogentembedded.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrey Gusakov July 27, 2017, 12:47 p.m. UTC
Do not fail data rates higher than 2.7 and more than 2 lanes.
Try to fall back to 2.7Gbps and 2 lanes.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
 drivers/gpu/drm/bridge/tc358767.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Philipp Zabel Aug. 1, 2017, 1:11 p.m. UTC | #1
On Thu, 2017-07-27 at 15:47 +0300, Andrey Gusakov wrote:
> Do not fail data rates higher than 2.7 and more than 2 lanes.
> Try to fall back to 2.7Gbps and 2 lanes.
> 
> Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
> ---
>  drivers/gpu/drm/bridge/tc358767.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 5c26488e7a2d..f605bb7d1aa3 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -603,8 +603,15 @@ static int tc_get_display_props(struct tc_data *tc)
>  	ret = drm_dp_link_probe(&tc->aux, &tc->link.base);
>  	if (ret < 0)
>  		goto err_dpcd_read;
> -	if ((tc->link.base.rate != 162000) && (tc->link.base.rate != 270000))
> -		goto err_dpcd_inval;
> +	if ((tc->link.base.rate != 162000) && (tc->link.base.rate != 270000)) {
> +		dev_dbg(tc->dev, "Falling to 2.7 Gbps rate\n");
> +		tc->link.base.rate = 270000;
> +	}
> +
> +	if (tc->link.base.num_lanes > 2) {
> +		dev_dbg(tc->dev, "Falling to 2 lanes\n");
> +		tc->link.base.num_lanes = 2;
> +	}
>  
>  	ret = drm_dp_dpcd_readb(&tc->aux, DP_MAX_DOWNSPREAD, tmp);
>  	if (ret < 0)
> @@ -637,9 +644,6 @@ static int tc_get_display_props(struct tc_data *tc)
>  err_dpcd_read:
>  	dev_err(tc->dev, "failed to read DPCD: %d\n", ret);
>  	return ret;
> -err_dpcd_inval:
> -	dev_err(tc->dev, "invalid DPCD\n");
> -	return -EINVAL;
>  }
>  
>  static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox

Patch

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 5c26488e7a2d..f605bb7d1aa3 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -603,8 +603,15 @@  static int tc_get_display_props(struct tc_data *tc)
 	ret = drm_dp_link_probe(&tc->aux, &tc->link.base);
 	if (ret < 0)
 		goto err_dpcd_read;
-	if ((tc->link.base.rate != 162000) && (tc->link.base.rate != 270000))
-		goto err_dpcd_inval;
+	if ((tc->link.base.rate != 162000) && (tc->link.base.rate != 270000)) {
+		dev_dbg(tc->dev, "Falling to 2.7 Gbps rate\n");
+		tc->link.base.rate = 270000;
+	}
+
+	if (tc->link.base.num_lanes > 2) {
+		dev_dbg(tc->dev, "Falling to 2 lanes\n");
+		tc->link.base.num_lanes = 2;
+	}
 
 	ret = drm_dp_dpcd_readb(&tc->aux, DP_MAX_DOWNSPREAD, tmp);
 	if (ret < 0)
@@ -637,9 +644,6 @@  static int tc_get_display_props(struct tc_data *tc)
 err_dpcd_read:
 	dev_err(tc->dev, "failed to read DPCD: %d\n", ret);
 	return ret;
-err_dpcd_inval:
-	dev_err(tc->dev, "invalid DPCD\n");
-	return -EINVAL;
 }
 
 static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)