diff mbox

[v5,2/2] drm/i915: Check DP no aux transaction bit on link training

Message ID 1450697955-14830-3-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Dec. 21, 2015, 11:39 a.m. UTC
Check if no AUX transactions are required on DP link training.
If this bit is set, we can reuse the known good drive current
and pre-emphasis level from the last "full" link training.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91393
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c               |  2 +-
 drivers/gpu/drm/i915/intel_dp_link_training.c | 19 +++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h              |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)

Comments

Lukas Wunner Dec. 22, 2015, 3:53 p.m. UTC | #1
Hi Mika,

On Mon, Dec 21, 2015 at 01:39:15PM +0200, Mika Kahola wrote:
> Check if no AUX transactions are required on DP link training.
> If this bit is set, we can reuse the known good drive current
> and pre-emphasis level from the last "full" link training.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91393
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c               |  2 +-
>  drivers/gpu/drm/i915/intel_dp_link_training.c | 19 +++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h              |  1 +
>  3 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 6b36d82..3137187 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3852,7 +3852,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
>  	intel_dp->DP = DP;
>  }
>  
> -static bool
> +bool
>  intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
> index 59d59be..5fb3f97 100644
> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> @@ -85,6 +85,25 @@ static bool
>  intel_dp_reset_link_train(struct intel_dp *intel_dp,
>  			uint8_t dp_train_pat)
>  {
> +	bool has_dpcd;
> +	bool no_aux_handshake = false;
> +
> +	has_dpcd = intel_dp_get_dpcd(intel_dp);
> +
> +	/*
> +	 * Source device can try to use drive current and pre-emphasis
> +	 * parameters computed by the last "full" link training if the
> +	 * DP_NO_AUX_HANDSHAKE_LINK_TRAINING bit is set to 1.
> +	 */
> +	if (has_dpcd) {
> +		if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
> +			no_aux_handshake = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
> +					    DP_NO_AUX_HANDSHAKE_LINK_TRAINING);
> +		}
> +	}
> +
> +	intel_dp->train_set_valid &= no_aux_handshake;
> +

If Thierry Reding's patches get merged (posted to dri-devel@ on Dec 14
with <1450097764-30063-1-git-send-email-thierry.reding@gmail.com>),
you could just use

	if (has_dpcd && drm_dp_fast_training_cap(intel_dp->dpcd))
		intel_dp->train_set_valid &= true;

Also, if the patches get merged, the no_aux_handshake attribute in dev_priv
can be dropped (set in intel_edp_init_connector() but never read).

Best regards,

Lukas

>  	DRM_DEBUG_KMS("link training optimization: %s\n",
>  		      intel_dp->train_set_valid ? "true" : "false");
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index d523ebb..c36a70c 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1239,6 +1239,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
>  bool intel_dp_compute_config(struct intel_encoder *encoder,
>  			     struct intel_crtc_state *pipe_config);
>  bool intel_dp_is_edp(struct drm_device *dev, enum port port);
> +bool intel_dp_get_dpcd(struct intel_dp *intel_dp);
>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
>  				  bool long_hpd);
>  void intel_edp_backlight_on(struct intel_dp *intel_dp);
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula Dec. 23, 2015, 10:07 a.m. UTC | #2
On Tue, 22 Dec 2015, Lukas Wunner <lukas@wunner.de> wrote:
> Hi Mika,
>
> On Mon, Dec 21, 2015 at 01:39:15PM +0200, Mika Kahola wrote:
>> Check if no AUX transactions are required on DP link training.
>> If this bit is set, we can reuse the known good drive current
>> and pre-emphasis level from the last "full" link training.
>> 
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91393
>> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dp.c               |  2 +-
>>  drivers/gpu/drm/i915/intel_dp_link_training.c | 19 +++++++++++++++++++
>>  drivers/gpu/drm/i915/intel_drv.h              |  1 +
>>  3 files changed, 21 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 6b36d82..3137187 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3852,7 +3852,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
>>  	intel_dp->DP = DP;
>>  }
>>  
>> -static bool
>> +bool
>>  intel_dp_get_dpcd(struct intel_dp *intel_dp)
>>  {
>>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>> diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
>> index 59d59be..5fb3f97 100644
>> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
>> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
>> @@ -85,6 +85,25 @@ static bool
>>  intel_dp_reset_link_train(struct intel_dp *intel_dp,
>>  			uint8_t dp_train_pat)
>>  {
>> +	bool has_dpcd;
>> +	bool no_aux_handshake = false;
>> +
>> +	has_dpcd = intel_dp_get_dpcd(intel_dp);
>> +
>> +	/*
>> +	 * Source device can try to use drive current and pre-emphasis
>> +	 * parameters computed by the last "full" link training if the
>> +	 * DP_NO_AUX_HANDSHAKE_LINK_TRAINING bit is set to 1.
>> +	 */
>> +	if (has_dpcd) {
>> +		if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
>> +			no_aux_handshake = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
>> +					    DP_NO_AUX_HANDSHAKE_LINK_TRAINING);
>> +		}
>> +	}
>> +
>> +	intel_dp->train_set_valid &= no_aux_handshake;
>> +
>
> If Thierry Reding's patches get merged (posted to dri-devel@ on Dec 14
> with <1450097764-30063-1-git-send-email-thierry.reding@gmail.com>),
> you could just use
>
> 	if (has_dpcd && drm_dp_fast_training_cap(intel_dp->dpcd))
> 		intel_dp->train_set_valid &= true;
>
> Also, if the patches get merged, the no_aux_handshake attribute in dev_priv
> can be dropped (set in intel_edp_init_connector() but never read).

