Skip to content

Commit 36e5da1

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: aal: Use bitfield macros
Make the code more robust and improve readability by using bitfield macros instead of open coding bit operations. Reviewed-by: CK Hu <[email protected]> Reviewed-by: Nícolas F. R. A. Prado <[email protected]> Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 6e46998 commit 36e5da1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/gpu/drm/mediatek/mtk_disp_aal.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#define DISP_AAL_EN 0x0000
1919
#define AAL_EN BIT(0)
2020
#define DISP_AAL_SIZE 0x0030
21+
#define DISP_AAL_SIZE_HSIZE GENMASK(28, 16)
22+
#define DISP_AAL_SIZE_VSIZE GENMASK(12, 0)
2123
#define DISP_AAL_OUTPUT_SIZE 0x04d8
2224
#define DISP_AAL_LUT_SIZE 512
2325

@@ -51,9 +53,13 @@ void mtk_aal_config(struct device *dev, unsigned int w,
5153
unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
5254
{
5355
struct mtk_disp_aal *aal = dev_get_drvdata(dev);
56+
u32 sz;
5457

55-
mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE);
56-
mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE);
58+
sz = FIELD_PREP(DISP_AAL_SIZE_HSIZE, w);
59+
sz |= FIELD_PREP(DISP_AAL_SIZE_VSIZE, h);
60+
61+
mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE);
62+
mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE);
5763
}
5864

5965
/**

0 commit comments

Comments
 (0)