瀏覽代碼

Merge "disp: msm: sde: add changes to support odd number of dedicated-CWB"

qctecmdr 1 年之前
父節點
當前提交
01fde95aff
共有 1 個文件被更改,包括 13 次插入5 次删除
  1. 13 5
      msm/sde/sde_hw_wb.c

+ 13 - 5
msm/sde/sde_hw_wb.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
@@ -102,21 +102,29 @@ static void _sde_hw_cwb_ctrl_init(struct sde_mdss_cfg *m,
 static void _sde_hw_dcwb_ctrl_init(struct sde_mdss_cfg *m,
 		void __iomem *addr, struct sde_hw_wb *hw_wb)
 {
-	int i, j;
+	int i, j, dcwb_count, blk_count;
 	u32 blk_off;
 	char name[64] = {0};
 
-	if (!hw_wb)
+	if (!hw_wb || !m->dcwb_count)
 		return;
 
-	for (j = 0; j < (m->dcwb_count / MAX_CWB_BLOCKSIZE); j++) {
+	dcwb_count = (m->dcwb_count < MAX_CWB_BLOCKSIZE) ? m->dcwb_count :
+		(m->dcwb_count / MAX_CWB_BLOCKSIZE);
+
+	if (dcwb_count == m->dcwb_count)
+		blk_count = m->dcwb_count;
+	else
+		blk_count = MAX_CWB_BLOCKSIZE;
+
+	for (j = 0; j < dcwb_count; j++) {
 		hw_wb->dcwb_hw[j].base_off = addr;
 		hw_wb->dcwb_hw[j].blk_off = m->cwb_blk_off[j];
 		hw_wb->dcwb_hw[j].length = 0x20;
 		hw_wb->dcwb_hw[j].hw_rev = m->hw_rev;
 		hw_wb->dcwb_hw[j].log_mask = SDE_DBG_MASK_WB;
 
-		for (i = 0; i < MAX_CWB_BLOCKSIZE; i++) {
+		for (i = 0; i < blk_count; i++) {
 			snprintf(name, sizeof(name), "dcwb%d", i);
 			blk_off = hw_wb->dcwb_hw[j].blk_off + (m->cwb_blk_stride * i);