Skip to contentSkip to conversation

drm/bridge: analogix_dp: Reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET

PATCH RESEND Applied Damon Ding 2 participants 4 messages Nov 11, 2025 – Mar 25

Subsystems (3)
lore
Share & tools
lore

Damon Ding

author
#0 lore raw

PATCH RESEND v3 1/1 drm/bridge: analogix_dp: Reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET

In analogix_dp_link_start(), &link_train.training_lane[] is used to set phy PE/VS configurations, and buf[] is initialized with the same values to set DPCD DP_TRAINING_LANEx_SET.

It makes sense to reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET, which can remove the redundant assignments and make codes more concise.

---

Changes in v2:
- Add Tested-by tag.

Changes in v3:
- Add Reviewed-by tag.
- Fix the spelling error 'consice' to 'concise'.

---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -6
index 6ec3d811b5f0..1e834d3656c1 100644
@@ -281,12 +281,8 @@ static int analogix_dp_link_start(struct analogix_dp_device *dp)
 	if (retval < 0)
 		return retval;
 
-	for (lane = 0; lane < lane_count; lane++)
-		buf[lane] = DP_TRAIN_PRE_EMPH_LEVEL_0 |
-			    DP_TRAIN_VOLTAGE_SWING_LEVEL_0;
-
-	retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET, buf,
-				   lane_count);
+	retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET,
+				   dp->link_train.training_lane, lane_count);
 	if (retval < 0)
 		return retval;
 
Signature · 1 line
2.34.1
author
#1 lore raw
Quoted 12 lines · Damon Ding

In analogix_dp_link_start(), &link_train.training_lane[] is used to set phy PE/VS configurations, and buf[] is initialized with the same values to set DPCD DP_TRAINING_LANEx_SET.

It makes sense to reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET, which can remove the redundant assignments and make codes more concise.

Quoted 8 lines

---

Changes in v2:
- Add Tested-by tag.

Changes in v3:
- Add Reviewed-by tag.
- Fix the spelling error 'consice' to 'concise'.

Gentle ping.

I just added tags in v2 and v3, and I also tried resend. The patch is merely a pre-optimization work for the following patch series:

https://lore.kernel.org/all/[email protected]/

Quoted 23 lines
---
  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -6
index 6ec3d811b5f0..1e834d3656c1 100644
@@ -281,12 +281,8 @@ static int analogix_dp_link_start(struct analogix_dp_device *dp)
  	if (retval < 0)
  		return retval;
 
-	for (lane = 0; lane < lane_count; lane++)
-		buf[lane] = DP_TRAIN_PRE_EMPH_LEVEL_0 |
-			    DP_TRAIN_VOLTAGE_SWING_LEVEL_0;
-
-	retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET, buf,
-				   lane_count);
+	retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET,
+				   dp->link_train.training_lane, lane_count);
  	if (retval < 0)
  		return retval;
 
reviewer Reviewed-by on v3 1/1
#2 lore raw
In reply to Damon Ding
Quoted 11 lines · Damon Ding

In analogix_dp_link_start(), &link_train.training_lane[] is used to set phy PE/VS configurations, and buf[] is initialized with the same values to set DPCD DP_TRAINING_LANEx_SET.

It makes sense to reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET, which can remove the redundant assignments and make codes more concise.

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

reviewer Applied
#3 lore raw
In reply to Damon Ding
Quoted 9 lines · Damon Ding

In analogix_dp_link_start(), &link_train.training_lane[] is used to set phy PE/VS configurations, and buf[] is initialized with the same values to set DPCD DP_TRAINING_LANEx_SET.

It makes sense to reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET, which can remove the redundant assignments and make codes more concise.

[...]

Applied, thanks!

[1/1] drm/bridge: analogix_dp: Reuse &link_train.training_lane[] to set DPCD DP_TRAINING_LANEx_SET

      commit: 05d09e7f28c8f6e39c54d79fd96643f6faf5dbee

Best regards,

Signature · 1 line
Luca Ceresoli <[email protected]>