diff mbox series

[09/29] drm/i915/tc: Add TC PHY hooks to get the PHY ready/owned state

Message ID 20230323142035.1432621-10-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/tc: Align the ADLP TypeC sequences with bspec | expand

Commit Message

Imre Deak March 23, 2023, 2:20 p.m. UTC
Add TC PHY hooks to get the PHY ready/owned state on each platform,
replacing the corresponding if ladder.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_tc.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

Comments

Kahola, Mika March 24, 2023, 1:11 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Imre
> Deak
> Sent: Thursday, March 23, 2023 4:20 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 09/29] drm/i915/tc: Add TC PHY hooks to get the
> PHY ready/owned state
> 
> Add TC PHY hooks to get the PHY ready/owned state on each platform,
> replacing the corresponding if ladder.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_tc.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.c
> b/drivers/gpu/drm/i915/display/intel_tc.c
> index a0508e2173007..7d64cb310ca3e 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.c
> +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> @@ -26,6 +26,8 @@ struct intel_tc_port;
> 
>  struct intel_tc_phy_ops {
>  	u32 (*hpd_live_status)(struct intel_tc_port *tc);
> +	bool (*is_ready)(struct intel_tc_port *tc);
> +	bool (*is_owned)(struct intel_tc_port *tc);
>  };
> 
>  struct intel_tc_port {
> @@ -502,6 +504,8 @@ static void icl_tc_phy_disconnect(struct intel_tc_port
> *tc)
> 
>  static const struct intel_tc_phy_ops icl_tc_phy_ops = {
>  	.hpd_live_status = icl_tc_phy_hpd_live_status,
> +	.is_ready = icl_tc_phy_is_ready,
> +	.is_owned = icl_tc_phy_is_owned,
>  };
> 
>  /**
> @@ -581,6 +585,8 @@ static bool adlp_tc_phy_is_owned(struct intel_tc_port
> *tc)
> 
>  static const struct intel_tc_phy_ops adlp_tc_phy_ops = {
>  	.hpd_live_status = adlp_tc_phy_hpd_live_status,
> +	.is_ready = adlp_tc_phy_is_ready,
> +	.is_owned = adlp_tc_phy_is_owned,
>  };
> 
>  /**
> @@ -603,22 +609,12 @@ static u32 tc_phy_hpd_live_status(struct intel_tc_port
> *tc)
> 
>  static bool tc_phy_is_ready(struct intel_tc_port *tc)  {
> -	struct drm_i915_private *i915 = tc_to_i915(tc);
> -
> -	if (IS_ALDERLAKE_P(i915))
> -		return adlp_tc_phy_is_ready(tc);
> -
> -	return icl_tc_phy_is_ready(tc);
> +	return tc->phy_ops->is_ready(tc);
>  }
> 
>  static bool tc_phy_is_owned(struct intel_tc_port *tc)  {
> -	struct drm_i915_private *i915 = tc_to_i915(tc);
> -
> -	if (IS_ALDERLAKE_P(i915))
> -		return adlp_tc_phy_is_owned(tc);
> -
> -	return icl_tc_phy_is_owned(tc);
> +	return tc->phy_ops->is_owned(tc);
>  }
> 
>  static bool tc_phy_take_ownership(struct intel_tc_port *tc, bool take)
> --
> 2.37.1
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 a0508e2173007..7d64cb310ca3e 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -26,6 +26,8 @@  struct intel_tc_port;
 
 struct intel_tc_phy_ops {
 	u32 (*hpd_live_status)(struct intel_tc_port *tc);
+	bool (*is_ready)(struct intel_tc_port *tc);
+	bool (*is_owned)(struct intel_tc_port *tc);
 };
 
 struct intel_tc_port {
@@ -502,6 +504,8 @@  static void icl_tc_phy_disconnect(struct intel_tc_port *tc)
 
 static const struct intel_tc_phy_ops icl_tc_phy_ops = {
 	.hpd_live_status = icl_tc_phy_hpd_live_status,
+	.is_ready = icl_tc_phy_is_ready,
+	.is_owned = icl_tc_phy_is_owned,
 };
 
 /**
@@ -581,6 +585,8 @@  static bool adlp_tc_phy_is_owned(struct intel_tc_port *tc)
 
 static const struct intel_tc_phy_ops adlp_tc_phy_ops = {
 	.hpd_live_status = adlp_tc_phy_hpd_live_status,
+	.is_ready = adlp_tc_phy_is_ready,
+	.is_owned = adlp_tc_phy_is_owned,
 };
 
 /**
@@ -603,22 +609,12 @@  static u32 tc_phy_hpd_live_status(struct intel_tc_port *tc)
 
 static bool tc_phy_is_ready(struct intel_tc_port *tc)
 {
-	struct drm_i915_private *i915 = tc_to_i915(tc);
-
-	if (IS_ALDERLAKE_P(i915))
-		return adlp_tc_phy_is_ready(tc);
-
-	return icl_tc_phy_is_ready(tc);
+	return tc->phy_ops->is_ready(tc);
 }
 
 static bool tc_phy_is_owned(struct intel_tc_port *tc)
 {
-	struct drm_i915_private *i915 = tc_to_i915(tc);
-
-	if (IS_ALDERLAKE_P(i915))
-		return adlp_tc_phy_is_owned(tc);
-
-	return icl_tc_phy_is_owned(tc);
+	return tc->phy_ops->is_owned(tc);
 }
 
 static bool tc_phy_take_ownership(struct intel_tc_port *tc, bool take)