]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/tidss: dispc: Switch REG_GET to using a mask
authorMaxime Ripard <mripard@kernel.org>
Wed, 27 Aug 2025 15:12:38 +0000 (17:12 +0200)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Mon, 1 Sep 2025 07:37:19 +0000 (10:37 +0300)
The REG_GET function takes the start and end bits as parameter and will
generate a mask out of them.

This makes it difficult to share the masks between callers, since we now
need two arguments and to keep them consistent.

Let's change REG_GET to take the mask as an argument instead, and let
the caller create the mask. Eventually, this mask will be moved to a
define.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20250827-drm-tidss-field-api-v3-7-7689b664cc63@kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers/gpu/drm/tidss/tidss_dispc.c

index 4eeeae6e0a0ecc8bb5bbc5f455e9fab6b913097a..48985f0bbbacacf76293f24414470664c74c40ec 100644 (file)
@@ -594,9 +594,8 @@ void tidss_disable_oldi(struct tidss_device *tidss, u32 hw_videoport)
  * number. For example 7:0
  */
 
-#define REG_GET(dispc, idx, start, end)                                        \
-       ((u32)FIELD_GET(GENMASK((start), (end)),                        \
-                       dispc_read((dispc), (idx))))
+#define REG_GET(dispc, idx, mask)                                      \
+       ((u32)FIELD_GET((mask), dispc_read((dispc), (idx))))
 
 #define REG_FLD_MOD(dispc, idx, val, start, end)                       \
        ({                                                              \
@@ -2794,26 +2793,26 @@ int dispc_runtime_resume(struct dispc_device *dispc)
 
        clk_prepare_enable(dispc->fclk);
 
-       if (REG_GET(dispc, DSS_SYSSTATUS, 0, 0) == 0)
+       if (REG_GET(dispc, DSS_SYSSTATUS, GENMASK(0, 0)) == 0)
                dev_warn(dispc->dev, "DSS FUNC RESET not done!\n");
 
        dev_dbg(dispc->dev, "OMAP DSS7 rev 0x%x\n",
                dispc_read(dispc, DSS_REVISION));
 
        dev_dbg(dispc->dev, "VP RESETDONE %d,%d,%d\n",
-               REG_GET(dispc, DSS_SYSSTATUS, 1, 1),
-               REG_GET(dispc, DSS_SYSSTATUS, 2, 2),
-               REG_GET(dispc, DSS_SYSSTATUS, 3, 3));
+               REG_GET(dispc, DSS_SYSSTATUS, GENMASK(1, 1)),
+               REG_GET(dispc, DSS_SYSSTATUS, GENMASK(2, 2)),
+               REG_GET(dispc, DSS_SYSSTATUS, GENMASK(3, 3)));
 
        if (dispc->feat->subrev == DISPC_AM625 ||
            dispc->feat->subrev == DISPC_AM65X)
                dev_dbg(dispc->dev, "OLDI RESETDONE %d,%d,%d\n",
-                       REG_GET(dispc, DSS_SYSSTATUS, 5, 5),
-                       REG_GET(dispc, DSS_SYSSTATUS, 6, 6),
-                       REG_GET(dispc, DSS_SYSSTATUS, 7, 7));
+                       REG_GET(dispc, DSS_SYSSTATUS, GENMASK(5, 5)),
+                       REG_GET(dispc, DSS_SYSSTATUS, GENMASK(6, 6)),
+                       REG_GET(dispc, DSS_SYSSTATUS, GENMASK(7, 7)));
 
        dev_dbg(dispc->dev, "DISPC IDLE %d\n",
-               REG_GET(dispc, DSS_SYSSTATUS, 9, 9));
+               REG_GET(dispc, DSS_SYSSTATUS, GENMASK(9, 9)));
 
        dispc_initial_config(dispc);