summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-01-16 08:33:15 +0200
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-01-21 12:23:31 +0200
commit2c36dc9197e30080315e63cbcac0281b8ed9ed77 (patch)
tree49d01f6d04c08c4d0c4216b73f51a52c161d3aae /drivers
parente92a4ae1981baecccdc1823e1f10dc8f566df0ad (diff)
downloadlinux-next-2c36dc9197e30080315e63cbcac0281b8ed9ed77.tar.gz
drm/msm/dpu: simplify ctl_setup_blendstage calculation
Extract the common expression in the dpu_hw_ctl_setup_blendstage() function. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550 Patchwork: https://patchwork.freedesktop.org/patch/518483/ Link: https://lore.kernel.org/r/20230116063316.728496-2-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
index 12c37faeeb09..300629697396 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
@@ -383,7 +383,8 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
enum dpu_lm lm, struct dpu_hw_stage_cfg *stage_cfg)
{
struct dpu_hw_blk_reg_map *c = &ctx->hw;
- u32 mixercfg = 0, mixercfg_ext = 0, mix, ext;
+ u32 mix, ext, mix_ext;
+ u32 mixercfg = 0, mixercfg_ext = 0;
u32 mixercfg_ext2 = 0, mixercfg_ext3 = 0;
u32 mixercfg_ext4 = 0;
int i, j;
@@ -409,6 +410,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
/* overflow to ext register if 'i + 1 > 7' */
mix = (i + 1) & 0x7;
ext = i >= 7;
+ mix_ext = (i + 1) & 0xf;
for (j = 0 ; j < pipes_per_stage; j++) {
enum dpu_sspp_multirect_index rect_index =
@@ -417,7 +419,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
switch (stage_cfg->stage[i][j]) {
case SSPP_VIG0:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext3 |= ((i + 1) & 0xF) << 0;
+ mixercfg_ext3 |= mix_ext << 0;
} else {
mixercfg |= mix << 0;
mixercfg_ext |= ext << 0;
@@ -425,7 +427,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_VIG1:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext3 |= ((i + 1) & 0xF) << 4;
+ mixercfg_ext3 |= mix_ext << 4;
} else {
mixercfg |= mix << 3;
mixercfg_ext |= ext << 2;
@@ -433,7 +435,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_VIG2:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext3 |= ((i + 1) & 0xF) << 8;
+ mixercfg_ext3 |= mix_ext << 8;
} else {
mixercfg |= mix << 6;
mixercfg_ext |= ext << 4;
@@ -441,7 +443,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_VIG3:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext3 |= ((i + 1) & 0xF) << 12;
+ mixercfg_ext3 |= mix_ext << 12;
} else {
mixercfg |= mix << 26;
mixercfg_ext |= ext << 6;
@@ -465,7 +467,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_DMA0:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext2 |= ((i + 1) & 0xF) << 8;
+ mixercfg_ext2 |= mix_ext << 8;
} else {
mixercfg |= mix << 18;
mixercfg_ext |= ext << 16;
@@ -473,7 +475,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_DMA1:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext2 |= ((i + 1) & 0xF) << 12;
+ mixercfg_ext2 |= mix_ext << 12;
} else {
mixercfg |= mix << 21;
mixercfg_ext |= ext << 18;
@@ -481,39 +483,37 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
break;
case SSPP_DMA2:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext2 |= ((i + 1) & 0xF) << 16;
+ mixercfg_ext2 |= mix_ext << 16;
} else {
- mix |= (i + 1) & 0xF;
- mixercfg_ext2 |= mix << 0;
+ mixercfg_ext2 |= mix_ext << 0;
}
break;
case SSPP_DMA3:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext2 |= ((i + 1) & 0xF) << 20;
+ mixercfg_ext2 |= mix_ext << 20;
} else {
- mix |= (i + 1) & 0xF;
- mixercfg_ext2 |= mix << 4;
+ mixercfg_ext2 |= mix_ext << 4;
}
break;
case SSPP_DMA4:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext4 |= ((i + 1) & 0xF) << 8;
+ mixercfg_ext4 |= mix_ext << 8;
} else {
- mixercfg_ext4 |= ((i + 1) & 0xF) << 0;
+ mixercfg_ext4 |= mix_ext << 0;
}
break;
case SSPP_DMA5:
if (rect_index == DPU_SSPP_RECT_1) {
- mixercfg_ext4 |= ((i + 1) & 0xF) << 12;
+ mixercfg_ext4 |= mix_ext << 12;
} else {
- mixercfg_ext4 |= ((i + 1) & 0xF) << 4;
+ mixercfg_ext4 |= mix_ext << 4;
}
break;
case SSPP_CURSOR0:
- mixercfg_ext |= ((i + 1) & 0xF) << 20;
+ mixercfg_ext |= mix_ext << 20;
break;
case SSPP_CURSOR1:
- mixercfg_ext |= ((i + 1) & 0xF) << 26;
+ mixercfg_ext |= mix_ext << 26;
break;
default:
break;