All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Hai Li <hali@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/msm: Add the eDP connector in msm drm driver
Date: Mon, 8 Dec 2014 14:34:33 +0100	[thread overview]
Message-ID: <20141208133431.GB13942@ulmo.nvidia.com> (raw)
In-Reply-To: <1417815001-9883-2-git-send-email-hali@codeaurora.org>


[-- Attachment #1.1: Type: text/plain, Size: 2484 bytes --]

On Fri, Dec 05, 2014 at 04:30:01PM -0500, Hai Li wrote:
> Modified the hard-coded hdmi connector/encoder implementations in msm drm
> driver to support both edp and hdmi.

s/hdmi/HDMI/, s/msm/MSM/, s/drm/DRM/, s/edp/eDP/

[...]
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
[...]
> @@ -177,7 +180,28 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
>  	/* probably need to get DATA_EN polarity from panel.. */
>  
>  	dtv_hsync_skew = 0;  /* get this from panel? */
> -	format = 0x213f;     /* get this from panel? */
> +
> +	/* Get color format from panel, default is 8bpc */
> +	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
> +		if (connector->encoder == encoder) {
> +			switch (connector->display_info.bpc) {
> +			case 4:
> +				format |= 0;
> +				break;
> +			case 5:
> +				format |= 0x15;
> +				break;
> +			case 6:
> +				format |= 0x2A;
> +				break;
> +			case 8:
> +			default:
> +				format |= 0x3F;
> +				break;
> +			}
> +			break;

I suppose that it might be obvious from the above switch statement, but
having symbolic names for the values of format might still be good for
readability.

> +		}
> +	}
>  
>  	hsync_start_x = (mode->htotal - mode->hsync_start);
>  	hsync_end_x = mode->htotal - (mode->hsync_start - mode->hdisplay) - 1;
> @@ -187,6 +211,16 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
>  	display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + dtv_hsync_skew;
>  	display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * mode->htotal) + dtv_hsync_skew - 1;
>  
> +	/*
> +	 * For edp only:
> +	 * DISPLAY_V_START = (VBP * HCYCLE) + HBP
> +	 * DISPLAY_V_END = (VBP + VACTIVE) * HCYCLE - 1 - HFP
> +	 */
> +	if (mdp5_encoder->intf_id == INTF_eDP) {
> +		display_v_start += (mode->htotal - mode->hsync_start);
> +		display_v_end -= (mode->hsync_start - mode->hdisplay);

No need for the parentheses.

> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
[...]
>  	struct drm_device *dev = mdp5_kms->dev;
>  	struct msm_drm_private *priv = dev->dev_private;
> -	struct drm_encoder *encoder;
> +	struct drm_encoder *edp_encoder = NULL, *hdmi_encoder = NULL;

Can't you simply reuse encoder? It's scope is limited to the
conditionals, so no need to have two separate variables.

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Hai Li <hali@codeaurora.org>
Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, robdclark@gmail.com
Subject: Re: [PATCH 2/2] drm/msm: Add the eDP connector in msm drm driver
Date: Mon, 8 Dec 2014 14:34:33 +0100	[thread overview]
Message-ID: <20141208133431.GB13942@ulmo.nvidia.com> (raw)
In-Reply-To: <1417815001-9883-2-git-send-email-hali@codeaurora.org>

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

On Fri, Dec 05, 2014 at 04:30:01PM -0500, Hai Li wrote:
> Modified the hard-coded hdmi connector/encoder implementations in msm drm
> driver to support both edp and hdmi.

s/hdmi/HDMI/, s/msm/MSM/, s/drm/DRM/, s/edp/eDP/

[...]
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
[...]
> @@ -177,7 +180,28 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
>  	/* probably need to get DATA_EN polarity from panel.. */
>  
>  	dtv_hsync_skew = 0;  /* get this from panel? */
> -	format = 0x213f;     /* get this from panel? */
> +
> +	/* Get color format from panel, default is 8bpc */
> +	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
> +		if (connector->encoder == encoder) {
> +			switch (connector->display_info.bpc) {
> +			case 4:
> +				format |= 0;
> +				break;
> +			case 5:
> +				format |= 0x15;
> +				break;
> +			case 6:
> +				format |= 0x2A;
> +				break;
> +			case 8:
> +			default:
> +				format |= 0x3F;
> +				break;
> +			}
> +			break;

I suppose that it might be obvious from the above switch statement, but
having symbolic names for the values of format might still be good for
readability.

> +		}
> +	}
>  
>  	hsync_start_x = (mode->htotal - mode->hsync_start);
>  	hsync_end_x = mode->htotal - (mode->hsync_start - mode->hdisplay) - 1;
> @@ -187,6 +211,16 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
>  	display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + dtv_hsync_skew;
>  	display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * mode->htotal) + dtv_hsync_skew - 1;
>  
> +	/*
> +	 * For edp only:
> +	 * DISPLAY_V_START = (VBP * HCYCLE) + HBP
> +	 * DISPLAY_V_END = (VBP + VACTIVE) * HCYCLE - 1 - HFP
> +	 */
> +	if (mdp5_encoder->intf_id == INTF_eDP) {
> +		display_v_start += (mode->htotal - mode->hsync_start);
> +		display_v_end -= (mode->hsync_start - mode->hdisplay);

No need for the parentheses.

> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
[...]
>  	struct drm_device *dev = mdp5_kms->dev;
>  	struct msm_drm_private *priv = dev->dev_private;
> -	struct drm_encoder *encoder;
> +	struct drm_encoder *edp_encoder = NULL, *hdmi_encoder = NULL;

Can't you simply reuse encoder? It's scope is limited to the
conditionals, so no need to have two separate variables.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-12-08 13:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 21:30 [PATCH 1/2] drm/msm: Initial add eDP support in msm drm driver (V2) Hai Li
2014-12-05 21:30 ` [PATCH 2/2] drm/msm: Add the eDP connector in msm drm driver Hai Li
2014-12-08 13:34   ` Thierry Reding [this message]
2014-12-08 13:34     ` Thierry Reding
2014-12-08 13:28 ` [PATCH 1/2] drm/msm: Initial add eDP support in msm drm driver (V2) Thierry Reding
2014-12-08 13:28   ` Thierry Reding
2014-12-08 18:05   ` Rob Clark
2014-12-08 18:05     ` Rob Clark
2014-12-11 18:26   ` hali
  -- strict thread matches above, loose matches on Subject: below --
2014-12-12 17:35 [PATCH 1/2] drm/msm: Initial add eDP support in msm drm driver (V3) Hai Li
2014-12-12 17:35 ` [PATCH 2/2] drm/msm: Add the eDP connector in msm drm driver Hai Li
2014-11-19 23:10 [PATCH 1/2] drm/msm: Initial add eDP support " Hai Li
2014-11-19 23:10 ` [PATCH 2/2] drm/msm: Add the eDP connector " Hai Li

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=20141208133431.GB13942@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hali@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.