Skip to contentSkip to conversation

drm/bridge: anx7625: Use common macros for DP power sequencing commands

PATCH RESEND Applied Chen-Yu Tsai 3 participants 6 messages Jul 10, 2023 – Jul 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 drm/bridge: anx7625: Use common macros for DP power sequencing commands

The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.

Fixes 548b512e144f ("drm/bridge: anx7625: send DPCD command to downstream")
Fixes 27f26359de9b ("drm/bridge: anx7625: Set downstream sink into normal status")

---
Collected tags and rebased on v6.5-rc1.

 drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -4
index 8b985efdc086..9db3784cb554 100644
@@ -931,8 +931,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 
 	dev_dbg(dev, "set downstream sink into normal\n");
 	/* Downstream sink enter into normal mode */
-	data = 1;
-	ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+	data = DP_SET_POWER_D0;
+	ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);
 	if (ret < 0)
 		dev_err(dev, "IO error : set sink into normal mode fail\n");
 
@@ -971,8 +971,8 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
 
 	dev_dbg(dev, "notify downstream enter into standby\n");
 	/* Downstream monitor enter into standby mode */
-	data = 2;
-	ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+	data = DP_SET_POWER_D3;
+	ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);
 	if (ret < 0)
 		DRM_DEV_ERROR(dev, "IO error : mute video fail\n");
 
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
#1 lore raw
Quoted 18 lines · Chen-Yu Tsai

The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.

Fixes 548b512e144f ("drm/bridge: anx7625: send DPCD command to downstream")
Fixes 27f26359de9b ("drm/bridge: anx7625: Set downstream sink into normal status")

---
Collected tags and rebased on v6.5-rc1.

 drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 8b985efdc086..9db3784cb554 100644

drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_dp_start(struct anx7625_data *ctx) · line 935

Quoted 7 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
@@ -931,8 +931,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 
 	dev_dbg(dev, "set downstream sink into normal\n");
 	/* Downstream sink enter into normal mode */
-	data = 1;
-	ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+	data = DP_SET_POWER_D0;
+	ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);

So you have code to implement the drm dp aux abstractions, why aren't you using drm_dp_dpcd_writeb() and friends here?

BR,
Jani.

Quoted 13 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
 	if (ret < 0)
 		dev_err(dev, "IO error : set sink into normal mode fail\n");
 
@@ -971,8 +971,8 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
 
 	dev_dbg(dev, "notify downstream enter into standby\n");
 	/* Downstream monitor enter into standby mode */
-	data = 2;
-	ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+	data = DP_SET_POWER_D3;
+	ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);
 	if (ret < 0)
 		DRM_DEV_ERROR(dev, "IO error : mute video fail\n");
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#2 lore raw
Quoted 21 lines · Jani Nikula
Quoted 19 lines · Chen-Yu Tsai

The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.

Fixes 548b512e144f ("drm/bridge: anx7625: send DPCD command to downstream")
Fixes 27f26359de9b ("drm/bridge: anx7625: Set downstream sink into normal status")

---
Collected tags and rebased on v6.5-rc1.

 drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 8b985efdc086..9db3784cb554 100644
@@ -931,8 +931,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 
Quoted 9 lines

drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_dp_start(struct anx7625_data *ctx) · line 935

Quoted 6 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
      dev_dbg(dev, "set downstream sink into normal\n");
      /* Downstream sink enter into normal mode */
-     data = 1;
-     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+     data = DP_SET_POWER_D0;
+     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);

So you have code to implement the drm dp aux abstractions, why aren't you using drm_dp_dpcd_writeb() and friends here?

I didn't write the original code. Nor do I do much DP stuff. IIRC someone pointed out to me these had proper macros, so I converted them.

Would you accept a follow-up patch to convert the AUX transfers to the DRM abstractions?

ChenYu

Quoted 20 lines

BR,
Jani.

drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_dp_stop(struct anx7625_data *ctx) · line 977

Quoted 13 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
      if (ret < 0)
              dev_err(dev, "IO error : set sink into normal mode fail\n");
 
@@ -971,8 +971,8 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
 
      dev_dbg(dev, "notify downstream enter into standby\n");
      /* Downstream monitor enter into standby mode */
-     data = 2;
-     ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+     data = DP_SET_POWER_D3;
+     ret |= anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);
      if (ret < 0)
              DRM_DEV_ERROR(dev, "IO error : mute video fail\n");

--
Jani Nikula, Intel Open Source Graphics Center

#3 lore raw
Quoted 32 lines · Chen-Yu Tsai
Quoted 21 lines · Jani Nikula
Quoted 19 lines · Chen-Yu Tsai

The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.

Fixes 548b512e144f ("drm/bridge: anx7625: send DPCD command to downstream")
Fixes 27f26359de9b ("drm/bridge: anx7625: Set downstream sink into normal status")

---
Collected tags and rebased on v6.5-rc1.

 drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 8b985efdc086..9db3784cb554 100644
@@ -931,8 +931,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 
Quoted 9 lines

drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_dp_start(struct anx7625_data *ctx) · line 935

Quoted 6 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
      dev_dbg(dev, "set downstream sink into normal\n");
      /* Downstream sink enter into normal mode */
-     data = 1;
-     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+     data = DP_SET_POWER_D0;
+     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);

So you have code to implement the drm dp aux abstractions, why aren't you using drm_dp_dpcd_writeb() and friends here?

Quoted 5 lines

I didn't write the original code. Nor do I do much DP stuff. IIRC someone pointed out to me these had proper macros, so I converted them.

Would you accept a follow-up patch to convert the AUX transfers to the DRM abstractions?

I believe they would be welcome, but I'm personally not familiar with the driver in question.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#4 lore raw
Quoted 34 lines · Jani Nikula
Quoted 32 lines · Chen-Yu Tsai
Quoted 30 lines · Jani Nikula
Quoted 18 lines · Chen-Yu Tsai

The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.

Fixes 548b512e144f ("drm/bridge: anx7625: send DPCD command to downstream")
Fixes 27f26359de9b ("drm/bridge: anx7625: Set downstream sink into normal status")

---
Collected tags and rebased on v6.5-rc1.

 drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 8b985efdc086..9db3784cb554 100644

drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_dp_start(struct anx7625_data *ctx) · line 935

Quoted 7 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
@@ -931,8 +931,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 
      dev_dbg(dev, "set downstream sink into normal\n");
      /* Downstream sink enter into normal mode */
-     data = 1;
-     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, 0x000600, 1, &data);
+     data = DP_SET_POWER_D0;
+     ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_WRITE, DP_SET_POWER, 1, &data);

So you have code to implement the drm dp aux abstractions, why aren't you using drm_dp_dpcd_writeb() and friends here?

Quoted 8 lines
Quoted 5 lines

I didn't write the original code. Nor do I do much DP stuff. IIRC someone pointed out to me these had proper macros, so I converted them.

Would you accept a follow-up patch to convert the AUX transfers to the DRM abstractions?

I believe they would be welcome, but I'm personally not familiar with the driver in question.

OK. I take it you are not blocking this patch then?

ChenYu