diff mbox series

[04/13] drm/i915/tc: Check for DP-alt, legacy sinks before taking PHY ownership

Message ID 20210921002313.1132357-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/tc: Fix TypeC connect/disconnect sequences | expand

Commit Message

Imre Deak Sept. 21, 2021, 12:23 a.m. UTC
On ADL-P the PHY ready/complete flag is always set even in TBT-alt mode.
To avoid taking the PHY ownership and the following spurious "PHY sudden
disconnect" messages on this platform when connecting the PHY in TBT
mode, check if there is any DP-alt or legacy sink connected before
taking the ownership.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_tc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Souza, Jose Sept. 24, 2021, 12:30 a.m. UTC | #1
On Tue, 2021-09-21 at 03:23 +0300, Imre Deak wrote:
> On ADL-P the PHY ready/complete flag is always set even in TBT-alt mode.
> To avoid taking the PHY ownership and the following spurious "PHY sudden
> disconnect" messages on this platform when connecting the PHY in TBT
> mode, check if there is any DP-alt or legacy sink connected before
> taking the ownership.
> 
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_tc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
> index 0d3555437b0b1..1f76c11d70834 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.c
> +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> @@ -432,6 +432,13 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
>  		goto out_set_tbt_alt_mode;
>  	}
>  
> +	if (!(tc_port_live_status_mask(dig_port) &
> +	      (BIT(TC_PORT_DP_ALT) | BIT(TC_PORT_LEGACY)))) {
> +		drm_dbg_kms(&i915->drm, "Port %s: nothing is connected\n",
> +			    dig_port->tc_port_name);

Misleading log, it could have actual TBT connected and it would print nothing is connected.

Could you also add a comment in tc_phy_status_complete() about the TBT behavior on adl-p?

Fixing the above:
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> +		goto out_set_tbt_alt_mode;
> +	}
> +
>  	if (!tc_phy_take_ownership(dig_port, true) &&
>  	    !drm_WARN_ON(&i915->drm, dig_port->tc_legacy_port))
>  		goto out_set_tbt_alt_mode;
Imre Deak Sept. 24, 2021, 3:31 p.m. UTC | #2
On Fri, Sep 24, 2021 at 03:30:07AM +0300, Souza, Jose wrote:
> On Tue, 2021-09-21 at 03:23 +0300, Imre Deak wrote:
> > On ADL-P the PHY ready/complete flag is always set even in TBT-alt mode.
> > To avoid taking the PHY ownership and the following spurious "PHY sudden
> > disconnect" messages on this platform when connecting the PHY in TBT
> > mode, check if there is any DP-alt or legacy sink connected before
> > taking the ownership.
> > 
> > Cc: José Roberto de Souza <jose.souza@intel.com>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_tc.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
> > index 0d3555437b0b1..1f76c11d70834 100644
> > --- a/drivers/gpu/drm/i915/display/intel_tc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> > @@ -432,6 +432,13 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
> >  		goto out_set_tbt_alt_mode;
> >  	}
> >  
> > +	if (!(tc_port_live_status_mask(dig_port) &
> > +	      (BIT(TC_PORT_DP_ALT) | BIT(TC_PORT_LEGACY)))) {
> > +		drm_dbg_kms(&i915->drm, "Port %s: nothing is connected\n",
> > +			    dig_port->tc_port_name);
> 
> Misleading log, it could have actual TBT connected and it would print
> nothing is connected.

Yes, missed that case. Will change that to print live_status_mask()
instead.

> Could you also add a comment in tc_phy_status_complete() about the TBT
> behavior on adl-p?

It means a different thing than what it means on previous platforms, can
add a note about this. 

> Fixing the above:
> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
> 
> > +		goto out_set_tbt_alt_mode;
> > +	}
> > +
> >  	if (!tc_phy_take_ownership(dig_port, true) &&
> >  	    !drm_WARN_ON(&i915->drm, dig_port->tc_legacy_port))
> >  		goto out_set_tbt_alt_mode;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index 0d3555437b0b1..1f76c11d70834 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -432,6 +432,13 @@  static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
 		goto out_set_tbt_alt_mode;
 	}
 
+	if (!(tc_port_live_status_mask(dig_port) &
+	      (BIT(TC_PORT_DP_ALT) | BIT(TC_PORT_LEGACY)))) {
+		drm_dbg_kms(&i915->drm, "Port %s: nothing is connected\n",
+			    dig_port->tc_port_name);
+		goto out_set_tbt_alt_mode;
+	}
+
 	if (!tc_phy_take_ownership(dig_port, true) &&
 	    !drm_WARN_ON(&i915->drm, dig_port->tc_legacy_port))
 		goto out_set_tbt_alt_mode;