All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] drm/msm/dpu: fix documentation for intf_type
@ 2018-12-13 18:51 Jeykumar Sankaran
       [not found] ` <1544727064-26763-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Jeykumar Sankaran @ 2018-12-13 18:51 UTC (permalink / raw)
  To: dri-devel, freedreno, linux-arm-msm; +Cc: hoegsberg, seanpaul

Fix intf_type description in msm_disp_info to show that
it represents drm encoder mode of the display.

changes in v3:
	- introduced in the series

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
 drivers/gpu/drm/msm/msm_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 60a7da0..4b0ae70 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -119,7 +119,7 @@ struct msm_display_topology {
 
 /**
  * struct msm_display_info - defines display properties
- * @intf_type:          DRM_MODE_CONNECTOR_ display type
+ * @intf_type:          DRM_MODE_ENCODER_ type
  * @capabilities:       Bitmask of display flags
  * @num_of_h_tiles:     Number of horizontal tiles in case of split interface
  * @h_tile_instance:    Controller instance used per tile. Number of elements is
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
       [not found] ` <1544727064-26763-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-12-13 18:51   ` Jeykumar Sankaran
       [not found]     ` <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-13 18:51   ` [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
  1 sibling, 1 reply; 9+ messages in thread
From: Jeykumar Sankaran @ 2018-12-13 18:51 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
  Cc: hoegsberg-hpIqsD4AKlfQT0dZR+AlfA, Jeykumar Sankaran,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w

Bail out KMS hw init on display initialization failures with
proper error logging.

changes in v3:
	- introduced in the series

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39 +++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 685686e..39c8549 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
 	}
 }
 
-static void _dpu_kms_initialize_dsi(struct drm_device *dev,
+static int _dpu_kms_initialize_dsi(struct drm_device *dev,
 				    struct msm_drm_private *priv,
 				    struct dpu_kms *dpu_kms)
 {
 	struct drm_encoder *encoder = NULL;
-	int i, rc;
+	int i, rc = 0;
+
+	if (!(priv->dsi[0] || priv->dsi[1]))
+		return rc;
 
 	/*TODO: Support two independent DSI connectors */
 	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
-	if (IS_ERR_OR_NULL(encoder)) {
+	if (IS_ERR(encoder)) {
 		DPU_ERROR("encoder init failed for dsi display\n");
-		return;
+		return PTR_ERR(encoder);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-		if (!priv->dsi[i]) {
-			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
-			return;
-		}
+		if (!priv->dsi[i])
+			continue;
 
 		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
 		if (rc) {
 			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
 				i, rc);
-			continue;
+			return rc;
 		}
 	}
+
+	return rc;
 }
 
 /**
@@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
  * @dpu_kms:    Pointer to dpu kms structure
  * Returns:     Zero on success
  */
-static void _dpu_kms_setup_displays(struct drm_device *dev,
+static int _dpu_kms_setup_displays(struct drm_device *dev,
 				    struct msm_drm_private *priv,
 				    struct dpu_kms *dpu_kms)
 {
-	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
+	int rc = 0;
+
+	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
+	if (rc) {
+		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
+		return rc;
+	}
 
 	/**
 	 * Extend this function to initialize other
 	 * types of displays
 	 */
+
+	return rc;
 }
 
 static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
@@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
 	 * Create encoder and query display drivers to create
 	 * bridges and connectors
 	 */
-	_dpu_kms_setup_displays(dev, priv, dpu_kms);
+	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
+	if (ret) {
+		DPU_ERROR("failed to setup display, rc = %d\n", ret);
+		goto fail;
+	}
 
 	max_crtc_count = min(catalog->mixer_count,
 			     (u32)dev->mode_config.num_encoder);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU
       [not found] ` <1544727064-26763-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-13 18:51   ` [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays Jeykumar Sankaran
@ 2018-12-13 18:51   ` Jeykumar Sankaran
       [not found]     ` <1544727064-26763-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Jeykumar Sankaran @ 2018-12-13 18:51 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
  Cc: hoegsberg-hpIqsD4AKlfQT0dZR+AlfA, Jeykumar Sankaran,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w

Add display port support in DPU by creating hooks
for DP encoder enumeration and encoder mode
initialization.

This change is based on the SDM845 Display port
driver changes[1].

changes in v2:
	- rebase on [2] (Sean Paul)
	- remove unwanted error checks and
	  switch cases (Jordan Crouse)
changes in v3:
	- add dp support after fixing
	  the current code base for error logging (Sean Paul)

[1] https://lwn.net/Articles/768265/
[2] https://lkml.org/lkml/2018/11/17/87

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c     | 51 +++++++++++++++++++++++++----
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 36158b7..b79fd9d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2029,7 +2029,7 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 {
 	int ret = 0;
 	int i = 0;
-	enum dpu_intf_type intf_type;
+	enum dpu_intf_type intf_type = INTF_NONE;
 	struct dpu_enc_phys_init_params phys_params;
 
 	if (!dpu_enc || !dpu_kms) {
@@ -2052,9 +2052,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 	case DRM_MODE_ENCODER_DSI:
 		intf_type = INTF_DSI;
 		break;
-	default:
-		DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
-		return -EINVAL;
+	case DRM_MODE_ENCODER_TMDS:
+		intf_type = INTF_DP;
+		break;
 	}
 
 	WARN_ON(disp_info->num_of_h_tiles < 1);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 39c8549..ba3e75c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -437,6 +437,32 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
 	return rc;
 }
 
+static int _dpu_kms_initialize_displayport(struct drm_device *dev,
+					    struct msm_drm_private *priv,
+					    struct dpu_kms *dpu_kms)
+{
+	struct drm_encoder *encoder = NULL;
+	int rc = 0;
+
+	if (!priv->dp)
+		return rc;
+
+	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
+	if (IS_ERR(encoder)) {
+		DPU_ERROR("encoder init failed for dsi display\n");
+		return PTR_ERR(encoder);
+	}
+
+	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
+	if (rc) {
+		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
+		drm_encoder_cleanup(encoder);
+		return rc;
+	}
+
+	return rc;
+}
+
 /**
  * _dpu_kms_setup_displays - create encoders, bridges and connectors
  *                           for underlying displays
@@ -457,6 +483,12 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
 		return rc;
 	}
 
+	rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
+	if (rc) {
+		DPU_ERROR("failed to initialize display port, rc = %d\n", rc);
+		return rc;
+	}
+
 	/**
 	 * Extend this function to initialize other
 	 * types of displays
@@ -675,13 +707,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
 	info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
 			MSM_DISPLAY_CAP_VID_MODE;
 
-	/* TODO: No support for DSI swap */
-	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-		if (priv->dsi[i]) {
-			info.h_tile_instance[info.num_of_h_tiles] = i;
-			info.num_of_h_tiles++;
+	switch (info.intf_type) {
+	case DRM_MODE_ENCODER_DSI:
+		/* TODO: No support for DSI swap */
+		for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+			if (priv->dsi[i]) {
+				info.h_tile_instance[info.num_of_h_tiles] = i;
+				info.num_of_h_tiles++;
+			}
 		}
-	}
+		break;
+	case DRM_MODE_ENCODER_TMDS:
+		info.num_of_h_tiles = 1;
+		break;
+	};
 
 	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
 	if (rc)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
       [not found]     ` <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-12-14 15:22       ` Sean Paul
  2018-12-17 19:35         ` Jeykumar Sankaran
  2018-12-17 20:27         ` Jeykumar Sankaran
  2018-12-14 15:36       ` Jordan Crouse
  1 sibling, 2 replies; 9+ messages in thread
