From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: "Maxime Ripard" <mripard@kernel.org>,
"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Maíra Canal" <mcanal@igalia.com>,
"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"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 v3 5/9] drm/vc4: hdmi: Convert to drmm_connector_hdmi_init()
Date: Wed, 14 Oct 2026 04:03:12 +0300 [thread overview]
Message-ID: <20261014-vc4-common-scramb-v3-5-c68d58d959a2@collabora.com> (raw)
In-Reply-To: <20261014-vc4-common-scramb-v3-0-c68d58d959a2@collabora.com>
Switch driver over to the new drmm_connector_hdmi_init() signature. The
vendor, product, supported_formats and max_bpc values previously passed
as arguments are now provided through struct drm_connector_hdmi_funcs,
together with the new supported_hdmi_ver field.
VC4 needs three distinct capability sets, based on the maximum TMDS
character rate and color depth supported by each controller variant:
RPi 0-3: 165 MHz (HDMI 1.2), 8-bit
RPi 4 (HDMI1): 340 MHz (HDMI 1.4), 12-bit
RPi 4 (HDMI0), RPi 5: 600 MHz (HDMI 2.0), 12-bit
Introduce three drm_connector_hdmi_funcs instances for these tiers and
assign them to the corresponding vc4_hdmi_variant entries. Additionally,
drop the now redundant .supports_hdr field of struct vc4_hdmi_variant.
As the callback members are identical across all three, factor the
shared initializers into a VC4_HDMI_CONNECTOR_FUNCS_COMMON macro to
avoid duplication, with each variant adding only its distinguishing
max_bpc/supported_hdmi_ver fields.
Note that HDMI 2.0 cannot be advertised at this point, since it requires
converting the driver to common scrambling infrastructure. This will be
handled separately, hence temporarily use HDMI_VERSION_UNKNOWN for the
related hdmi_funcs instance to skip generic scrambler and TMDS rate
validation, and continue to rely on current driver-local implementation.
No functional change intended.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 93 ++++++++++++++++++++++++------------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 6 +--
2 files changed, 56 insertions(+), 43 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 6bd5aa77538e..a03e50e8afcb 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -510,7 +510,6 @@ static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs =
.mode_valid = drm_hdmi_connector_mode_valid,
};
-static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs;
static const struct drm_connector_hdmi_audio_funcs vc4_hdmi_audio_funcs;
static int vc4_hdmi_connector_init(struct drm_device *dev,
@@ -518,22 +517,13 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
{
struct drm_connector *connector = &vc4_hdmi->connector;
struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
- unsigned int max_bpc = 8;
int ret;
- if (vc4_hdmi->variant->supports_hdr)
- max_bpc = 12;
-
- ret = drmm_connector_hdmi_ini2(dev, connector,
- "Broadcom", "Videocore",
+ ret = drmm_connector_hdmi_init(dev, connector,
&vc4_hdmi_connector_funcs,
- &vc4_hdmi_hdmi_connector_funcs,
+ vc4_hdmi->variant->hdmi_funcs,
DRM_MODE_CONNECTOR_HDMIA,
- vc4_hdmi->ddc,
- BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) |
- BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) |
- BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444),
- max_bpc);
+ vc4_hdmi->ddc);
if (ret)
return ret;
@@ -1722,28 +1712,51 @@ vc4_hdmi_connector_clock_valid(const struct drm_connector *connector,
return MODE_OK;
}
-static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = {
- .tmds_char_rate_valid = vc4_hdmi_connector_clock_valid,
- .avi = {
- .clear_infoframe = vc4_hdmi_clear_avi_infoframe,
- .write_infoframe = vc4_hdmi_write_avi_infoframe,
- },
- .hdmi = {
- .clear_infoframe = vc4_hdmi_clear_hdmi_infoframe,
- .write_infoframe = vc4_hdmi_write_hdmi_infoframe,
- },
- .audio = {
- .clear_infoframe = vc4_hdmi_clear_audio_infoframe,
- .write_infoframe = vc4_hdmi_write_audio_infoframe,
- },
- .hdr_drm = {
- .clear_infoframe = vc4_hdmi_clear_hdr_drm_infoframe,
- .write_infoframe = vc4_hdmi_write_hdr_drm_infoframe,
- },
- .spd = {
- .clear_infoframe = vc4_hdmi_clear_spd_infoframe,
- .write_infoframe = vc4_hdmi_write_spd_infoframe,
- },
+#define VC4_HDMI_CONNECTOR_FUNCS_COMMON \
+ .vendor = "Broadcom", \
+ .product = "Videocore", \
+ .supported_formats = BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | \
+ BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | \
+ BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), \
+ .tmds_char_rate_valid = vc4_hdmi_connector_clock_valid, \
+ .avi = { \
+ .clear_infoframe = vc4_hdmi_clear_avi_infoframe, \
+ .write_infoframe = vc4_hdmi_write_avi_infoframe, \
+ }, \
+ .hdmi = { \
+ .clear_infoframe = vc4_hdmi_clear_hdmi_infoframe, \
+ .write_infoframe = vc4_hdmi_write_hdmi_infoframe, \
+ }, \
+ .audio = { \
+ .clear_infoframe = vc4_hdmi_clear_audio_infoframe, \
+ .write_infoframe = vc4_hdmi_write_audio_infoframe, \
+ }, \
+ .hdr_drm = { \
+ .clear_infoframe = vc4_hdmi_clear_hdr_drm_infoframe, \
+ .write_infoframe = vc4_hdmi_write_hdr_drm_infoframe, \
+ }, \
+ .spd = { \
+ .clear_infoframe = vc4_hdmi_clear_spd_infoframe, \
+ .write_infoframe = vc4_hdmi_write_spd_infoframe, \
+ }
+
+static const struct drm_connector_hdmi_funcs vc4_hdmi_connector_funcs_hdmi12 = {
+ VC4_HDMI_CONNECTOR_FUNCS_COMMON,
+ .max_bpc = 8,
+ .supported_hdmi_ver = HDMI_VERSION_1_2,
+};
+
+static const struct drm_connector_hdmi_funcs vc4_hdmi_connector_funcs_hdmi14 = {
+ VC4_HDMI_CONNECTOR_FUNCS_COMMON,
+ .max_bpc = 12,
+ .supported_hdmi_ver = HDMI_VERSION_1_4,
+};
+
+static const struct drm_connector_hdmi_funcs vc4_hdmi_connector_funcs_hdmi20 = {
+ VC4_HDMI_CONNECTOR_FUNCS_COMMON,
+ .max_bpc = 12,
+ /* TODO: set HDMI_VERSION_2_0 and convert to common scrambler infra */
+ .supported_hdmi_ver = HDMI_VERSION_UNKNOWN,
};
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
@@ -3359,7 +3372,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = {
.phy_rng_enable = vc4_hdmi_phy_rng_enable,
.phy_rng_disable = vc4_hdmi_phy_rng_disable,
.channel_map = vc4_hdmi_channel_map,
- .supports_hdr = false,
+ .hdmi_funcs = &vc4_hdmi_connector_funcs_hdmi12,
};
static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
@@ -3387,8 +3400,8 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
.phy_rng_enable = vc5_hdmi_phy_rng_enable,
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map,
- .supports_hdr = true,
.hp_detect = vc5_hdmi_hp_detect,
+ .hdmi_funcs = &vc4_hdmi_connector_funcs_hdmi20,
};
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
@@ -3416,8 +3429,8 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
.phy_rng_enable = vc5_hdmi_phy_rng_enable,
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map,
- .supports_hdr = true,
.hp_detect = vc5_hdmi_hp_detect,
+ .hdmi_funcs = &vc4_hdmi_connector_funcs_hdmi14,
};
static const struct vc4_hdmi_variant bcm2712_hdmi0_variant = {
@@ -3443,8 +3456,8 @@ static const struct vc4_hdmi_variant bcm2712_hdmi0_variant = {
.phy_init = vc6_hdmi_phy_init,
.phy_disable = vc6_hdmi_phy_disable,
.channel_map = vc5_hdmi_channel_map,
- .supports_hdr = true,
.hp_detect = vc5_hdmi_hp_detect,
+ .hdmi_funcs = &vc4_hdmi_connector_funcs_hdmi20,
};
static const struct vc4_hdmi_variant bcm2712_hdmi1_variant = {
@@ -3470,8 +3483,8 @@ static const struct vc4_hdmi_variant bcm2712_hdmi1_variant = {
.phy_init = vc6_hdmi_phy_init,
.phy_disable = vc6_hdmi_phy_disable,
.channel_map = vc5_hdmi_channel_map,
- .supports_hdr = true,
.hp_detect = vc5_hdmi_hp_detect,
+ .hdmi_funcs = &vc4_hdmi_connector_funcs_hdmi20,
};
static const struct of_device_id vc4_hdmi_dt_match[] = {
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 29d461d4ee49..d5ffcc17de32 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -90,11 +90,11 @@ struct vc4_hdmi_variant {
/* Callback to get channel map */
u32 (*channel_map)(struct vc4_hdmi *vc4_hdmi, u32 channel_mask);
- /* Enables HDR metadata */
- bool supports_hdr;
-
/* Callback for hardware specific hotplug detect */
bool (*hp_detect)(struct vc4_hdmi *vc4_hdmi);
+
+ /* HDMI-related connector callbacks and controller capabilities */
+ const struct drm_connector_hdmi_funcs *hdmi_funcs;
};
/* HDMI audio information */
--
2.55.0
next prev parent reply other threads:[~2026-10-14 1:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 1:03 [PATCH v3 0/9] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure Cristian Ciocaltea
2026-10-14 1:03 ` [PATCH v3 1/9] drm/vc4: hdmi: Use common TMDS char rate constants Cristian Ciocaltea
2026-10-14 1:03 ` [PATCH v3 2/9] drm/vc4: hdmi: Switch to drm_hdmi_mode_needs_scrambling() Cristian Ciocaltea
2026-10-14 1:03 ` [PATCH v3 3/9] drm/vc4: hdmi: Switch to .force_ctx() connector helper Cristian Ciocaltea
2026-10-14 1:03 ` [PATCH v3 4/9] drm/vc4: hdmi: Propagate -EDEADLK to the top level Cristian Ciocaltea
2026-10-14 1:03 ` Cristian Ciocaltea [this message]
2026-10-14 1:03 ` [PATCH v3 6/9] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure Cristian Ciocaltea
2026-10-27 13:35 ` Maíra Canal
2026-10-14 1:03 ` [PATCH v3 7/9] drm/vc4: hdmi: Clamp CEC clock divider to its register field width Cristian Ciocaltea
2026-10-27 17:50 ` Dave Stevenson
2026-10-14 1:03 ` [PATCH v3 8/9] drm/vc4: hdmi: Bump BCM2835 max pixel clock to 165 MHz Cristian Ciocaltea
2026-10-27 17:51 ` Dave Stevenson
2026-10-14 1:03 ` [PATCH v3 9/9] drm/vc4: hdmi: Defer pixel clock validation to HDMI helpers Cristian Ciocaltea
2026-10-27 1:49 ` [PATCH v3 0/9] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure 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=20261014-vc4-common-scramb-v3-5-c68d58d959a2@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-list@raspberrypi.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcanal@igalia.com \
--cc=mripard@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®