From: Maxime Ripard <mripard@kernel.org>
To: Jyri Sarha <jyri.sarha@iki.fi>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Maxime Ripard <mripard@kernel.org>
Subject: [PATCH v2 13/14] drm/tidss: dispc: Switch OVR_REG_FLD_MOD to using a mask
Date: Wed, 20 Aug 2025 16:01:53 +0200 [thread overview]
Message-ID: <20250820-drm-tidss-field-api-v2-13-43cab671c648@kernel.org> (raw)
In-Reply-To: <20250820-drm-tidss-field-api-v2-0-43cab671c648@kernel.org>
The OVR_REG_FLD_MOD 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 OVR_REG_FLD_MOD 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>
---
drivers/gpu/drm/tidss/tidss_dispc.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
index c5cad1ddcccfbf1d0b6fb53773bb3aff428ef493..99d3a84a5b40e1e791300199d6b3da9a12d11f80 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -645,17 +645,17 @@ void tidss_disable_oldi(struct tidss_device *tidss, u32 hw_videoport)
u32 _reg = dispc_vp_read(_dispc, _vp, _idx); \
FIELD_MODIFY((mask), &_reg, (val)); \
dispc_vp_write(_dispc, _vp, _idx, _reg); \
})
-#define OVR_REG_FLD_MOD(dispc, ovr, idx, val, start, end) \
+#define OVR_REG_FLD_MOD(dispc, ovr, idx, val, mask) \
({ \
struct dispc_device *_dispc = (dispc); \
u32 _ovr = (ovr); \
u32 _idx = (idx); \
u32 _reg = dispc_ovr_read(_dispc, _ovr, _idx); \
- FIELD_MODIFY(GENMASK((start), (end)), &_reg, (val)); \
+ FIELD_MODIFY((mask), &_reg, (val)); \
dispc_ovr_write(_dispc, _ovr, _idx, _reg); \
})
static dispc_irq_t dispc_vp_irq_from_raw(u32 stat, u32 hw_videoport)
{
@@ -1483,29 +1483,29 @@ static void dispc_am65x_ovr_set_plane(struct dispc_device *dispc,
u32 x, u32 y, u32 layer)
{
u32 hw_id = dispc->feat->vid_info[hw_plane].hw_id;
OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer),
- hw_id, 4, 1);
- OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer),
- x, 17, 6);
- OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer),
- y, 30, 19);
+ hw_id, GENMASK(4, 1));
+ OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer), x,
+ GENMASK(17, 6));
+ OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer), y,
+ GENMASK(30, 19));
}
static void dispc_j721e_ovr_set_plane(struct dispc_device *dispc,
u32 hw_plane, u32 hw_videoport,
u32 x, u32 y, u32 layer)
{
u32 hw_id = dispc->feat->vid_info[hw_plane].hw_id;
OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer),
- hw_id, 4, 1);
- OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES2(layer),
- x, 13, 0);
- OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES2(layer),
- y, 29, 16);
+ hw_id, GENMASK(4, 1));
+ OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES2(layer), x,
+ GENMASK(13, 0));
+ OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES2(layer), y,
+ GENMASK(29, 16));
}
void dispc_ovr_set_plane(struct dispc_device *dispc, u32 hw_plane,
u32 hw_videoport, u32 x, u32 y, u32 layer)
{
@@ -1536,11 +1536,11 @@ void dispc_ovr_enable_layer(struct dispc_device *dispc,
{
if (dispc->feat->subrev == DISPC_K2G)
return;
OVR_REG_FLD_MOD(dispc, hw_videoport, DISPC_OVR_ATTRIBUTES(layer),
- !!enable, 0, 0);
+ !!enable, GENMASK(0, 0));
}
/* CSC */
enum csc_ctm {
CSC_RR, CSC_RG, CSC_RB,
--
2.50.1
next prev parent reply other threads:[~2025-08-20 14:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 14:01 [PATCH v2 00/14] drm/tidss: dispc: Convert to FIELD_* API Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 01/14] drm/tidss: dispc: Remove unused OVR_REG_GET Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 02/14] drm/tidss: dispc: Convert accessors to macros Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 03/14] drm/tidss: dispc: Switch to GENMASK instead of FLD_MASK Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 04/14] drm/tidss: dispc: Get rid of FLD_VAL Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 05/14] drm/tidss: dispc: Get rid of FLD_GET Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 06/14] drm/tidss: dispc: Get rid of FLD_MOD Maxime Ripard
2025-08-21 15:19 ` kernel test robot
2025-08-20 14:01 ` [PATCH v2 07/14] drm/tidss: dispc: Switch REG_GET to using a mask Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 08/14] drm/tidss: dispc: Switch REG_FLD_MOD " Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 09/14] drm/tidss: dispc: Switch VID_REG_GET " Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 10/14] drm/tidss: dispc: Switch VID_REG_FLD_MOD " Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 11/14] drm/tidss: dispc: Switch VP_REG_GET " Maxime Ripard
2025-08-20 14:01 ` [PATCH v2 12/14] drm/tidss: dispc: Switch VP_REG_FLD_MOD " Maxime Ripard
2025-08-20 14:01 ` Maxime Ripard [this message]
2025-08-20 14:01 ` [PATCH v2 14/14] drm/tidss: dispc: Define field masks being used Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250820-drm-tidss-field-api-v2-13-43cab671c648@kernel.org \
--to=mripard@kernel.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jyri.sarha@iki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).