summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/mediatek/mtk_disp_aal.c
diff options
context:
space:
mode:
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2023-10-12 12:57:27 +0300
committerChun-Kuang Hu <chunkuang.hu@kernel.org>2023-10-16 18:06:02 +0300
commit36e5da13779309793aae2bb7dab39415dfce11ed (patch)
tree2ed395fb73feecf218ab81999da07fa2c33b5d15 /drivers/gpu/drm/mediatek/mtk_disp_aal.c
parent6e46998c13f1235929091edeeb577585f3e00e10 (diff)
downloadlinux-36e5da13779309793aae2bb7dab39415dfce11ed.tar.xz
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 <ck.hu@mediatek.com> Reviewed-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-8-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/mediatek/mtk_disp_aal.c')
-rw-r--r--drivers/gpu/drm/mediatek/mtk_disp_aal.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
index e1406b37a86d..f97c194f9caa 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
@@ -18,6 +18,8 @@
#define DISP_AAL_EN 0x0000
#define AAL_EN BIT(0)
#define DISP_AAL_SIZE 0x0030
+#define DISP_AAL_SIZE_HSIZE GENMASK(28, 16)
+#define DISP_AAL_SIZE_VSIZE GENMASK(12, 0)
#define DISP_AAL_OUTPUT_SIZE 0x04d8
#define DISP_AAL_LUT_SIZE 512
@@ -51,9 +53,13 @@ void mtk_aal_config(struct device *dev, unsigned int w,
unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
{
struct mtk_disp_aal *aal = dev_get_drvdata(dev);
+ u32 sz;
- mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE);
- mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE);
+ sz = FIELD_PREP(DISP_AAL_SIZE_HSIZE, w);
+ sz |= FIELD_PREP(DISP_AAL_SIZE_VSIZE, h);
+
+ mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE);
+ mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE);
}
/**