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
This commit is contained in:
parent
d1fc4e391f
commit
712f422ed7
|
@ -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,10 +464,35 @@ 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:
|
||||
tc_phy_take_ownership(tc, false);
|
||||
|
|
Loading…
Reference in New Issue