All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type
@ 2018-12-17 22:35 Jeykumar Sankaran
       [not found] ` <1545086105-7770-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2019-01-22 19:20 ` [Freedreno] [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type Sean Paul
  0 siblings, 2 replies; 7+ messages in thread
From: Jeykumar Sankaran @ 2018-12-17 22:35 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

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
changes in v4:
	- none

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 9cd6a96..4725d52 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -126,7 +126,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

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

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

* [PATCH v4 2/3] drm/msm/dpu: handle failures while initializing displays
       [not found] ` <1545086105-7770-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-12-17 22:35   ` Jeykumar Sankaran
       [not found]     ` <1545086105-7770-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-17 22:35   ` [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
  1 sibling, 1 reply; 7+ messages in thread
From: Jeykumar Sankaran @ 2018-12-17 22:35 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
changes in v4:
    - avoid duplicate return on errors (Sean Paul)
    - avoid spamming errors on failures (Jordon Crouse)

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

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index d39b745..885bf88 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -405,35 +405,38 @@ 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);
 	}
 
 	priv->encoders[priv->num_encoders++] = 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;
+			break;
 		}
 	}
+
+	return rc;
 }
 
 /**
@@ -444,16 +447,16 @@ 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);
-
 	/**
 	 * Extend this function to initialize other
 	 * types of displays
 	 */
+
+	return _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
 }
 
 static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
@@ -516,7 +519,9 @@ 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)
+		goto fail;
 
 	max_crtc_count = min(catalog->mixer_count, priv->num_encoders);
 
-- 
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] 7+ messages in thread

* [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU
       [not found] ` <1545086105-7770-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-17 22:35   ` [PATCH v4 2/3] drm/msm/dpu: handle failures while initializing displays Jeykumar Sankaran
@ 2018-12-17 22:35   ` Jeykumar Sankaran
       [not found]     ` <1545086105-7770-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Jeykumar Sankaran @ 2018-12-17 22:35 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)
changes in v4:
    -  avoid duplicate returns (Jordan Crouse)
    -  get rid of duplicate error logs (Jordan Crouse)

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

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
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     | 58 +++++++++++++++++++++++++----
 2 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 0dda4a6..371d17d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2031,7 +2031,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) {
@@ -2054,9 +2054,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 885bf88..62b400c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -439,6 +439,31 @@ 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;
+
+	if (!priv->dp)
+		return 0;
+
+	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;
+}
+
 /**
  * _dpu_kms_setup_displays - create encoders, bridges and connectors
  *                           for underlying displays
@@ -451,12 +476,22 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
 				    struct msm_drm_private *priv,
 				    struct dpu_kms *dpu_kms)
 {
+	int rc;
+
+	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
+	if (rc)
+		goto fail;
+
+	rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
+	if (rc)
+		goto fail;
+
 	/**
 	 * Extend this function to initialize other
 	 * types of displays
 	 */
-
-	return _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
+fail:
+	return rc;
 }
 
 static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
@@ -669,13 +704,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] 7+ messages in thread

