diff mbox series

[5/5] drm/i915/dp: Dump the LTTPR PHY descriptors

Message ID 20240703155937.1674856-6-imre.deak@intel.com (mailing list archive)
State New
Headers show
Series drm/i915/dp: Fix LTTPR detection | expand

Commit Message

Imre Deak July 3, 2024, 3:59 p.m. UTC
Dump the descriptor of the detected LTTPRs in non-transparent mode to
help the debugging related to LTTPRs easier.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 .../drm/i915/display/intel_dp_link_training.c | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä July 5, 2024, 3:18 p.m. UTC | #1
On Wed, Jul 03, 2024 at 06:59:37PM +0300, Imre Deak wrote:
> Dump the descriptor of the detected LTTPRs in non-transparent mode to
> help the debugging related to LTTPRs easier.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  .../drm/i915/display/intel_dp_link_training.c | 22 ++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> index 31089f1b316d2..52b149793f3d0 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> @@ -199,6 +199,24 @@ static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_
>  	return 0;
>  }
>  
> +static void intel_dp_dump_lttpr_phy_desc(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy)
> +{
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +	struct drm_dp_dpcd_ident ident;
> +
> +	if (drm_dp_dpcd_read(&intel_dp->aux, DP_OUI_PHY_REPEATER(dp_phy),
> +			     &ident, sizeof(ident)) < 0)
> +		return;
> +
> +	drm_dbg_kms(&i915->drm,
> +		    "%s: %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
> +		    intel_dp->aux.name, drm_dp_phy_name(dp_phy),
> +		    (int)sizeof(ident.oui), ident.oui,
> +		    (int)strnlen(ident.device_id, sizeof(ident.device_id)), ident.device_id,
> +		    ident.hw_rev >> 4, ident.hw_rev & 0xf,
> +		    ident.sw_major_rev, ident.sw_minor_rev);

Dunno if we could share some code with drm_dp_read_desc()...

> +}
> +
>  static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEIVER_CAP_SIZE])
>  {
>  	int lttpr_count;
> @@ -206,8 +224,10 @@ static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI
>  
>  	lttpr_count = intel_dp_init_lttpr_phys(intel_dp, dpcd);
>  
> -	for (i = 0; i < lttpr_count; i++)
> +	for (i = 0; i < lttpr_count; i++) {
>  		intel_dp_read_lttpr_phy_caps(intel_dp, dpcd, DP_PHY_LTTPR(i));
> +		intel_dp_dump_lttpr_phy_desc(intel_dp, DP_PHY_LTTPR(i));
> +	}
>  
>  	return lttpr_count;
>  }
> -- 
> 2.43.3
Imre Deak July 5, 2024, 4:49 p.m. UTC | #2
On Fri, Jul 05, 2024 at 06:18:58PM +0300, Ville Syrjälä wrote:
> On Wed, Jul 03, 2024 at 06:59:37PM +0300, Imre Deak wrote:
> > Dump the descriptor of the detected LTTPRs in non-transparent mode to
> > help the debugging related to LTTPRs easier.
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  .../drm/i915/display/intel_dp_link_training.c | 22 ++++++++++++++++++-
> >  1 file changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > index 31089f1b316d2..52b149793f3d0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > @@ -199,6 +199,24 @@ static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_
> >  	return 0;
> >  }
> >  
> > +static void intel_dp_dump_lttpr_phy_desc(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy)
> > +{
> > +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> > +	struct drm_dp_dpcd_ident ident;
> > +
> > +	if (drm_dp_dpcd_read(&intel_dp->aux, DP_OUI_PHY_REPEATER(dp_phy),
> > +			     &ident, sizeof(ident)) < 0)
> > +		return;
> > +
> > +	drm_dbg_kms(&i915->drm,
> > +		    "%s: %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
> > +		    intel_dp->aux.name, drm_dp_phy_name(dp_phy),
> > +		    (int)sizeof(ident.oui), ident.oui,
> > +		    (int)strnlen(ident.device_id, sizeof(ident.device_id)), ident.device_id,
> > +		    ident.hw_rev >> 4, ident.hw_rev & 0xf,
> > +		    ident.sw_major_rev, ident.sw_minor_rev);
> 
> Dunno if we could share some code with drm_dp_read_desc()...

Ok, can add
drm_dp_dump_desc(aux, const char *device_name, const struct drm_dp_desc *desc)

This will also print the quirks mask not relevant to LTTPRs atm, but
that could change later.

> > +}
> > +
> >  static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEIVER_CAP_SIZE])
> >  {
> >  	int lttpr_count;
> > @@ -206,8 +224,10 @@ static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI
> >  
> >  	lttpr_count = intel_dp_init_lttpr_phys(intel_dp, dpcd);
> >  
> > -	for (i = 0; i < lttpr_count; i++)
> > +	for (i = 0; i < lttpr_count; i++) {
> >  		intel_dp_read_lttpr_phy_caps(intel_dp, dpcd, DP_PHY_LTTPR(i));
> > +		intel_dp_dump_lttpr_phy_desc(intel_dp, DP_PHY_LTTPR(i));
> > +	}
> >  
> >  	return lttpr_count;
> >  }
> > -- 
> > 2.43.3
> 
> -- 
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 31089f1b316d2..52b149793f3d0 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -199,6 +199,24 @@  static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_
 	return 0;
 }
 
+static void intel_dp_dump_lttpr_phy_desc(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy)
+{
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+	struct drm_dp_dpcd_ident ident;
+
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_OUI_PHY_REPEATER(dp_phy),
+			     &ident, sizeof(ident)) < 0)
+		return;
+
+	drm_dbg_kms(&i915->drm,
+		    "%s: %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
+		    intel_dp->aux.name, drm_dp_phy_name(dp_phy),
+		    (int)sizeof(ident.oui), ident.oui,
+		    (int)strnlen(ident.device_id, sizeof(ident.device_id)), ident.device_id,
+		    ident.hw_rev >> 4, ident.hw_rev & 0xf,
+		    ident.sw_major_rev, ident.sw_minor_rev);
+}
+
 static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEIVER_CAP_SIZE])
 {
 	int lttpr_count;
@@ -206,8 +224,10 @@  static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI
 
 	lttpr_count = intel_dp_init_lttpr_phys(intel_dp, dpcd);
 
-	for (i = 0; i < lttpr_count; i++)
+	for (i = 0; i < lttpr_count; i++) {
 		intel_dp_read_lttpr_phy_caps(intel_dp, dpcd, DP_PHY_LTTPR(i));
+		intel_dp_dump_lttpr_phy_desc(intel_dp, DP_PHY_LTTPR(i));
+	}
 
 	return lttpr_count;
 }