[PATCH 14/39] drm/imx: dc: fu: Inline FRAC_OFFSET into FetchLayer and FetchWrap
Marek Vasut
marek.vasut at mailbox.org
Sat Oct 11 09:51:29 PDT 2025
Move FRAC_OFFSET into FetchLayer and FetchLayer drivers, because
FetchLayer is present on i.MX95 with different FRAC_OFFSET and
FetchWrap is not present. Prepare the register offset calculation
for i.MX95 addition. No functional change.
Signed-off-by: Marek Vasut <marek.vasut at mailbox.org>
---
Cc: Abel Vesa <abelvesa at kernel.org>
Cc: Conor Dooley <conor+dt at kernel.org>
Cc: Fabio Estevam <festevam at gmail.com>
Cc: Krzysztof Kozlowski <krzk+dt at kernel.org>
Cc: Laurent Pinchart <Laurent.pinchart at ideasonboard.com>
Cc: Liu Ying <victor.liu at nxp.com>
Cc: Lucas Stach <l.stach at pengutronix.de>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Pengutronix Kernel Team <kernel at pengutronix.de>
Cc: Rob Herring <robh at kernel.org>
Cc: Shawn Guo <shawnguo at kernel.org>
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Cc: devicetree at vger.kernel.org
Cc: dri-devel at lists.freedesktop.org
Cc: imx at lists.linux.dev
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-clk at vger.kernel.org
---
drivers/gpu/drm/imx/dc/dc-fl.c | 46 +++++++++++++++++++---------------
drivers/gpu/drm/imx/dc/dc-fu.h | 3 ---
drivers/gpu/drm/imx/dc/dc-fw.c | 45 ++++++++++++++++++---------------
3 files changed, 51 insertions(+), 43 deletions(-)
diff --git a/drivers/gpu/drm/imx/dc/dc-fl.c b/drivers/gpu/drm/imx/dc/dc-fl.c
index 8571871c6a683..a76825dc75fe1 100644
--- a/drivers/gpu/drm/imx/dc/dc-fl.c
+++ b/drivers/gpu/drm/imx/dc/dc-fl.c
@@ -15,16 +15,19 @@
#include "dc-drv.h"
#include "dc-fu.h"
-#define BASEADDRESS(x) (0x10 + FRAC_OFFSET * (x))
-#define SOURCEBUFFERATTRIBUTES(x) (0x14 + FRAC_OFFSET * (x))
-#define SOURCEBUFFERDIMENSION(x) (0x18 + FRAC_OFFSET * (x))
-#define COLORCOMPONENTBITS(x) (0x1c + FRAC_OFFSET * (x))
-#define COLORCOMPONENTSHIFT(x) (0x20 + FRAC_OFFSET * (x))
-#define LAYEROFFSET(x) (0x24 + FRAC_OFFSET * (x))
-#define CLIPWINDOWOFFSET(x) (0x28 + FRAC_OFFSET * (x))
-#define CLIPWINDOWDIMENSIONS(x) (0x2c + FRAC_OFFSET * (x))
-#define CONSTANTCOLOR(x) (0x30 + FRAC_OFFSET * (x))
-#define LAYERPROPERTY(x) (0x34 + FRAC_OFFSET * (x))
+#define FRAC_OFFSET 0x28
+
+#define BURSTBUFFERMANAGEMENT 0xc
+#define BASEADDRESS 0x10
+#define SOURCEBUFFERATTRIBUTES 0x14
+#define SOURCEBUFFERDIMENSION 0x18
+#define COLORCOMPONENTBITS 0x1c
+#define COLORCOMPONENTSHIFT 0x20
+#define LAYEROFFSET 0x24
+#define CLIPWINDOWOFFSET 0x28
+#define CLIPWINDOWDIMENSIONS 0x2c
+#define CONSTANTCOLOR 0x30
+#define LAYERPROPERTY 0x34
#define FRAMEDIMENSIONS 0x150
struct dc_fl {
@@ -98,6 +101,7 @@ static int dc_fl_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct dc_drm_device *dc_drm = data;
+ unsigned int off_base, off_regs;
struct resource *res_pec;
void __iomem *base_cfg;
struct dc_fl *fl;
@@ -130,16 +134,18 @@ static int dc_fl_bind(struct device *dev, struct device *master, void *data)
fu->link_id = LINK_ID_FETCHLAYER0;
fu->id = DC_FETCHUNIT_FL0;
for (i = 0; i < DC_FETCHUNIT_FRAC_NUM; i++) {
- fu->reg_baseaddr[i] = BASEADDRESS(i);
- fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES(i);
- fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION(i);
- fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS(i);
- fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT(i);
- fu->reg_layeroffset[i] = LAYEROFFSET(i);
- fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET(i);
- fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS(i);
- fu->reg_constantcolor[i] = CONSTANTCOLOR(i);
- fu->reg_layerproperty[i] = LAYERPROPERTY(i);
+ off_base = i * FRAC_OFFSET;
+ fu->reg_baseaddr[i] = BASEADDRESS + off_base;
+ off_regs = i * FRAC_OFFSET;
+ fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES + off_regs;
+ fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION + off_regs;
+ fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS + off_regs;
+ fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT + off_regs;
+ fu->reg_layeroffset[i] = LAYEROFFSET + off_regs;
+ fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET + off_regs;
+ fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS + off_regs;
+ fu->reg_constantcolor[i] = CONSTANTCOLOR + off_regs;
+ fu->reg_layerproperty[i] = LAYERPROPERTY + off_regs;
}
fu->reg_burstbuffermanagement = BURSTBUFFERMANAGEMENT;
fu->reg_framedimensions = FRAMEDIMENSIONS;
diff --git a/drivers/gpu/drm/imx/dc/dc-fu.h b/drivers/gpu/drm/imx/dc/dc-fu.h
index 2a330c0abf6a1..3983ef23e40fb 100644
--- a/drivers/gpu/drm/imx/dc/dc-fu.h
+++ b/drivers/gpu/drm/imx/dc/dc-fu.h
@@ -15,10 +15,7 @@
#include "dc-pe.h"
-#define FRAC_OFFSET 0x28
-
#define STATICCONTROL 0x8
-#define BURSTBUFFERMANAGEMENT 0xc
/* COLORCOMPONENTBITS */
#define R_BITS(x) FIELD_PREP_CONST(GENMASK(27, 24), (x))
diff --git a/drivers/gpu/drm/imx/dc/dc-fw.c b/drivers/gpu/drm/imx/dc/dc-fw.c
index dc036121f0d23..7bbe06a840c93 100644
--- a/drivers/gpu/drm/imx/dc/dc-fw.c
+++ b/drivers/gpu/drm/imx/dc/dc-fw.c
@@ -16,16 +16,19 @@
#define PIXENGCFG_DYNAMIC 0x8
-#define BASEADDRESS(x) (0x10 + FRAC_OFFSET * (x))
-#define SOURCEBUFFERATTRIBUTES(x) (0x14 + FRAC_OFFSET * (x))
-#define SOURCEBUFFERDIMENSION(x) (0x18 + FRAC_OFFSET * (x))
-#define COLORCOMPONENTBITS(x) (0x1c + FRAC_OFFSET * (x))
-#define COLORCOMPONENTSHIFT(x) (0x20 + FRAC_OFFSET * (x))
-#define LAYEROFFSET(x) (0x24 + FRAC_OFFSET * (x))
-#define CLIPWINDOWOFFSET(x) (0x28 + FRAC_OFFSET * (x))
-#define CLIPWINDOWDIMENSIONS(x) (0x2c + FRAC_OFFSET * (x))
-#define CONSTANTCOLOR(x) (0x30 + FRAC_OFFSET * (x))
-#define LAYERPROPERTY(x) (0x34 + FRAC_OFFSET * (x))
+#define FRAC_OFFSET 0x28
+
+#define BURSTBUFFERMANAGEMENT 0xc
+#define BASEADDRESS 0x10
+#define SOURCEBUFFERATTRIBUTES 0x14
+#define SOURCEBUFFERDIMENSION 0x18
+#define COLORCOMPONENTBITS 0x1c
+#define COLORCOMPONENTSHIFT 0x20
+#define LAYEROFFSET 0x24
+#define CLIPWINDOWOFFSET 0x28
+#define CLIPWINDOWDIMENSIONS 0x2c
+#define CONSTANTCOLOR 0x30
+#define LAYERPROPERTY 0x34
#define FRAMEDIMENSIONS 0x150
#define CONTROL 0x170
@@ -130,6 +133,7 @@ static int dc_fw_bind(struct device *dev, struct device *master, void *data)
struct resource *res_pec;
void __iomem *base_pec;
void __iomem *base_cfg;
+ unsigned int off;
struct dc_fw *fw;
struct dc_fu *fu;
int i, id;
@@ -167,16 +171,17 @@ static int dc_fw_bind(struct device *dev, struct device *master, void *data)
fu->link_id = LINK_ID_FETCHWARP2;
fu->id = DC_FETCHUNIT_FW2;
for (i = 0; i < DC_FETCHUNIT_FRAC_NUM; i++) {
- fu->reg_baseaddr[i] = BASEADDRESS(i);
- fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES(i);
- fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION(i);
- fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS(i);
- fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT(i);
- fu->reg_layeroffset[i] = LAYEROFFSET(i);
- fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET(i);
- fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS(i);
- fu->reg_constantcolor[i] = CONSTANTCOLOR(i);
- fu->reg_layerproperty[i] = LAYERPROPERTY(i);
+ off = i * FRAC_OFFSET;
+ fu->reg_baseaddr[i] = BASEADDRESS + off;
+ fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES + off;
+ fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION + off;
+ fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS + off;
+ fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT + off;
+ fu->reg_layeroffset[i] = LAYEROFFSET + off;
+ fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET + off;
+ fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS + off;
+ fu->reg_constantcolor[i] = CONSTANTCOLOR + off;
+ fu->reg_layerproperty[i] = LAYERPROPERTY + off;
}
fu->reg_burstbuffermanagement = BURSTBUFFERMANAGEMENT;
fu->reg_framedimensions = FRAMEDIMENSIONS;
--
2.51.0
More information about the linux-arm-kernel
mailing list