From: Sean Paul @ 2018-12-14 15:22 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Dec 13, 2018 at 10:51:03AM -0800, Jeykumar Sankaran wrote:
> Bail out KMS hw init on display initialization failures with
> proper error logging.
> 
> changes in v3:
> 	- introduced in the series
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39 +++++++++++++++++++++++----------
>  1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 685686e..39c8549 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
>  	}
>  }
>  
> -static void _dpu_kms_initialize_dsi(struct drm_device *dev,
> +static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
>  	struct drm_encoder *encoder = NULL;
> -	int i, rc;
> +	int i, rc = 0;
> +
> +	if (!(priv->dsi[0] || priv->dsi[1]))

It'd be nice to not have to support both blocks if only one is hooked up.
Perhaps move the TODO below above this check.

> +		return rc;
>  
>  	/*TODO: Support two independent DSI connectors */
>  	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
> -	if (IS_ERR_OR_NULL(encoder)) {
> +	if (IS_ERR(encoder)) {
>  		DPU_ERROR("encoder init failed for dsi display\n");
> -		return;
> +		return PTR_ERR(encoder);
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -		if (!priv->dsi[i]) {
> -			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
> -			return;
> -		}
> +		if (!priv->dsi[i])

I don't think this is possible given the check at the beginning of the function

> +			continue;
>  
>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>  		if (rc) {
>  			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>  				i, rc);
> -			continue;
> +			return rc;
>  		}
>  	}
> +
> +	return rc;

nit: You can keep rc uninitialized above and just return 0 here.

>  }
>  
>  /**
> @@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>   * @dpu_kms:    Pointer to dpu kms structure
>   * Returns:     Zero on success
>   */
> -static void _dpu_kms_setup_displays(struct drm_device *dev,
> +static int _dpu_kms_setup_displays(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
> -	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	int rc = 0;

nit: No need to initialize to 0

> +
> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	if (rc) {
> +		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
> +		return rc;
> +	}
>  
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
>  	 */
> +
> +	return rc;
>  }
>  
>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
> @@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  	 * Create encoder and query display drivers to create
>  	 * bridges and connectors
>  	 */
> -	_dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	if (ret) {
> +		DPU_ERROR("failed to setup display, rc = %d\n", ret);
> +		goto fail;
> +	}
>  
>  	max_crtc_count = min(catalog->mixer_count,
>  			     (u32)dev->mode_config.num_encoder);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU
       [not found]     ` <1544727064-26763-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-12-14 15:26       ` Sean Paul
  2018-12-14 15:27       ` Jordan Crouse
  1 sibling, 0 replies; 9+ messages in thread
From: Sean Paul @ 2018-12-14 15:26 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Dec 13, 2018 at 10:51:04AM -0800, Jeykumar Sankaran wrote:
> Add display port support in DPU by creating hooks
> for DP encoder enumeration and encoder mode
> initialization.
> 
> This change is based on the SDM845 Display port
> driver changes[1].
> 
> changes in v2:
> 	- rebase on [2] (Sean Paul)
> 	- remove unwanted error checks and
> 	  switch cases (Jordan Crouse)
> changes in v3:
> 	- add dp support after fixing
> 	  the current code base for error logging (Sean Paul)
> 
> [1] https://lwn.net/Articles/768265/
> [2] https://lkml.org/lkml/2018/11/17/87
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>

LGTM, thanks for revising. 

I'll land the first 2 patches (after the 2nd one is fixed up), and Chandan can
roll this patch into his set when he sends the new version. 

Reviewed-by: Sean Paul <sean@poorly.run>

> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c     | 51 +++++++++++++++++++++++++----
>  2 files changed, 49 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 36158b7..b79fd9d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2029,7 +2029,7 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
>  {
>  	int ret = 0;
>  	int i = 0;
> -	enum dpu_intf_type intf_type;
> +	enum dpu_intf_type intf_type = INTF_NONE;
>  	struct dpu_enc_phys_init_params phys_params;
>  
>  	if (!dpu_enc || !dpu_kms) {
> @@ -2052,9 +2052,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
>  	case DRM_MODE_ENCODER_DSI:
>  		intf_type = INTF_DSI;
>  		break;
> -	default:
> -		DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
> -		return -EINVAL;
> +	case DRM_MODE_ENCODER_TMDS:
> +		intf_type = INTF_DP;
> +		break;
>  	}
>  
>  	WARN_ON(disp_info->num_of_h_tiles < 1);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 39c8549..ba3e75c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -437,6 +437,32 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>  	return rc;
>  }
>  
> +static int _dpu_kms_initialize_displayport(struct drm_device *dev,
> +					    struct msm_drm_private *priv,
> +					    struct dpu_kms *dpu_kms)
> +{
> +	struct drm_encoder *encoder = NULL;
> +	int rc = 0;
> +
> +	if (!priv->dp)
> +		return rc;
> +
> +	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> +	if (IS_ERR(encoder)) {
> +		DPU_ERROR("encoder init failed for dsi display\n");
> +		return PTR_ERR(encoder);
> +	}
> +
> +	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> +	if (rc) {
> +		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> +		drm_encoder_cleanup(encoder);
> +		return rc;
> +	}
> +
> +	return rc;
> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *                           for underlying displays
> @@ -457,6 +483,12 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
>  		return rc;
>  	}
>  
> +	rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +	if (rc) {
> +		DPU_ERROR("failed to initialize display port, rc = %d\n", rc);
> +		return rc;
> +	}
> +
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
> @@ -675,13 +707,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
>  	info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
>  			MSM_DISPLAY_CAP_VID_MODE;
>  
> -	/* TODO: No support for DSI swap */
> -	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -		if (priv->dsi[i]) {
> -			info.h_tile_instance[info.num_of_h_tiles] = i;
> -			info.num_of_h_tiles++;
> +	switch (info.intf_type) {
> +	case DRM_MODE_ENCODER_DSI:
> +		/* TODO: No support for DSI swap */
> +		for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> +			if (priv->dsi[i]) {
> +				info.h_tile_instance[info.num_of_h_tiles] = i;
> +				info.num_of_h_tiles++;
> +			}
>  		}
> -	}
> +		break;
> +	case DRM_MODE_ENCODER_TMDS:
> +		info.num_of_h_tiles = 1;
> +		break;
> +	};
>  
>  	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
>  	if (rc)
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU
       [not found]     ` <1544727064-26763-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-14 15:26       ` Sean Paul
@ 2018-12-14 15:27       ` Jordan Crouse
  1 sibling, 0 replies; 9+ messages in thread
From: Jordan Crouse @ 2018-12-14 15:27 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Dec 13, 2018 at 10:51:04AM -0800, Jeykumar Sankaran wrote:
> Add display port support in DPU by creating hooks
> for DP encoder enumeration and encoder mode
> initialization.
> 
> This change is based on the SDM845 Display port
> driver changes[1].
> 
> changes in v2:
> 	- rebase on [2] (Sean Paul)
> 	- remove unwanted error checks and
> 	  switch cases (Jordan Crouse)
> changes in v3:
> 	- add dp support after fixing
> 	  the current code base for error logging (Sean Paul)
> 
> [1] https://lwn.net/Articles/768265/
> [2] https://lkml.org/lkml/2018/11/17/87

Two more nits - with these: Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>

> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c     | 51 +++++++++++++++++++++++++----
>  2 files changed, 49 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 36158b7..b79fd9d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2029,7 +2029,7 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
>  {
>  	int ret = 0;
>  	int i = 0;
> -	enum dpu_intf_type intf_type;
> +	enum dpu_intf_type intf_type = INTF_NONE;
>  	struct dpu_enc_phys_init_params phys_params;
>  
>  	if (!dpu_enc || !dpu_kms) {
> @@ -2052,9 +2052,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
>  	case DRM_MODE_ENCODER_DSI:
>  		intf_type = INTF_DSI;
>  		break;
> -	default:
> -		DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
> -		return -EINVAL;
> +	case DRM_MODE_ENCODER_TMDS:
> +		intf_type = INTF_DP;
> +		break;
>  	}
>  
>  	WARN_ON(disp_info->num_of_h_tiles < 1);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 39c8549..ba3e75c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -437,6 +437,32 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>  	return rc;
>  }
>  
> +static int _dpu_kms_initialize_displayport(struct drm_device *dev,
> +					    struct msm_drm_private *priv,
> +					    struct dpu_kms *dpu_kms)
> +{
> +	struct drm_encoder *encoder = NULL;
> +	int rc = 0;
> +
> +	if (!priv->dp)
> +		return rc;
> +
> +	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> +	if (IS_ERR(encoder)) {
> +		DPU_ERROR("encoder init failed for dsi display\n");
> +		return PTR_ERR(encoder);
> +	}
> +
> +	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> +	if (rc) {
> +		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> +		drm_encoder_cleanup(encoder);
> +		return rc;

Return rc isn't needed here because you also return rc immediately after the
block.
> +	}
> +
> +	return rc;
> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *                           for underlying displays
> @@ -457,6 +483,12 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
>  		return rc;
>  	}
>  
> +	rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +	if (rc) {
> +		DPU_ERROR("failed to initialize display port, rc = %d\n", rc);

_dpu_kms_initialize_displayport() already prints error messages in every path
so you don't need to pile on.

> +		return rc;
> +	}
> +
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
> @@ -675,13 +707,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
>  	info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
>  			MSM_DISPLAY_CAP_VID_MODE;
>  
> -	/* TODO: No support for DSI swap */
> -	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -		if (priv->dsi[i]) {
> -			info.h_tile_instance[info.num_of_h_tiles] = i;
> -			info.num_of_h_tiles++;
> +	switch (info.intf_type) {
> +	case DRM_MODE_ENCODER_DSI:
> +		/* TODO: No support for DSI swap */
> +		for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> +			if (priv->dsi[i]) {
> +				info.h_tile_instance[info.num_of_h_tiles] = i;
> +				info.num_of_h_tiles++;
> +			}
>  		}
> -	}
> +		break;
> +	case DRM_MODE_ENCODER_TMDS:
> +		info.num_of_h_tiles = 1;
> +		break;
> +	};
>  
>  	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
>  	if (rc)

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
       [not found]     ` <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-14 15:22       ` Sean Paul
