Re: [PATCH v4 1/9] drm/mediatek: dsi: Use GENMASK() for register mask definitions

From: AngeloGioacchino Del Regno
Date: Tue Feb 06 2024 - 10:54:18 EST


Il 06/02/24 15:47, Alexandre Mergnat ha scritto:


On 06/02/2024 13:07, AngeloGioacchino Del Regno wrote:
Change magic numerical masks with usage of the GENMASK() macro
to improve readability.

While at it, also fix the DSI_PS_SEL mask to include all bits instead
of just a subset of them.

This commit brings no functional changes.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
---
  drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++---------------
  1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index a2fdfc8ddb15..3b7392c03b4d 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -58,18 +58,18 @@

...snip...

  #define DSI_PSCTRL        0x1c
-#define DSI_PS_WC            0x3fff
-#define DSI_PS_SEL            (3 << 16)
+#define DSI_PS_WC            GENMASK(14, 0)
+#define DSI_PS_SEL            GENMASK(19, 16)

0011 0000 0000 0000 0000 => GENMASK(17, 16)

Alexandre, the reason for that is in the commit description :-P

"While at it, also fix the DSI_PS_SEL mask to include all bits instead
of just a subset of them."

Thanks for the reviews, btw!

Cheers!
Angelo


  #define PACKED_PS_16BIT_RGB565        (0 << 16)
  #define LOOSELY_PS_18BIT_RGB666        (1 << 16)
  #define PACKED_PS_18BIT_RGB666        (2 << 16)
@@ -109,26 +109,26 @@
  #define LD0_WAKEUP_EN            BIT(2)