[PATCH v3 07/27] drm/msm/mdss: use qcom_ubwc_version_tag() helper

Dmitry Baryshkov
2026-03-12T13:29:46Z

Use new helper defined to program UBWC version to the hardware.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/msm_mdss.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 7cb8aeaa7ecf..e2ec1ee590e7 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -201,7 +201,7 @@ static void msm_mdss_6x_setup_ubwc(struct msm_mdss *msm_mdss)
const struct qcom_ubwc_cfg_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) |
MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
- u32 ver, prediction_mode;
+ u32 prediction_mode;

if (data->ubwc_bank_spread)
value |= MDSS_UBWC_STATIC_UBWC_BANK_SPREAD;
@@ -219,20 +219,8 @@ static void msm_mdss_6x_setup_ubwc(struct msm_mdss *msm_mdss)
else
prediction_mode = 1;

- if (data->ubwc_enc_version >= UBWC_6_0)
- ver = 5;
- else if (data->ubwc_enc_version >= UBWC_5_0)
- ver = 4;
- else if (data->ubwc_enc_version >= UBWC_4_3)
- ver = 3;
- else if (data->ubwc_enc_version >= UBWC_4_0)
- ver = 2;
- else if (data->ubwc_enc_version >= UBWC_3_0)
- ver = 1;
- else /* UBWC 1.0 and 2.0 */
- ver = 0;
-
- writel_relaxed(ver, msm_mdss->mmio + REG_MDSS_UBWC_CTRL_2);
+ writel_relaxed(qcom_ubwc_version_tag(data),
+ msm_mdss->mmio + REG_MDSS_UBWC_CTRL_2);
writel_relaxed(prediction_mode, msm_mdss->mmio + REG_MDSS_UBWC_PREDICTION_MODE);
}

--
2.47.3