diff options
| author | Imre Deak <imre.deak@intel.com> | 2023-03-23 16:20:18 +0200 |
|---|---|---|
| committer | Imre Deak <imre.deak@intel.com> | 2023-04-03 11:35:30 +0300 |
| commit | 712f422ed70c6778018152896d6b4e5ff70fb2b4 (patch) | |
| tree | adadaf4240b09d6d7910b0b772140b9baa229217 | |
| parent | d1fc4e391fbd321dff166208e58e30d3196626ba (diff) | |
drm/i915/tc: Factor out tc_phy_verify_legacy_or_dp_alt_mode()
Factor out a function verifying the PHY connected state in legacy or
DP-alt mode. This is common to all platforms, which can be reused in
platform specific connect hooks added in follow-up patches.
No functional changes.
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323142035.1432621-13-imre.deak@intel.com
| -rw-r--r-- | drivers/gpu/drm/i915/display/intel_tc.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c index 2910921483c0..bf83e6794054 100644 --- a/drivers/gpu/drm/i915/display/intel_tc.c +++ b/drivers/gpu/drm/i915/display/intel_tc.c @@ -434,27 +434,13 @@ static void icl_tc_phy_get_hw_state(struct intel_tc_port *tc) * connect and disconnect to cleanly transfer ownership with the controller and * set the type-C power state. */ -static bool icl_tc_phy_connect(struct intel_tc_port *tc, - int required_lanes) +static bool tc_phy_verify_legacy_or_dp_alt_mode(struct intel_tc_port *tc, + int required_lanes) { struct drm_i915_private *i915 = tc_to_i915(tc); struct intel_digital_port *dig_port = tc->dig_port; int max_lanes; - if (tc->mode == TC_PORT_TBT_ALT) - return true; - - if (!tc_phy_is_ready(tc) && - !drm_WARN_ON(&i915->drm, tc->legacy_port)) { - drm_dbg_kms(&i915->drm, "Port %s: PHY not ready\n", - tc->port_name); - return false; - } - - if (!tc_phy_take_ownership(tc, true) && - !drm_WARN_ON(&i915->drm, tc->legacy_port)) - return false; - max_lanes = intel_tc_port_fia_max_lane_count(dig_port); if (tc->legacy_port) { drm_WARN_ON(&i915->drm, max_lanes != 4); @@ -470,7 +456,7 @@ static bool icl_tc_phy_connect(struct intel_tc_port *tc, if (!(tc_phy_hpd_live_status(tc) & BIT(TC_PORT_DP_ALT))) { drm_dbg_kms(&i915->drm, "Port %s: PHY sudden disconnect\n", tc->port_name); - goto out_release_phy; + return false; } if (max_lanes < required_lanes) { @@ -478,9 +464,34 @@ static bool icl_tc_phy_connect(struct intel_tc_port *tc, "Port %s: PHY max lanes %d < required lanes %d\n", tc->port_name, max_lanes, required_lanes); - goto out_release_phy; + return false; + } + + return true; +} + +static bool icl_tc_phy_connect(struct intel_tc_port *tc, + int required_lanes) +{ + struct drm_i915_private *i915 = tc_to_i915(tc); + + if (tc->mode == TC_PORT_TBT_ALT) + return true; + + if (!tc_phy_is_ready(tc) && + !drm_WARN_ON(&i915->drm, tc->legacy_port)) { + drm_dbg_kms(&i915->drm, "Port %s: PHY not ready\n", + tc->port_name); + return false; } + if (!tc_phy_take_ownership(tc, true) && + !drm_WARN_ON(&i915->drm, tc->legacy_port)) + return false; + + if (!tc_phy_verify_legacy_or_dp_alt_mode(tc, required_lanes)) + goto out_release_phy; + return true; out_release_phy: |
