Skip to content

Commit ccda4b7

Browse files
mark1188-uigregkh
authored andcommitted
drm/hisilicon/hibmc: fix rare monitors cannot display problem
[ Upstream commit 9f98b42 ] In some case, the dp link training success at 8.1Gbps, but the sink's maximum supported rate is less than 8.1G. So change the default 8.1Gbps link rate to the rate that reads from devices' capabilities. Fixes: 54063d8 ("drm/hisilicon/hibmc: add dp link moduel in hibmc drivers") Signed-off-by: Baihan Li <libaihan@huawei.com> Signed-off-by: Yongbang Shi <shiyongbang@huawei.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250813094238.3722345-6-shiyongbang@huawei.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d3e7742 commit ccda4b7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,17 @@ static int hibmc_dp_link_downgrade_training_eq(struct hibmc_dp_dev *dp)
325325
return hibmc_dp_link_reduce_rate(dp);
326326
}
327327

328+
static void hibmc_dp_update_caps(struct hibmc_dp_dev *dp)
329+
{
330+
dp->link.cap.link_rate = dp->dpcd[DP_MAX_LINK_RATE];
331+
if (dp->link.cap.link_rate > DP_LINK_BW_8_1 || !dp->link.cap.link_rate)
332+
dp->link.cap.link_rate = DP_LINK_BW_8_1;
333+
334+
dp->link.cap.lanes = dp->dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK;
335+
if (dp->link.cap.lanes > HIBMC_DP_LANE_NUM_MAX)
336+
dp->link.cap.lanes = HIBMC_DP_LANE_NUM_MAX;
337+
}
338+
328339
int hibmc_dp_link_training(struct hibmc_dp_dev *dp)
329340
{
330341
struct hibmc_dp_link *link = &dp->link;
@@ -334,8 +345,7 @@ int hibmc_dp_link_training(struct hibmc_dp_dev *dp)
334345
if (ret)
335346
drm_err(dp->dev, "dp aux read dpcd failed, ret: %d\n", ret);
336347

337-
dp->link.cap.link_rate = dp->dpcd[DP_MAX_LINK_RATE];
338-
dp->link.cap.lanes = 0x2;
348+
hibmc_dp_update_caps(dp);
339349

340350
ret = hibmc_dp_get_serdes_rate_cfg(dp);
341351
if (ret < 0)

0 commit comments

Comments
 (0)