Good points, but we don't generally write code, let alone bugfixes, on
top of code that hasn't been merged.

BR,
Jani.


>
> Best regards,
>
> Lukas
>
>>  	DRM_DEBUG_KMS("link training optimization: %s\n",
>>  		      intel_dp->train_set_valid ? "true" : "false");
>>  
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index d523ebb..c36a70c 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -1239,6 +1239,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
>>  bool intel_dp_compute_config(struct intel_encoder *encoder,
>>  			     struct intel_crtc_state *pipe_config);
>>  bool intel_dp_is_edp(struct drm_device *dev, enum port port);
>> +bool intel_dp_get_dpcd(struct intel_dp *intel_dp);
>>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
>>  				  bool long_hpd);
>>  void intel_edp_backlight_on(struct intel_dp *intel_dp);
>> -- 
>> 1.9.1
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Mika Kahola Dec. 23, 2015, 12:30 p.m. UTC | #3
On Tue, 2015-12-22 at 16:53 +0100, Lukas Wunner wrote:
> Hi Mika,
> 
> On Mon, Dec 21, 2015 at 01:39:15PM +0200, Mika Kahola wrote:
> > Check if no AUX transactions are required on DP link training.
> > If this bit is set, we can reuse the known good drive current
> > and pre-emphasis level from the last "full" link training.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91393
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c               |  2 +-
> >  drivers/gpu/drm/i915/intel_dp_link_training.c | 19 +++++++++++++++++++
> >  drivers/gpu/drm/i915/intel_drv.h              |  1 +
> >  3 files changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 6b36d82..3137187 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -3852,7 +3852,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
> >  	intel_dp->DP = DP;
> >  }
> >  
> > -static bool
> > +bool
> >  intel_dp_get_dpcd(struct intel_dp *intel_dp)
> >  {
> >  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
> > index 59d59be..5fb3f97 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> > @@ -85,6 +85,25 @@ static bool
> >  intel_dp_reset_link_train(struct intel_dp *intel_dp,
> >  			uint8_t dp_train_pat)
> >  {
> > +	bool has_dpcd;
> > +	bool no_aux_handshake = false;
> > +
> > +	has_dpcd = intel_dp_get_dpcd(intel_dp);
> > +
> > +	/*
> > +	 * Source device can try to use drive current and pre-emphasis
> > +	 * parameters computed by the last "full" link training if the
> > +	 * DP_NO_AUX_HANDSHAKE_LINK_TRAINING bit is set to 1.
> > +	 */
> > +	if (has_dpcd) {
> > +		if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
> > +			no_aux_handshake = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
> > +					    DP_NO_AUX_HANDSHAKE_LINK_TRAINING);
> > +		}
> > +	}
> > +
> > +	intel_dp->train_set_valid &= no_aux_handshake;
> > +
> 
> If Thierry Reding's patches get merged (posted to dri-devel@ on Dec 14
> with <1450097764-30063-1-git-send-email-thierry.reding@gmail.com>),
> you could just use
> 
> 	if (has_dpcd && drm_dp_fast_training_cap(intel_dp->dpcd))
> 		intel_dp->train_set_valid &= true;
> 
> Also, if the patches get merged, the no_aux_handshake attribute in dev_priv
> can be dropped (set in intel_edp_init_connector() but never read).
> 
Thank you for the tip. I have missed this Thierry's patch.