* Re: [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU
       [not found]     ` <1545086105-7770-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-12-19  1:40       ` kbuild test robot
  2019-01-23 15:49       ` Sean Paul
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-12-19  1:40 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw, kbuild-all-JC7UmRfGjtg,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

[-- Attachment #1: Type: text/plain, Size: 2701 bytes --]

Hi Jeykumar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robclark/msm-next]
[also build test ERROR on v4.20-rc7 next-20181218]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jeykumar-Sankaran/drm-msm-dpu-fix-documentation-for-intf_type/20181218-070519
base:   git://people.freedesktop.org/~robclark/linux msm-next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c: In function '_dpu_kms_initialize_displayport':
>> drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:449:13: error: 'struct msm_drm_private' has no member named 'dp'; did you mean 'edp'?
     if (!priv->dp)
                ^~
                edp
>> drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:458:7: error: implicit declaration of function 'msm_dp_modeset_init'; did you mean 'msm_edp_modeset_init'? [-Werror=implicit-function-declaration]
     rc = msm_dp_modeset_init(priv->dp, dev, encoder);
          ^~~~~~~~~~~~~~~~~~~
          msm_edp_modeset_init
   drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:458:33: error: 'struct msm_drm_private' has no member named 'dp'; did you mean 'edp'?
     rc = msm_dp_modeset_init(priv->dp, dev, encoder);
                                    ^~
                                    edp
   cc1: some warnings being treated as errors

vim +449 drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c

   441	
   442	static int _dpu_kms_initialize_displayport(struct drm_device *dev,
   443						    struct msm_drm_private *priv,
   444						    struct dpu_kms *dpu_kms)
   445	{
   446		struct drm_encoder *encoder = NULL;
   447		int rc;
   448	
 > 449		if (!priv->dp)
   450			return 0;
   451	
   452		encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
   453		if (IS_ERR(encoder)) {
   454			DPU_ERROR("encoder init failed for dsi display\n");
   455			return PTR_ERR(encoder);
   456		}
   457	
 > 458		rc = msm_dp_modeset_init(priv->dp, dev, encoder);
   459		if (rc) {
   460			DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
   461			drm_encoder_cleanup(encoder);
   462		}
   463	
   464		return rc;
   465	}
   466	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 61823 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

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

* Re: [Freedreno] [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type
  2018-12-17 22:35 [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type Jeykumar Sankaran
       [not found] ` <1545086105-7770-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2019-01-22 19:20 ` Sean Paul
  1 sibling, 0 replies; 7+ messages in thread
From: Sean Paul @ 2019-01-22 19:20 UTC (permalink / raw)
  To: Jeykumar Sankaran
  Cc: linux-arm-msm, dri-devel, seanpaul, hoegsberg, freedreno

On Mon, Dec 17, 2018 at 02:35:03PM -0800, Jeykumar Sankaran wrote:
> 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
> changes in v4:
> 	- none
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>

Pushed to dpu-staging. For the DP part of this series, it'd be helpful for
Chandan to package it up with his set so it all goes in one bundle. That should
also hopefully make kbuildbot happy.

Sean

> ---
>  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 9cd6a96..4725d52 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -126,7 +126,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
> 
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno

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

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

* Re: [PATCH v4 2/3] drm/msm/dpu: handle failures while initializing displays
       [not found]     ` <1545086105-7770-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2019-01-22 19:40       ` Sean Paul
  0 siblings, 0 replies; 7+ messages in thread
From: Sean Paul @ 2019-01-22 19:40 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 Mon, Dec 17, 2018 at 02:35:04PM -0800, Jeykumar Sankaran wrote:
> Bail out KMS hw init on display initialization failures with
> proper error logging.
> 
> changes in v3:
>     - introduced in the series
> changes in v4:
>     - avoid duplicate return on errors (Sean Paul)
>     - avoid spamming errors on failures (Jordon Crouse)
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>

Pushed this one too, so just the 3/3 patch should go with Chandan's series

Sean

> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index d39b745..885bf88 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -405,35 +405,38 @@ 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);
>  	}
>  
>  	priv->encoders[priv->num_encoders++] = 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;
> +			break;
>  		}
>  	}
> +
> +	return rc;
>  }
>  
>  /**
> @@ -444,16 +447,16 @@ 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);
> -
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
>  	 */
> +
> +	return _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>  }
>  
>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
> @@ -516,7 +519,9 @@ 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)
> +		goto fail;
>  
>  	max_crtc_count = min(catalog->mixer_count, priv->num_encoders);
>  
> -- 
> 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] 7+ messages in thread

* Re: [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU
       [not found]     ` <1545086105-7770-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2018-12-19  1:40       ` kbuild test robot
@ 2019-01-23 15:49       ` Sean Paul
  1 sibling, 0 replies; 7+ messages in thread
From: Sean Paul @ 2019-01-23 15:49 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 Mon, Dec 17, 2018 at 02:35:05PM -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)
> changes in v4:
>     -  avoid duplicate returns (Jordan Crouse)
>     -  get rid of duplicate error logs (Jordan Crouse)
> 
> [1] https://lwn.net/Articles/768265/
> [2] https://lkml.org/lkml/2018/11/17/87
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
> 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     | 58 +++++++++++++++++++++++++----
>  2 files changed, 54 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 0dda4a6..371d17d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2031,7 +2031,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) {
> @@ -2054,9 +2054,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 885bf88..62b400c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -439,6 +439,31 @@ 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;
> +
> +	if (!priv->dp)
> +		return 0;
> +
> +	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;
> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *                           for underlying displays
> @@ -451,12 +476,22 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
> +	int rc;
> +
> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	if (rc)
> +		goto fail;
> +
> +	rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +	if (rc)
> +		goto fail;
> +
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
>  	 */
> -
> -	return _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +fail:

One more thing, remove this label and just return directly above.

> +	return rc;

Then this becomes return 0

>  }
>  
>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
> @@ -669,13 +704,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

-- 
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] 7+ messages in thread

end of thread, other threads:[~2019-01-23 15:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17 22:35 [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type Jeykumar Sankaran
     [not found] ` <1545086105-7770-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-17 22:35   ` [PATCH v4 2/3] drm/msm/dpu: handle failures while initializing displays Jeykumar Sankaran
     [not found]     ` <1545086105-7770-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2019-01-22 19:40       ` Sean Paul
2018-12-17 22:35   ` [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
     [not found]     ` <1545086105-7770-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-19  1:40       ` kbuild test robot
2019-01-23 15:49       ` Sean Paul
2019-01-22 19:20 ` [Freedreno] [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type Sean Paul

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.