@ 2018-12-14 15:36       ` Jordan Crouse
  1 sibling, 0 replies; 9+ messages in thread
From: Jordan Crouse @ 2018-12-14 15:36 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Dec 13, 2018 at 10:51:03AM -0800, Jeykumar Sankaran wrote:
> Bail out KMS hw init on display initialization failures with
> proper error logging.
> 
> changes in v3:
> 	- introduced in the series
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39 +++++++++++++++++++++++----------
>  1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 685686e..39c8549 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
>  	}
>  }
>  
> -static void _dpu_kms_initialize_dsi(struct drm_device *dev,
> +static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
>  	struct drm_encoder *encoder = NULL;
> -	int i, rc;
> +	int i, rc = 0;
> +
> +	if (!(priv->dsi[0] || priv->dsi[1]))
> +		return rc;
>  
>  	/*TODO: Support two independent DSI connectors */
>  	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
> -	if (IS_ERR_OR_NULL(encoder)) {
> +	if (IS_ERR(encoder)) {
>  		DPU_ERROR("encoder init failed for dsi display\n");
> -		return;
> +		return PTR_ERR(encoder);
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -		if (!priv->dsi[i]) {
> -			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
> -			return;
> -		}
> +		if (!priv->dsi[i])
> +			continue;
>  
>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>  		if (rc) {
>  			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>  				i, rc);
> -			continue;
> +			return rc;
>  		}
>  	}
> +
> +	return rc;

This also looks like one of those cases where you can drop out of the if
statement to return rc.
>  }
>  
>  /**
> @@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>   * @dpu_kms:    Pointer to dpu kms structure
>   * Returns:     Zero on success
>   */
> -static void _dpu_kms_setup_displays(struct drm_device *dev,
> +static int _dpu_kms_setup_displays(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
> -	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	int rc = 0;
> +
> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	if (rc) {
> +		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
> +		return rc;
> +	}
>  
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
>  	 */
> +
> +	return rc;

Here too.

>  }
>  
>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
> @@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  	 * Create encoder and query display drivers to create
>  	 * bridges and connectors
>  	 */
> -	_dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	if (ret) {
> +		DPU_ERROR("failed to setup display, rc = %d\n", ret);

You don't need to pile on with another error message.

> +		goto fail;
> +	}
>  
>  	max_crtc_count = min(catalog->mixer_count,
>  			     (u32)dev->mode_config.num_encoder);

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
  2018-12-14 15:22       ` Sean Paul
