Skip to contentSkip to conversation

drm/msm/dsi: use RMW cycles in dsi_update_dsc_timing

PATCH Superseded Dmitry Baryshkov 2 participants 3 messages Apr 30, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dsi: use RMW cycles in dsi_update_dsc_timing

The downstream uses read-modify-write for updating command mode compression registers. Let's follow this approach. This also fixes the following warning:

drivers/gpu/drm/msm/dsi/dsi_host.c:918:23: warning: variable 'reg_ctrl' set but not used [-Wunused-but-set-variable]

Fixes 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration")
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -1
index c983698d1384..a5619ad82a53 100644
@@ -961,10 +961,12 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
 		reg_ctrl = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL);
 		reg_ctrl2 = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2);
 
+		reg_ctrl &= ~0xffff;
 		reg_ctrl |= reg;
+		reg_ctrl &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK;
 		reg_ctrl2 |= DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH(bytes_in_slice);
 
-		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg);
+		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg_ctrl);
 		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2);
 	} else {
 		dsi_write(msm_host, REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg);
Signature · 1 line
2.35.1
#1 lore raw
Quoted 18 lines · Dmitry Baryshkov

The downstream uses read-modify-write for updating command mode compression registers. Let's follow this approach. This also fixes the following warning:

drivers/gpu/drm/msm/dsi/dsi_host.c:918:23: warning: variable 'reg_ctrl' set but not used [-Wunused-but-set-variable]

Fixes 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration")
---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index c983698d1384..a5619ad82a53 100644

drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod · line 966

Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
@@ -961,10 +961,12 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
  		reg_ctrl = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL);
  		reg_ctrl2 = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2);
 
+		reg_ctrl &= ~0xffff;
  		reg_ctrl |= reg;
+		reg_ctrl &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK;

Shoulnt this be

reg_ctrl2 &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK;

You seem to have used reg_ctrl which is wrong.

Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -1
  		reg_ctrl2 |= DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH(bytes_in_slice);
 
-		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg);
+		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg_ctrl);
  		dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2);
  	} else {
  		dsi_write(msm_host, REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg);
#2 lore raw
Quoted 31 lines · Abhinav Kumar
Quoted 18 lines · Dmitry Baryshkov

The downstream uses read-modify-write for updating command mode compression registers. Let's follow this approach. This also fixes the following warning:

drivers/gpu/drm/msm/dsi/dsi_host.c:918:23: warning: variable 'reg_ctrl' set but not used [-Wunused-but-set-variable]

Fixes 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration")

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index c983698d1384..a5619ad82a53 100644
@@ -961,10 +961,12 @@ static void dsi_update_dsc_timing(struct 
Quoted 7 lines

msm_dsi_host *msm_host, bool is_cmd_mod
          reg_ctrl = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL); reg_ctrl2 = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2); +        reg_ctrl &= ~0xffff;
          reg_ctrl |= reg;
+        reg_ctrl &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK;

Shoulnt this be

Quoted 4 lines

reg_ctrl2 &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK;

You seem to have used reg_ctrl which is wrong.

Yes. Dummy c&p. I'll post v2 asap.

Quoted 7 lines
Quoted 7 lines

          reg_ctrl2 |= DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH(bytes_in_slice); -        dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg);
+        dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL,
reg_ctrl);
          dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2); } else {
          dsi_write(msm_host, REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg);

Signature · 2 lines
With best wishes
Dmitry