diff mbox series

[2/5] drm/i915/adl_p: Handle TC cold

Message ID 20210524214805.259692-2-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915/display/adl_p: Drop earlier return in tc_has_modular_fia() | expand

Commit Message

Souza, Jose May 24, 2021, 9:48 p.m. UTC
On ADL-P TC cold is exited and blocked when legacy aux is powered,
that is exacly the same of what ICL need for static TC ports.

TODO: When a TBT hub or monitor is connected it will cause TBT and
legacy aux to be powered at the same time, hopefully this will not
cause any issues but if it do, some rework will be needed.

v2:
 - skip icl_tc_port_assert_ref_held() warn on, adl-p uses aux to
   block TC cold

v3:
 - Drop icl_tc_port_assert_ref_held() earlier return for adl_p, not
   needed anymore
 - Set timeout_expected when enabling aux power well as port could be
   disconnected when tc_cold_block() is called

BSpec: 55480
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_power.c |  6 ++----
 drivers/gpu/drm/i915/display/intel_tc.c            | 14 ++++++++++----
 drivers/gpu/drm/i915/display/intel_tc.h            |  2 ++
 3 files changed, 14 insertions(+), 8 deletions(-)

Comments

Clint Taylor May 24, 2021, 10:24 p.m. UTC | #1
On 5/24/21 2:48 PM, José Roberto de Souza wrote:
> On ADL-P TC cold is exited and blocked when legacy aux is powered,
> that is exacly the same of what ICL need for static TC ports.
>
> TODO: When a TBT hub or monitor is connected it will cause TBT and
> legacy aux to be powered at the same time, hopefully this will not
> cause any issues but if it do, some rework will be needed.
>
> v2:
>   - skip icl_tc_port_assert_ref_held() warn on, adl-p uses aux to
>     block TC cold
>
> v3:
>   - Drop icl_tc_port_assert_ref_held() earlier return for adl_p, not
>     needed anymore
>   - Set timeout_expected when enabling aux power well as port could be
>     disconnected when tc_cold_block() is called
>
> BSpec: 55480
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Clinton Taylor <Clinton.A.Taylor@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_display_power.c |  6 ++----
>   drivers/gpu/drm/i915/display/intel_tc.c            | 14 ++++++++++----
>   drivers/gpu/drm/i915/display/intel_tc.h            |  2 ++
>   3 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 991ceea06a07..2f7d1664c473 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -619,11 +619,9 @@ icl_tc_phy_aux_power_well_enable(struct drm_i915_private *dev_priv,
>   	 * or need to enable AUX on a legacy TypeC port as part of the TC-cold
>   	 * exit sequence.
>   	 */
> -	timeout_expected = is_tbt;
> -	if (DISPLAY_VER(dev_priv) == 11 && dig_port->tc_legacy_port) {
> +	timeout_expected = is_tbt || intel_tc_cold_requires_aux_pw(dig_port);
> +	if (DISPLAY_VER(dev_priv) == 11 && dig_port->tc_legacy_port)
>   		icl_tc_cold_exit(dev_priv);
> -		timeout_expected = true;
> -	}
>   
>   	hsw_wait_for_power_well_enable(dev_priv, power_well, timeout_expected);
>   
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
> index db85e0e2031e..c23c210a55f5 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.c
> +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> @@ -26,9 +26,7 @@ static const char *tc_port_mode_name(enum tc_port_mode mode)
>   static enum intel_display_power_domain
>   tc_cold_get_power_domain(struct intel_digital_port *dig_port)
>   {
> -	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
> -
> -	if (DISPLAY_VER(i915) == 11)
> +	if (intel_tc_cold_requires_aux_pw(dig_port))
>   		return intel_legacy_aux_to_power_domain(dig_port->aux_ch);
>   	else
>   		return POWER_DOMAIN_TC_COLD_OFF;
> @@ -564,7 +562,7 @@ static void intel_tc_port_reset_mode(struct intel_digital_port *dig_port,
>   	enum tc_port_mode old_tc_mode = dig_port->tc_mode;
>   
>   	intel_display_power_flush_work(i915);
> -	if (DISPLAY_VER(i915) != 11 || !dig_port->tc_legacy_port) {
> +	if (!intel_tc_cold_requires_aux_pw(dig_port)) {
>   		enum intel_display_power_domain aux_domain;
>   		bool aux_powered;
>   
> @@ -781,3 +779,11 @@ void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy)
>   	dig_port->tc_link_refcount = 0;
>   	tc_port_load_fia_params(i915, dig_port);
>   }
> +
> +bool intel_tc_cold_requires_aux_pw(struct intel_digital_port *dig_port)
> +{
> +	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
> +
> +	return (DISPLAY_VER(i915) == 11 && dig_port->tc_legacy_port) ||
> +		IS_ALDERLAKE_P(i915);
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.h b/drivers/gpu/drm/i915/display/intel_tc.h
> index b619e4736f85..0eacbd76ec15 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.h
> +++ b/drivers/gpu/drm/i915/display/intel_tc.h
> @@ -29,4 +29,6 @@ bool intel_tc_port_ref_held(struct intel_digital_port *dig_port);
>   
>   void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy);
>   
> +bool intel_tc_cold_requires_aux_pw(struct intel_digital_port *dig_port);
> +
>   #endif /* __INTEL_TC_H__ */

Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>

-Clint
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 991ceea06a07..2f7d1664c473 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -619,11 +619,9 @@  icl_tc_phy_aux_power_well_enable(struct drm_i915_private *dev_priv,
 	 * or need to enable AUX on a legacy TypeC port as part of the TC-cold
 	 * exit sequence.
 	 */
-	timeout_expected = is_tbt;
-	if (DISPLAY_VER(dev_priv) == 11 && dig_port->tc_legacy_port) {
+	timeout_expected = is_tbt || intel_tc_cold_requires_aux_pw(dig_port);
+	if (DISPLAY_VER(dev_priv) == 11 && dig_port->tc_legacy_port)
 		icl_tc_cold_exit(dev_priv);
-		timeout_expected = true;
-	}
 
 	hsw_wait_for_power_well_enable(dev_priv, power_well, timeout_expected);
 
diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index db85e0e2031e..c23c210a55f5 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -26,9 +26,7 @@  static const char *tc_port_mode_name(enum tc_port_mode mode)
 static enum intel_display_power_domain
 tc_cold_get_power_domain(struct intel_digital_port *dig_port)
 {
-	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-
-	if (DISPLAY_VER(i915) == 11)
+	if (intel_tc_cold_requires_aux_pw(dig_port))
 		return intel_legacy_aux_to_power_domain(dig_port->aux_ch);
 	else
 		return POWER_DOMAIN_TC_COLD_OFF;
@@ -564,7 +562,7 @@  static void intel_tc_port_reset_mode(struct intel_digital_port *dig_port,
 	enum tc_port_mode old_tc_mode = dig_port->tc_mode;
 
 	intel_display_power_flush_work(i915);
-	if (DISPLAY_VER(i915) != 11 || !dig_port->tc_legacy_port) {
+	if (!intel_tc_cold_requires_aux_pw(dig_port)) {
 		enum intel_display_power_domain aux_domain;
 		bool aux_powered;
 
@@ -781,3 +779,11 @@  void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy)
 	dig_port->tc_link_refcount = 0;
 	tc_port_load_fia_params(i915, dig_port);
 }
+
+bool intel_tc_cold_requires_aux_pw(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+
+	return (DISPLAY_VER(i915) == 11 && dig_port->tc_legacy_port) ||
+		IS_ALDERLAKE_P(i915);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_tc.h b/drivers/gpu/drm/i915/display/intel_tc.h
index b619e4736f85..0eacbd76ec15 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.h
+++ b/drivers/gpu/drm/i915/display/intel_tc.h
@@ -29,4 +29,6 @@  bool intel_tc_port_ref_held(struct intel_digital_port *dig_port);
 
 void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy);
 
+bool intel_tc_cold_requires_aux_pw(struct intel_digital_port *dig_port);
+
 #endif /* __INTEL_TC_H__ */