Happy Holidays!
-Mika-

> Best regards,
> 
> Lukas
> 
> >  	DRM_DEBUG_KMS("link training optimization: %s\n",
> >  		      intel_dp->train_set_valid ? "true" : "false");
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index d523ebb..c36a70c 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1239,6 +1239,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
> >  bool intel_dp_compute_config(struct intel_encoder *encoder,
> >  			     struct intel_crtc_state *pipe_config);
> >  bool intel_dp_is_edp(struct drm_device *dev, enum port port);
> > +bool intel_dp_get_dpcd(struct intel_dp *intel_dp);
> >  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> >  				  bool long_hpd);
> >  void intel_edp_backlight_on(struct intel_dp *intel_dp);
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thierry Reding Jan. 4, 2016, 5:27 p.m. UTC | #4
On Tue, Dec 22, 2015 at 04:53:41PM +0100, Lukas Wunner wrote:
> Hi Mika,
> 
> On Mon, Dec 21, 2015 at 01:39:15PM +0200, Mika Kahola wrote:
> > Check if no AUX transactions are required on DP link training.
> > If this bit is set, we can reuse the known good drive current
> > and pre-emphasis level from the last "full" link training.

The commit message here isn't entirely accurate. You still need AUX
transactions to configure the link according to the values obtained
from the last full training sequence.

Thierry
Mika Kahola Jan. 5, 2016, 11:45 a.m. UTC | #5
On Mon, 2016-01-04 at 18:27 +0100, Thierry Reding wrote:
> On Tue, Dec 22, 2015 at 04:53:41PM +0100, Lukas Wunner wrote:
> > Hi Mika,
> > 
> > On Mon, Dec 21, 2015 at 01:39:15PM +0200, Mika Kahola wrote:
> > > Check if no AUX transactions are required on DP link training.
> > > If this bit is set, we can reuse the known good drive current
> > > and pre-emphasis level from the last "full" link training.
> 
> The commit message here isn't entirely accurate. You still need AUX
> transactions to configure the link according to the values obtained
> from the last full training sequence.
> 
> Thierry

Thanks Thierry! I need to rephrase the commit message.

Cheers,
Mika
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6b36d82..3137187 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3852,7 +3852,7 @@  intel_dp_link_down(struct intel_dp *intel_dp)
 	intel_dp->DP = DP;
 }
 
-static bool
+bool
 intel_dp_get_dpcd(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index 59d59be..5fb3f97 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -85,6 +85,25 @@  static bool
 intel_dp_reset_link_train(struct intel_dp *intel_dp,
 			uint8_t dp_train_pat)
 {
+	bool has_dpcd;
+	bool no_aux_handshake = false;
+
+	has_dpcd = intel_dp_get_dpcd(intel_dp);
+
+	/*
+	 * Source device can try to use drive current and pre-emphasis
+	 * parameters computed by the last "full" link training if the
+	 * DP_NO_AUX_HANDSHAKE_LINK_TRAINING bit is set to 1.
+	 */
+	if (has_dpcd) {
+		if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
+			no_aux_handshake = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+					    DP_NO_AUX_HANDSHAKE_LINK_TRAINING);
+		}
+	}
+
+	intel_dp->train_set_valid &= no_aux_handshake;
+
 	DRM_DEBUG_KMS("link training optimization: %s\n",
 		      intel_dp->train_set_valid ? "true" : "false");
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d523ebb..c36a70c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1239,6 +1239,7 @@  int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config);
 bool intel_dp_is_edp(struct drm_device *dev, enum port port);
+bool intel_dp_get_dpcd(struct intel_dp *intel_dp);
 enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
 				  bool long_hpd);
 void intel_edp_backlight_on(struct intel_dp *intel_dp);