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 08/14] drm/tidss: dispc: Switch REG_FLD_MOD to using a mask
Date: Wed, 30 Jul 2025 10:57:08 +0200 [thread overview]
Message-ID: <20250730-drm-tidss-field-api-v1-8-a71ae8dd2782@kernel.org> (raw)
In-Reply-To: <20250730-drm-tidss-field-api-v1-0-a71ae8dd2782@kernel.org>
The 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 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 | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
index cfd6c4cf716904cf78699baf2eb4c3a0f57a1abe..2d9bd95ded873232d22a1ecd8127cb0edc95c24c 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -617,15 +617,14 @@ static u32 FLD_MOD(u32 orig, u32 val, u32 mask)
static u32 REG_GET(struct dispc_device *dispc, u32 idx, u32 mask)
{
return FIELD_GET(mask, dispc_read(dispc, idx));
}
-static void REG_FLD_MOD(struct dispc_device *dispc, u32 idx, u32 val,
- u32 start, u32 end)
+static void REG_FLD_MOD(struct dispc_device *dispc, u32 idx, u32 val, u32 mask)
{
dispc_write(dispc, idx,
- FLD_MOD(dispc_read(dispc, idx), val, GENMASK(start, end)));
+ FLD_MOD(dispc_read(dispc, idx), val, mask));
}
static u32 VID_REG_GET(struct dispc_device *dispc, u32 hw_plane, u32 idx,
u32 start, u32 end)
{
@@ -2333,13 +2332,13 @@ static void dispc_k2g_plane_init(struct dispc_device *dispc)
unsigned int hw_plane;
dev_dbg(dispc->dev, "%s()\n", __func__);
/* MFLAG_CTRL = ENABLED */
- REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 2, 1, 0);
+ REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 2, GENMASK(1, 0));
/* MFLAG_START = MFLAGNORMALSTARTMODE */
- REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 0, 6, 6);
+ REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 0, GENMASK(6, 6));
for (hw_plane = 0; hw_plane < dispc->feat->num_vids; hw_plane++) {
u32 size = dispc_vid_get_fifo_size(dispc, hw_plane);
u32 thr_low, thr_high;
u32 mflag_low, mflag_high;
@@ -2384,17 +2383,17 @@ static void dispc_k3_plane_init(struct dispc_device *dispc)
u32 cba_lo_pri = 1;
u32 cba_hi_pri = 0;
dev_dbg(dispc->dev, "%s()\n", __func__);
- REG_FLD_MOD(dispc, DSS_CBA_CFG, cba_lo_pri, 2, 0);
- REG_FLD_MOD(dispc, DSS_CBA_CFG, cba_hi_pri, 5, 3);
+ REG_FLD_MOD(dispc, DSS_CBA_CFG, cba_lo_pri, GENMASK(2, 0));
+ REG_FLD_MOD(dispc, DSS_CBA_CFG, cba_hi_pri, GENMASK(5, 3));
/* MFLAG_CTRL = ENABLED */
- REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 2, 1, 0);
+ REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 2, GENMASK(1, 0));
/* MFLAG_START = MFLAGNORMALSTARTMODE */
- REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 0, 6, 6);
+ REG_FLD_MOD(dispc, DISPC_GLOBAL_MFLAG_ATTRIBUTE, 0, GENMASK(6, 6));
for (hw_plane = 0; hw_plane < dispc->feat->num_vids; hw_plane++) {
u32 size = dispc_vid_get_fifo_size(dispc, hw_plane);
u32 thr_low, thr_high;
u32 mflag_low, mflag_high;
@@ -2918,11 +2917,11 @@ static int dispc_softreset(struct dispc_device *dispc)
dispc_softreset_k2g(dispc);
return 0;
}
/* Soft reset */
- REG_FLD_MOD(dispc, DSS_SYSCONFIG, 1, 1, 1);
+ REG_FLD_MOD(dispc, DSS_SYSCONFIG, 1, GENMASK(1, 1));
/* Wait for reset to complete */
ret = readl_poll_timeout(dispc->base_common + DSS_SYSSTATUS,
val, val & 1, 100, 5000);
if (ret) {
dev_err(dispc->dev, "failed to reset dispc\n");
--
2.50.1
next prev parent reply other threads:[~2025-07-30 8:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 8:57 [PATCH 00/14] drm/tidss: dispc: Convert to FIELD_* API Maxime Ripard
2025-07-30 8:57 ` [PATCH 01/14] drm/tidss: dispc: Remove unused OVR_REG_GET Maxime Ripard
2025-07-30 8:57 ` [PATCH 02/14] drm/tidss: dispc: Switch to GENMASK instead of FLD_MASK Maxime Ripard
2025-07-30 8:57 ` [PATCH 03/14] drm/tidss: dispc: Switch to FIELD_PREP for FLD_VAL Maxime Ripard
2025-07-30 8:57 ` [PATCH 04/14] drm/tidss: dispc: Get rid of FLD_GET Maxime Ripard
2025-07-30 8:57 ` [PATCH 05/14] drm/tidss: dispc: Get rid of FLD_VAL Maxime Ripard
2025-07-30 8:57 ` [PATCH 06/14] drm/tidss: dispc: Switch FLD_MOD to using a mask Maxime Ripard
2025-07-30 8:57 ` [PATCH 07/14] drm/tidss: dispc: Switch REG_GET " Maxime Ripard
2025-07-30 8:57 ` Maxime Ripard [this message]
2025-07-30 8:57 ` [PATCH 09/14] drm/tidss: dispc: Switch VID_REG_GET " Maxime Ripard
2025-07-30 8:57 ` [PATCH 10/14] drm/tidss: dispc: Switch VID_REG_FLD_MOD " Maxime Ripard
2025-07-30 8:57 ` [PATCH 11/14] drm/tidss: dispc: Switch VP_REG_GET " Maxime Ripard
2025-07-30 8:57 ` [PATCH 12/14] drm/tidss: dispc: Switch VP_REG_FLD_MOD " Maxime Ripard
2025-07-30 8:57 ` [PATCH 13/14] drm/tidss: dispc: Switch OVR_REG_FLD_MOD " Maxime Ripard
2025-07-30 8:57 ` [PATCH 14/14] drm/tidss: dispc: Define field masks being used Maxime Ripard
2025-07-31 13:04 ` [PATCH 00/14] drm/tidss: dispc: Convert to FIELD_* API Louis Chauvet
2025-07-31 13:26 ` Maxime Ripard
2025-07-31 13:49 ` Louis Chauvet
2025-07-31 14:05 ` Maxime Ripard
2025-08-08 9:34 ` Tomi Valkeinen
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=20250730-drm-tidss-field-api-v1-8-a71ae8dd2782@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).