linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH v4 3/3] drm/msm/dpu: add display port support in DPU
Date: Wed, 23 Jan 2019 10:49:32 -0500	[thread overview]
Message-ID: <20190123154932.GA46869@art_vandelay> (raw)
In-Reply-To: <1545086105-7770-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

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

  parent reply	other threads:[~2019-01-23 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-01-22 19:20 ` [Freedreno] [PATCH v4 1/3] drm/msm/dpu: fix documentation for intf_type Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123154932.GA46869@art_vandelay \
    --to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).