From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] drm/bridge: dw-hdmi-qp: Rework DRM InfoFrame handler
Date: Sun, 25 Jan 2026 02:23:02 +0200 [thread overview]
Message-ID: <20260125-dw-hdmi-qp-iframe-v1-4-e0f7649ecc4b@collabora.com> (raw)
In-Reply-To: <20260125-dw-hdmi-qp-iframe-v1-0-e0f7649ecc4b@collabora.com>
Make use of the recently introduced dw_hdmi_qp_write_pkt() helper to
simplify the writing of the Dynamic Range and Mastering (DRM) InfoFrame
packet header and body registers.
Moreover, since now having dedicated callbacks per InfoFrame type, move
the implementation to dw_hdmi_qp_bridge_write_hdr_drm_infoframe() and
drop dw_hdmi_qp_config_drm_infoframe().
While at it, also discard the unnecessary infoframe size verification,
as well as the redundant disabling of the packet transmission (already
done by the explicit call to the clear callback).
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 47 +++++++++-------------------
1 file changed, 14 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index ff856f8bd53b..178d95a8ecbb 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -748,38 +748,6 @@ static struct i2c_adapter *dw_hdmi_qp_i2c_adapter(struct dw_hdmi_qp *hdmi)
return adap;
}
-static int dw_hdmi_qp_config_drm_infoframe(struct dw_hdmi_qp *hdmi,
- const u8 *buffer, size_t len)
-{
- u32 val, i;
-
- if (len != HDMI_INFOFRAME_SIZE(DRM)) {
- dev_err(hdmi->dev, "failed to configure drm infoframe\n");
- return -EINVAL;
- }
-
- dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN);
-
- val = buffer[1] << 8 | buffer[2] << 16;
- dw_hdmi_qp_write(hdmi, val, PKT_DRMI_CONTENTS0);
-
- for (i = 0; i <= buffer[2]; i++) {
- if (i % 4 == 0)
- val = buffer[3 + i];
- val |= buffer[3 + i] << ((i % 4) * 8);
-
- if ((i % 4 == 3) || i == buffer[2])
- dw_hdmi_qp_write(hdmi, val,
- PKT_DRMI_CONTENTS1 + ((i / 4) * 4));
- }
-
- dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_FIELDRATE, PKTSCHED_PKT_CONFIG1);
- dw_hdmi_qp_mod(hdmi, PKTSCHED_DRMI_TX_EN, PKTSCHED_DRMI_TX_EN,
- PKTSCHED_PKT_EN);
-
- return 0;
-}
-
/*
* Static values documented in the TRM
* Different values are only used for debug purposes
@@ -1033,10 +1001,23 @@ static int dw_hdmi_qp_bridge_write_hdr_drm_infoframe(struct drm_bridge *bridge,
const u8 *buffer, size_t len)
{
struct dw_hdmi_qp *hdmi = bridge->driver_private;
+ size_t i;
dw_hdmi_qp_bridge_clear_hdr_drm_infoframe(bridge);
- return dw_hdmi_qp_config_drm_infoframe(hdmi, buffer, len);
+ /* DRM packet header */
+ dw_hdmi_qp_write_pkt(hdmi, buffer, 1, 2, PKT_DRMI_CONTENTS0);
+
+ /* DRM packet body */
+ for (i = 0; i < len - 3; i += 4)
+ dw_hdmi_qp_write_pkt(hdmi, buffer + 3, i, min(len - i - 3, 4),
+ PKT_DRMI_CONTENTS1 + i);
+
+ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_FIELDRATE, PKTSCHED_PKT_CONFIG1);
+ dw_hdmi_qp_mod(hdmi, PKTSCHED_DRMI_TX_EN, PKTSCHED_DRMI_TX_EN,
+ PKTSCHED_PKT_EN);
+
+ return 0;
}
static int dw_hdmi_qp_bridge_write_spd_infoframe(struct drm_bridge *bridge,
--
2.52.0
next prev parent reply other threads:[~2026-01-25 0:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-25 0:22 [PATCH 0/5] Provide HDMI VSI & SPD InfoFrames to DW HDMI QP TX Cristian Ciocaltea
2026-01-25 0:22 ` [PATCH 1/5] drm/bridge: dw-hdmi-qp: Provide HDMI Vendor Specific InfoFrame Cristian Ciocaltea
2026-01-28 12:11 ` Daniel Stone
2026-01-28 12:54 ` Cristian Ciocaltea
2026-01-25 0:23 ` [PATCH 2/5] drm/bridge: dw-hdmi-qp: Provide SPD InfoFrame Cristian Ciocaltea
2026-01-25 0:23 ` [PATCH 3/5] drm/bridge: dw-hdmi-qp: Rework AVI InfoFrame handler Cristian Ciocaltea
2026-01-25 0:23 ` Cristian Ciocaltea [this message]
2026-01-25 0:23 ` [PATCH 5/5] drm/bridge: dw-hdmi-qp: Rework Audio " Cristian Ciocaltea
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=20260125-dw-hdmi-qp-iframe-v1-4-e0f7649ecc4b@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--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
all inboxes | Powered by JetHome®