@ 2018-12-17 19:35         ` Jeykumar Sankaran
  2018-12-17 20:27         ` Jeykumar Sankaran
  1 sibling, 0 replies; 9+ messages in thread
From: Jeykumar Sankaran @ 2018-12-17 19:35 UTC (permalink / raw)
  To: Sean Paul
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2018-12-14 07:22, Sean Paul wrote:
> On Thu, Dec 13, 2018 at 10:51:03AM -0800, Jeykumar Sankaran wrote:
>> Bail out KMS hw init on display initialization failures with
>> proper error logging.
>> 
>> changes in v3:
>> 	- introduced in the series
>> 
>> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
>> ---
>>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39
> +++++++++++++++++++++++----------
>>  1 file changed, 27 insertions(+), 12 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> index 685686e..39c8549 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> @@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct
> msm_kms *kms,
>>  	}
>>  }
>> 
>> -static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>> +static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>>  				    struct msm_drm_private *priv,
>>  				    struct dpu_kms *dpu_kms)
>>  {
>>  	struct drm_encoder *encoder = NULL;
>> -	int i, rc;
>> +	int i, rc = 0;
>> +
>> +	if (!(priv->dsi[0] || priv->dsi[1]))
> 
> It'd be nice to not have to support both blocks if only one is hooked 
> up.
> Perhaps move the TODO below above this check.
> 
For dual DSI panels (e.g: MTP panels), both of these blocks will be 
populated.
TODO comment below is to convey that the support for two independent 
single DSI
panels is not yet available in DPU.

Thanks and Regards,
Jeykumar S.
>> +		return rc;
>> 
>>  	/*TODO: Support two independent DSI connectors */
>>  	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
>> -	if (IS_ERR_OR_NULL(encoder)) {
>> +	if (IS_ERR(encoder)) {
>>  		DPU_ERROR("encoder init failed for dsi display\n");
>> -		return;
>> +		return PTR_ERR(encoder);
>>  	}
>> 
>>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
>> -		if (!priv->dsi[i]) {
>> -			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
>> -			return;
>> -		}
>> +		if (!priv->dsi[i])
> 
> I don't think this is possible given the check at the beginning of the
> function
> 
>> +			continue;
>> 
>>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>>  		if (rc) {
>>  			DPU_ERROR("modeset_init failed for dsi[%d], rc =
> %d\n",
>>  				i, rc);
>> -			continue;
>> +			return rc;
>>  		}
>>  	}
>> +
>> +	return rc;
> 
> nit: You can keep rc uninitialized above and just return 0 here.
> 
>>  }
>> 
>>  /**
>> @@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct
> drm_device *dev,
>>   * @dpu_kms:    Pointer to dpu kms structure
>>   * Returns:     Zero on success
>>   */
>> -static void _dpu_kms_setup_displays(struct drm_device *dev,
>> +static int _dpu_kms_setup_displays(struct drm_device *dev,
>>  				    struct msm_drm_private *priv,
>>  				    struct dpu_kms *dpu_kms)
>>  {
>> -	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>> +	int rc = 0;
> 
> nit: No need to initialize to 0
> 
>> +
>> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>> +	if (rc) {
>> +		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
>> +		return rc;
>> +	}
>> 
>>  	/**
>>  	 * Extend this function to initialize other
>>  	 * types of displays
>>  	 */
>> +
>> +	return rc;
>>  }
>> 
>>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
>> @@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms
> *dpu_kms)
>>  	 * Create encoder and query display drivers to create
>>  	 * bridges and connectors
>>  	 */
>> -	_dpu_kms_setup_displays(dev, priv, dpu_kms);
>> +	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
>> +	if (ret) {
>> +		DPU_ERROR("failed to setup display, rc = %d\n", ret);
>> +		goto fail;
>> +	}
>> 
>>  	max_crtc_count = min(catalog->mixer_count,
>>  			     (u32)dev->mode_config.num_encoder);
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
>> a Linux Foundation Collaborative Project
>> 
>> _______________________________________________
>> Freedreno mailing list
>> Freedreno@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/freedreno

