All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse@codeaurora.org>
To: Jeykumar Sankaran <jsanka@codeaurora.org>
Cc: seanpaul@chromium.org, linux-arm-msm@vger.kernel.org,
	hoegsberg@google.com, freedreno@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/msm/dpu: add display port support in DPU
Date: Fri, 16 Nov 2018 13:33:30 -0700	[thread overview]
Message-ID: <20181116203330.GD6285@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <1542396142-19534-2-git-send-email-jsanka@codeaurora.org>

On Fri, Nov 16, 2018 at 11:22:22AM -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].
> 
> [1] https://lwn.net/Articles/768265/
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  3 ++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c     | 49 +++++++++++++++++++++++++----
>  2 files changed, 46 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index b253165..e9c7edc6 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2048,6 +2048,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
>  	case DRM_MODE_ENCODER_DSI:
>  		intf_type = INTF_DSI;
>  		break;
> +	case DRM_MODE_ENCODER_TMDS:
> +		intf_type = INTF_DP;
> +		break;
>  	default:
>  		DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 985c855..b823a37 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -473,6 +473,31 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>  	}
>  }
>  
> +static void _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;
> +
> +	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> +	if (IS_ERR_OR_NULL(encoder)) {

dpu_encoder_init() only returns valid pointer or ERR_PTR() so a Only IS_ERR() is
needed.

> +		DPU_ERROR("encoder init failed for dsi display\n");
> +		return;
> +	}
> +
> +	priv->encoders[priv->num_encoders++] = encoder;
> +
> +	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> +	if (rc) {
> +		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> +		dpu_encoder_uninit(encoder);
> +	}
> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *                           for underlying displays
> @@ -487,6 +512,8 @@ static void _dpu_kms_setup_displays(struct drm_device *dev,
>  {
>  	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>  
> +	_dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
> @@ -723,13 +750,23 @@ 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;
> +	default:
> +		DPU_ERROR("Invalid connector type\n");
> +		return;
> +	};

This is still going to be one of two options, a simple if/else can suffice here
and you don't need a log message and a default path.
>  
>  	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
>  	if (rc)

Jordan
-- 
The Qualcomm Innovation Center, Inc. is a member of 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

  reply	other threads:[~2018-11-16 20:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 19:22 [PATCH 1/2] drm/msm/dpu: add dpu encoder uninit Jeykumar Sankaran
2018-11-16 19:22 ` [PATCH 2/2] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
2018-11-16 20:33   ` Jordan Crouse [this message]
     [not found] ` <1542396142-19534-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-16 21:35   ` [PATCH 1/2] drm/msm/dpu: add dpu encoder uninit Sean Paul
2018-11-16 21:37     ` Sean Paul
2018-11-19 18:50       ` Jeykumar Sankaran
2018-11-19 18:48     ` Jeykumar Sankaran

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=20181116203330.GD6285@jcrouse-lnx.qualcomm.com \
    --to=jcrouse@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hoegsberg@google.com \
    --cc=jsanka@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=seanpaul@chromium.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 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.