public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/7] drm/i915: Don't use link_bw for PLL setup
Date: Tue, 07 Jul 2015 13:35:36 +0530	[thread overview]
Message-ID: <559B8850.1000001@intel.com> (raw)
In-Reply-To: <1436184606-18729-3-git-send-email-ville.syrjala@linux.intel.com>


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


Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>


On 7/6/2015 5:40 PM, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use port_clock instead of link_bw when picking the PLL parameters for
> DP. link_bw may be zero with an eDP 1.4 sink that supports
> DP_LINK_RATE_SET so we shouln't use it for anything other than feed it
shouldn't ?
> to the sink appropriately.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/intel_ddi.c | 11 ++++------
>   drivers/gpu/drm/i915/intel_dp.c  | 44 ++++++++++++++++++++--------------------
>   2 files changed, 26 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 9a40bfb..0d3cc98 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1574,17 +1574,14 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc,
>   			 DPLL_CFGCR2_PDIV(wrpll_params.pdiv) |
>   			 wrpll_params.central_freq;
>   	} else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) {
> -		struct drm_encoder *encoder = &intel_encoder->base;
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> -
> -		switch (intel_dp->link_bw) {
> -		case DP_LINK_BW_1_62:
> +		switch (crtc_state->port_clock / 2) {
> +		case 81000:
>   			ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0);
>   			break;
> -		case DP_LINK_BW_2_7:
> +		case 135000:
>   			ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1350, 0);
>   			break;
> -		case DP_LINK_BW_5_4:
> +		case 270000:
>   			ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_2700, 0);
>   			break;
>   		}
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index decefa1..3dd4342 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -48,28 +48,28 @@
>   #define INTEL_DP_RESOLUTION_FAILSAFE	(3 << INTEL_DP_RESOLUTION_SHIFT_MASK)
>   
>   struct dp_link_dpll {
> -	int link_bw;
> +	int clock;
>   	struct dpll dpll;
>   };
>   
>   static const struct dp_link_dpll gen4_dpll[] = {
> -	{ DP_LINK_BW_1_62,
> +	{ 162000,
>   		{ .p1 = 2, .p2 = 10, .n = 2, .m1 = 23, .m2 = 8 } },
> -	{ DP_LINK_BW_2_7,
> +	{ 270000,
>   		{ .p1 = 1, .p2 = 10, .n = 1, .m1 = 14, .m2 = 2 } }
>   };
>   
>   static const struct dp_link_dpll pch_dpll[] = {
> -	{ DP_LINK_BW_1_62,
> +	{ 162000,
>   		{ .p1 = 2, .p2 = 10, .n = 1, .m1 = 12, .m2 = 9 } },
> -	{ DP_LINK_BW_2_7,
> +	{ 270000,
>   		{ .p1 = 1, .p2 = 10, .n = 2, .m1 = 14, .m2 = 8 } }
>   };
>   
>   static const struct dp_link_dpll vlv_dpll[] = {
> -	{ DP_LINK_BW_1_62,
> +	{ 162000,
>   		{ .p1 = 3, .p2 = 2, .n = 5, .m1 = 3, .m2 = 81 } },
> -	{ DP_LINK_BW_2_7,
> +	{ 270000,
>   		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
>   };
>   
> @@ -83,11 +83,11 @@ static const struct dp_link_dpll chv_dpll[] = {
>   	 * m2 is stored in fixed point format using formula below
>   	 * (m2_int << 22) | m2_fraction
>   	 */
> -	{ DP_LINK_BW_1_62,	/* m2_int = 32, m2_fraction = 1677722 */
> +	{ 162000,	/* m2_int = 32, m2_fraction = 1677722 */
>   		{ .p1 = 4, .p2 = 2, .n = 1, .m1 = 2, .m2 = 0x819999a } },
> -	{ DP_LINK_BW_2_7,	/* m2_int = 27, m2_fraction = 0 */
> +	{ 270000,	/* m2_int = 27, m2_fraction = 0 */
>   		{ .p1 = 4, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } },
> -	{ DP_LINK_BW_5_4,	/* m2_int = 27, m2_fraction = 0 */
> +	{ 540000,	/* m2_int = 27, m2_fraction = 0 */
>   		{ .p1 = 2, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } }
>   };
>   
> @@ -1099,7 +1099,7 @@ intel_dp_connector_unregister(struct intel_connector *intel_connector)
>   }
>   
>   static void
> -skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock)
> +skl_edp_set_pll_config(struct intel_crtc_state *pipe_config)
>   {
>   	u32 ctrl1;
>   
> @@ -1111,7 +1111,7 @@ skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock)
>   	pipe_config->dpll_hw_state.cfgcr2 = 0;
>   
>   	ctrl1 = DPLL_CTRL1_OVERRIDE(SKL_DPLL0);
> -	switch (link_clock / 2) {
> +	switch (pipe_config->port_clock / 2) {
>   	case 81000:
>   		ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810,
>   					      SKL_DPLL0);
> @@ -1145,19 +1145,19 @@ skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock)
>   }
>   
>   static void
> -hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config, int link_bw)
> +hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config)
>   {
>   	memset(&pipe_config->dpll_hw_state, 0,
>   	       sizeof(pipe_config->dpll_hw_state));
>   
> -	switch (link_bw) {
> -	case DP_LINK_BW_1_62:
> +	switch (pipe_config->port_clock / 2) {
> +	case 81000:
>   		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_810;
>   		break;
> -	case DP_LINK_BW_2_7:
> +	case 135000:
>   		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_1350;
>   		break;
> -	case DP_LINK_BW_5_4:
> +	case 270000:
>   		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_2700;
>   		break;
>   	}
> @@ -1204,7 +1204,7 @@ intel_dp_source_rates(struct drm_device *dev, const int **source_rates)
>   
>   static void
>   intel_dp_set_clock(struct intel_encoder *encoder,
> -		   struct intel_crtc_state *pipe_config, int link_bw)
> +		   struct intel_crtc_state *pipe_config)
>   {
>   	struct drm_device *dev = encoder->base.dev;
>   	const struct dp_link_dpll *divisor = NULL;
> @@ -1226,7 +1226,7 @@ intel_dp_set_clock(struct intel_encoder *encoder,
>   
>   	if (divisor && count) {
>   		for (i = 0; i < count; i++) {
> -			if (link_bw == divisor[i].link_bw) {
> +			if (pipe_config->port_clock == divisor[i].clock) {
>   				pipe_config->dpll = divisor[i].dpll;
>   				pipe_config->clock_set = true;
>   				break;
> @@ -1498,13 +1498,13 @@ found:
>   	}
>   
>   	if (IS_SKYLAKE(dev) && is_edp(intel_dp))
> -		skl_edp_set_pll_config(pipe_config, common_rates[clock]);
> +		skl_edp_set_pll_config(pipe_config);
>   	else if (IS_BROXTON(dev))
>   		/* handled in ddi */;
>   	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
> -		hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw);
> +		hsw_dp_set_ddi_pll_sel(pipe_config);
>   	else
> -		intel_dp_set_clock(encoder, pipe_config, intel_dp->link_bw);
> +		intel_dp_set_clock(encoder, pipe_config);
>   
>   	return true;
>   }

-- 
regards,
Sivakumar


[-- Attachment #1.2: Type: text/html, Size: 7390 bytes --]

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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-07-07  8:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 12:09 [PATCH 0/7] drm/i915: Move DP link parameters out from intel_dp ville.syrjala
2015-07-06 12:10 ` [PATCH 1/7] drm/i915: Clean up DP/HDMI limited color range handling ville.syrjala
2015-08-13  6:16   ` Sivakumar Thulasimani
2015-08-13 12:01     ` Ville Syrjälä
2015-07-06 12:10 ` [PATCH 2/7] drm/i915: Don't use link_bw for PLL setup ville.syrjala
2015-07-07  8:05   ` Sivakumar Thulasimani [this message]
2015-08-11 17:21   ` [PATCH v2 " ville.syrjala
2015-07-06 12:10 ` [PATCH 3/7] drm/i915: Don't pass clock to DDI PLL select functions ville.syrjala
2015-07-07  8:07   ` Sivakumar Thulasimani
2015-07-06 12:10 ` [PATCH 4/7] drm/i915: Avoid confusion between DP and TRANS_DP_CTL in DP .get_config() ville.syrjala
2015-07-07  8:14   ` Sivakumar Thulasimani
2015-07-06 12:10 ` [PATCH 5/7] drm/i915: Move intel_dp->lane_count into pipe_config ville.syrjala
2015-07-06 13:39   ` [PATCH v2 " ville.syrjala
2015-08-13  7:00     ` Sivakumar Thulasimani
2015-07-06 12:10 ` [PATCH 6/7] drm/i915: Don't use link_bw to select between TP1 and TP3 ville.syrjala
2015-07-07  8:18   ` Sivakumar Thulasimani
2015-07-06 12:10 ` [PATCH 7/7] drm/i915: Kill intel_dp->{link_bw, rate_select} ville.syrjala
2015-07-07  8:46   ` Sivakumar Thulasimani
2015-07-10 23:13   ` shuang.he
2015-08-12 16:04 ` [PATCH 0/7] drm/i915: Move DP link parameters out from intel_dp Ville Syrjälä
2015-08-14  8:23   ` Daniel Vetter
2015-08-17  8:42 ` Maarten Lankhorst
2015-08-17 12:03   ` Ville Syrjälä
2015-08-25 12:57     ` Daniel Vetter
2015-08-25 14:11       ` Ville Syrjälä

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=559B8850.1000001@intel.com \
    --to=sivakumar.thulasimani@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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