[PATCH 2/2] drm/display/drm_dp_dual_mode_helper: Try setting the LS/PCON mode multiple times

Ankit Nautiyal ankit.k.nautiyal at intel.com
Tue May 23 11:30:46 UTC 2023


Sometimes the LSPCON HW needs to be written multiple times to change
LS/PCON mode.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
Signed-off-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane at intel.com>
---
 .../gpu/drm/display/drm_dp_dual_mode_helper.c    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
index bd61e20770a5..ad86e3e3bf9e 100644
--- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
@@ -501,20 +501,22 @@ int drm_lspcon_set_mode(const struct drm_device *dev, struct i2c_adapter *adapte
 	if (mode == DRM_LSPCON_MODE_PCON)
 		data = DP_DUAL_MODE_LSPCON_MODE_PCON;
 
-	/* Change mode */
-	ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
-				     &data, sizeof(data));
-	if (ret < 0) {
-		drm_err(dev, "LSPCON mode change failed\n");
-		return ret;
-	}
 
 	/*
+	 * Try setting the LS/PCON mode multiple times.
 	 * Confirm mode change by reading the status bit.
 	 * Sometimes, it takes a while to change the mode,
 	 * so wait and retry until time out or done.
 	 */
 	do {
+		/* Change mode */
+		ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+					     &data, sizeof(data));
+		if (ret < 0) {
+			drm_err(dev, "LSPCON mode change failed\n");
+			return ret;
+		}
+
 		ret = drm_lspcon_get_mode(dev, adapter, &current_mode);
 		if (ret) {
 			drm_err(dev, "can't confirm LSPCON mode change\n");
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list