drm/msm/dp: make the eDP 1.4 LINK_RATE_SET path work
cover drm/msm/dp: make the eDP 1.4 LINK_RATE_SET path work
The eDP 1.4 link-rate table support picks a LINK_RATE_SET index in dp_panel, but the selection never reaches link training: only rate and num_lanes are copied into link_params, so LINK_RATE_SET is never written and the rate-set fallback branch can't run. Patch 1 carries the fields through. Patch 2 fixes the fallback once it is reachable, so it stops at the lowest table entry instead of dropping to a standard rate the sink was not told about.
I found this while bringing up an ASUS Zenbook A16 (Glymur), whose eDP 1.4 panel lists 1.62, 2.7 and 5.4 Gbps in SUPPORTED_LINK_RATES. At boot the firmware has left LINK_BW_SET at 0x14, so dp_panel picks the LINK_BW_SET path. When the compositor starts and the link caps are read again, LINK_BW_SET reads 0 and dp_panel selects the rate table, but without patch 1 that selection never reaches link training. With the series the link trains through LINK_RATE_SET (5.4 Gbps, 4 lanes).
With a test-only change that fails the first clock-recovery attempt, the fallback moves to index 1 and the panel trains at 2.7 Gbps, reading back LINK_RATE_SET=0x01. The lowest entry of this panel's table is RBR, so patch 2 does not change behavior here.
I tested on the A16 with a next-20261103-based kernel; the patches apply unchanged to next-20261119. They touch dp_ctrl.c alongside "drm/msm/dp: don't fall back to a link that can't carry the eDP mode" [1], and the two apply in either order.
Jim, Cc'ing you as mentioned off-list: Omarchy's arm64 kernel carries patch 1 as 2367 with your 2368-2371 on top, and your 2369 covers what patch 2 does. I'm happy to drop patch 2 if you post yours.
[1] https://lore.kernel.org/r/[email protected]
Jesse Casco (2):
drm/msm/dp: carry the eDP rate-set selection into the link parameters drm/msm/dp: stop the rate-set fallback at the lowest table entry
drivers/gpu/drm/msm/dp/dp_ctrl.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
Signature · 1 line
2.56.1
PATCH 1/2 drm/msm/dp: carry the eDP rate-set selection into the link parameters
msm_dp_panel_read_link_caps() picks an eDP 1.4 LINK_RATE_SET index and fills panel->link_info.rate_set, use_rate_set and supported_rates, but msm_dp_ctrl_on_link() only copies rate and num_lanes into ctrl->link->link_params. Link training builds its msm_dp_link_info from link_params, so use_rate_set is always false there and msm_dp_aux_link_configure() never writes LINK_RATE_SET. The rate-set branch of msm_dp_ctrl_link_rate_down_shift() is unreachable for the same reason.
Copy the rate-set fields along with the rate, pass them to msm_dp_aux_link_configure(), and restore rate_set together with the rate when falling back to fewer lanes.
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/msm/dp/dp_ctrl.c +9 -0
@@ -1596,6 +1596,7 @@ static int msm_dp_ctrl_link_lane_down_shift(struct msm_dp_ctrl_private *ctrl, ctrl->link->link_params.num_lanes /=2 ; ctrl->link->link_params.rate = panel->link_info.rate; + ctrl->link->link_params.rate_set = panel->link_info.rate_set; ctrl->link->phy_params.p_level =0 ; ctrl->link->phy_params.v_level =0 ;
@@ -1712,6 +1713,8 @@ static int msm_dp_ctrl_link_train(struct msm_dp_ctrl_private *ctrl, link_info.num_lanes = ctrl->link->link_params.num_lanes; link_info.rate = ctrl->link->link_params.rate; + link_info.rate_set = ctrl->link->link_params.rate_set; + link_info.use_rate_set = ctrl->link->link_params.use_rate_set; link_info.capabilities =DP_LINK_CAP_ENHANCED_FRAMING ;msm_dp_aux_link_configure (ctrl->aux, &link_info);
@@ -2407,6 +2410,12 @@ int msm_dp_ctrl_on_link(struct msm_dp_ctrl *msm_dp_ctrl, ctrl->link->link_params.rate = rate; ctrl->link->link_params.num_lanes = panel->link_info.num_lanes; + ctrl->link->link_params.rate_set = panel->link_info.rate_set; + ctrl->link->link_params.use_rate_set = + panel->link_info.use_rate_set; +memcpy (ctrl->link->link_params.supported_rates, + panel->link_info.supported_rates, +sizeof (ctrl->link->link_params.supported_rates));if (panel->msm_dp_mode.out_fmt_is_yuv_420) pixel_rate >>=1 ; }
Signature · 1 line
2.56.1
PATCH 2/2 drm/msm/dp: stop the rate-set fallback at the lowest table entry
In reply to Jesse CascoWhen the sink is driven through LINK_RATE_SET and rate_set has reached index 0, msm_dp_ctrl_link_rate_down_shift() falls through to the legacy switch. If the lowest entry of the sink's SUPPORTED_LINK_RATES table is one of the standard rates above RBR, the source drops to the next standard rate while LINK_RATE_SET still selects index 0, so source and sink train at different rates.
There is nothing lower to try once the table is exhausted, so fail the down-shift instead.
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +7 -3
@@ -1558,9 +1558,13 @@ static int msm_dp_ctrl_link_rate_down_shift(struct msm_dp_ctrl_private *ctrl)int ret =0 ;struct msm_dp_link_info *link_params = &ctrl->link->link_params; -if (link_params->rate_set) { - --link_params->rate_set; - link_params->rate = link_params->supported_rates[link_params->rate_set]; +if (link_params->use_rate_set) { +if (link_params->rate_set) { + --link_params->rate_set; + link_params->rate = link_params->supported_rates[link_params->rate_set]; + }else { + ret = -EINVAL ; + } }else {switch (link_params->rate) {case 810000 :
Signature · 1 line
2.56.1