-- 
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
  2018-12-14 15:22       ` Sean Paul
  2018-12-17 19:35         ` Jeykumar Sankaran
@ 2018-12-17 20:27         ` Jeykumar Sankaran
  1 sibling, 0 replies; 9+ messages in thread
From: Jeykumar Sankaran @ 2018-12-17 20:27 UTC (permalink / raw)
  To: Sean Paul
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2018-12-14 07:22, Sean Paul wrote:
> On Thu, Dec 13, 2018 at 10:51:03AM -0800, Jeykumar Sankaran wrote:
>> Bail out KMS hw init on display initialization failures with
>> proper error logging.
>> 
>> changes in v3:
>> 	- introduced in the series
>> 
>> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
>> ---
>>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39
> +++++++++++++++++++++++----------
>>  1 file changed, 27 insertions(+), 12 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> index 685686e..39c8549 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> @@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct
> msm_kms *kms,
>>  	}
>>  }
>> 
>> -static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>> +static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>>  				    struct msm_drm_private *priv,
>>  				    struct dpu_kms *dpu_kms)
>>  {
>>  	struct drm_encoder *encoder = NULL;
>> -	int i, rc;
>> +	int i, rc = 0;
>> +
>> +	if (!(priv->dsi[0] || priv->dsi[1]))
> 
> It'd be nice to not have to support both blocks if only one is hooked 
> up.
> Perhaps move the TODO below above this check.
> 
>> +		return rc;
>> 
>>  	/*TODO: Support two independent DSI connectors */
>>  	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
>> -	if (IS_ERR_OR_NULL(encoder)) {
>> +	if (IS_ERR(encoder)) {
>>  		DPU_ERROR("encoder init failed for dsi display\n");
>> -		return;
>> +		return PTR_ERR(encoder);
>>  	}
>> 
>>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
>> -		if (!priv->dsi[i]) {
>> -			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
>> -			return;
>> -		}
>> +		if (!priv->dsi[i])
> 
> I don't think this is possible given the check at the beginning of the
> function
> 
The check at the beginning returns only if BOTH the dsi blocks are NULL.
In case of full hd panel, only one of the dsi block will be active. The
above check is needed to return on the inactive dsi.

Thanks,
Jeykumar S.
>> +			continue;
>> 
>>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>>  		if (rc) {
>>  			DPU_ERROR("modeset_init failed for dsi[%d], rc =
> %d\n",
>>  				i, rc);
>> -			continue;
>> +			return rc;
>>  		}
>>  	}
>> +
>> +	return rc;
> 
> nit: You can keep rc uninitialized above and just return 0 here.
> 
>>  }
>> 
>>  /**
>> @@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct
> drm_device *dev,
>>   * @dpu_kms:    Pointer to dpu kms structure
>>   * Returns:     Zero on success
>>   */
>> -static void _dpu_kms_setup_displays(struct drm_device *dev,
>> +static int _dpu_kms_setup_displays(struct drm_device *dev,
>>  				    struct msm_drm_private *priv,
>>  				    struct dpu_kms *dpu_kms)
>>  {
>> -	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>> +	int rc = 0;
> 
> nit: No need to initialize to 0
> 
>> +
>> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>> +	if (rc) {
>> +		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
>> +		return rc;
>> +	}
>> 
>>  	/**
>>  	 * Extend this function to initialize other
>>  	 * types of displays
>>  	 */
>> +
>> +	return rc;
>>  }
>> 
>>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
>> @@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms
> *dpu_kms)
>>  	 * Create encoder and query display drivers to create
>>  	 * bridges and connectors
>>  	 */
>> -	_dpu_kms_setup_displays(dev, priv, dpu_kms);
>> +	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
>> +	if (ret) {
>> +		DPU_ERROR("failed to setup display, rc = %d\n", ret);
>> +		goto fail;
>> +	}
>> 
>>  	max_crtc_count = min(catalog->mixer_count,
>>  			     (u32)dev->mode_config.num_encoder);
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
>> a Linux Foundation Collaborative Project
>> 
>> _______________________________________________
>> Freedreno mailing list
>> Freedreno@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/freedreno

-- 
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-17 20:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 18:51 [PATCH v3 1/3] drm/msm/dpu: fix documentation for intf_type Jeykumar Sankaran
     [not found] ` <1544727064-26763-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-13 18:51   ` [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays Jeykumar Sankaran
     [not found]     ` <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-14 15:22       ` Sean Paul
2018-12-17 19:35         ` Jeykumar Sankaran
2018-12-17 20:27         ` Jeykumar Sankaran
2018-12-14 15:36       ` Jordan Crouse
2018-12-13 18:51   ` [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
     [not found]     ` <1544727064-26763-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-14 15:26       ` Sean Paul
2018-12-14 15:27       ` Jordan Crouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.