Skip to content

Commit 619a06d

Browse files
mkaholahogander
authored andcommitted
drm/i915/mtl: Reset only one lane in case of MFD
In case when only two or less transmit lanes are owned such as MFD (DP-alt with x2 lanes) we need to reset only one data lane (lane0). With only x2 lanes we don't need to poll for the phy current status on both data lanes since only the owned data lane will respond. v2: Find better naming for lanes and revise the commit message (Luca) Reviewed-by: Arun R Murthy <[email protected]> (v1) Signed-off-by: Mika Kahola <[email protected]> Reviewed-by: Luca Coelho <[email protected]> (v2) Signed-off-by: Jouni Högander <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b29a20f commit 619a06d

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,13 +2528,23 @@ static u32 intel_cx0_get_pclk_refclk_ack(u8 lane_mask)
25282528
return val;
25292529
}
25302530

2531-
/* FIXME: Some Type-C cases need not reset both the lanes. Handle those cases. */
2532-
static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port port,
2531+
static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915,
2532+
struct intel_encoder *encoder,
25332533
bool lane_reversal)
25342534
{
2535+
enum port port = encoder->port;
25352536
enum phy phy = intel_port_to_phy(i915, port);
2537+
bool both_lanes = intel_tc_port_fia_max_lane_count(enc_to_dig_port(encoder)) > 2;
25362538
u8 lane_mask = lane_reversal ? INTEL_CX0_LANE1 :
25372539
INTEL_CX0_LANE0;
2540+
u32 lane_pipe_reset = both_lanes ?
2541+
XELPDP_LANE_PIPE_RESET(0) |
2542+
XELPDP_LANE_PIPE_RESET(1) :
2543+
XELPDP_LANE_PIPE_RESET(0);
2544+
u32 lane_phy_current_status = both_lanes ?
2545+
XELPDP_LANE_PHY_CURRENT_STATUS(0) |
2546+
XELPDP_LANE_PHY_CURRENT_STATUS(1) :
2547+
XELPDP_LANE_PHY_CURRENT_STATUS(0);
25382548

25392549
if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL1(port),
25402550
XELPDP_PORT_BUF_SOC_PHY_READY,
@@ -2545,23 +2555,24 @@ static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port po
25452555

25462556
intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
25472557
XELPDP_LANE_PIPE_RESET(0) | XELPDP_LANE_PIPE_RESET(1),
2548-
XELPDP_LANE_PIPE_RESET(0) | XELPDP_LANE_PIPE_RESET(1));
2558+
lane_pipe_reset);
25492559

25502560
if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
2551-
XELPDP_LANE_PHY_CURRENT_STATUS(0) |
2552-
XELPDP_LANE_PHY_CURRENT_STATUS(1),
2553-
XELPDP_LANE_PHY_CURRENT_STATUS(0) |
2554-
XELPDP_LANE_PHY_CURRENT_STATUS(1),
2561+
lane_phy_current_status, lane_phy_current_status,
25552562
XELPDP_PORT_RESET_START_TIMEOUT_US, 0, NULL))
25562563
drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n",
25572564
phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);
25582565

25592566
intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(port),
2560-
intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES),
2567+
intel_cx0_get_pclk_refclk_request(both_lanes ?
2568+
INTEL_CX0_BOTH_LANES :
2569+
INTEL_CX0_LANE0),
25612570
intel_cx0_get_pclk_refclk_request(lane_mask));
25622571

25632572
if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(port),
2564-
intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),
2573+
intel_cx0_get_pclk_refclk_ack(both_lanes ?
2574+
INTEL_CX0_BOTH_LANES :
2575+
INTEL_CX0_LANE0),
25652576
intel_cx0_get_pclk_refclk_ack(lane_mask),
25662577
XELPDP_REFCLK_ENABLE_TIMEOUT_US, 0, NULL))
25672578
drm_warn(&i915->drm, "PHY %c failed to request refclk after %dus.\n",
@@ -2571,13 +2582,9 @@ static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port po
25712582
CX0_P2_STATE_RESET);
25722583
intel_cx0_setup_powerdown(i915, port);
25732584

2574-
intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
2575-
XELPDP_LANE_PIPE_RESET(0) | XELPDP_LANE_PIPE_RESET(1),
2576-
0);
2585+
intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port), lane_pipe_reset, 0);
25772586

2578-
if (intel_de_wait_for_clear(i915, XELPDP_PORT_BUF_CTL2(port),
2579-
XELPDP_LANE_PHY_CURRENT_STATUS(0) |
2580-
XELPDP_LANE_PHY_CURRENT_STATUS(1),
2587+
if (intel_de_wait_for_clear(i915, XELPDP_PORT_BUF_CTL2(port), lane_phy_current_status,
25812588
XELPDP_PORT_RESET_END_TIMEOUT))
25822589
drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dms.\n",
25832590
phy_name(phy), XELPDP_PORT_RESET_END_TIMEOUT);
@@ -2705,7 +2712,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
27052712
intel_program_port_clock_ctl(encoder, crtc_state, lane_reversal);
27062713

27072714
/* 2. Bring PHY out of reset. */
2708-
intel_cx0_phy_lane_reset(i915, encoder->port, lane_reversal);
2715+
intel_cx0_phy_lane_reset(i915, encoder, lane_reversal);
27092716

27102717
/*
27112718
* 3. Change Phy power state to Ready.

0 commit comments

Comments
 (0)