From patchwork Tue Sep 1 18:51:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 3097 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 1B2851C15D4 for ; Tue, 1 Sep 2026 21:07:01 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=collabora.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-25436-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-25436-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 1CE4B65501 for ; Tue, 1 Sep 2026 18:56:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 240DB4A6CE7; Tue, 1 Sep 2026 18:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="b87MGsuv" X-Original-To: linux-sunxi@lists.linux.dev Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 736BA4A5ED3 for ; Tue, 1 Sep 2026 18:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788288680; cv=none; b=QgWDwQZqsRHHRXi4ovwAc0OyAiKnsavSO/CRm6tBEeGL5Amd5Sl1NLtw3LPYj8sj0xRz/uCz/rRNI8M58zNK9ieBvDPrQG9Sl3KLBlLms2GhPfd2UWHvLFxWzWwqvhFTXMzJe6fDnrYfIA/MeEtbawXq5o76z/ji3QEcnb+DCsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788288680; c=relaxed/simple; bh=soG6OH4rGe++2MGJbbJQb1ItRjhRkZ2mAadAs/HdPYA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nRTqiSLXYS2d6FSZp44/VNxcsB3e+0YQjafHg2l8MDZD0/x3SiQvXmEX0fy+LIPHHaipYFv5AaW91gws1bYU1z5wANF+XsHCrodhfaprTwVBMFLX+VTZlFVVHmqni8dWzi+jatYHEknsRCPfebNjxO8UEhmAxtlZ03SzHm1r9m8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=b87MGsuv; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1788288675; bh=soG6OH4rGe++2MGJbbJQb1ItRjhRkZ2mAadAs/HdPYA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=b87MGsuvSdP6RSwSeM6+07OGqTEDo2mCf7Lao9sglKkDKpaRPlHYmRAhTvgd9Dx3F cCmFaZXjHHcEDXRCPj6dI6nGWQWsc5IVgM2/HYNHEjgtTWOCmzBfPtAZ8OjB6qk0rc ozK+C234lkx88FevJZbqZzVw59Ab2ZnV/J1z00+Gmh2oQFFVInDS/tk0OsfO1UGiIJ hEf0ThEISFF6IPK6oW017/01noZ5yTN0ew51+jstG3FY+ei6BpdIjRkvAKwo1GsLm7 L3p7OQhYdwNjGIemksY4DNVNRUB2fdx2l7PV2OPYYEoLb24xJuR9wfHZK08XnnCjQt YJUWJ7AAw+8kw== Received: from localhost (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 0F7DF17E3C68; Tue, 01 Sep 2026 20:51:15 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 01 Sep 2026 21:51:10 +0300 Subject: [PATCH v11 46/74] drm/vc4: hdmi: Convert to drmm_connector_hdmi_init() Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260901-dw-hdmi-qp-scramb-v11-46-bc12954a0688@collabora.com> References: <20260901-dw-hdmi-qp-scramb-v11-0-bc12954a0688@collabora.com> In-Reply-To: <20260901-dw-hdmi-qp-scramb-v11-0-bc12954a0688@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Chen-Yu Tsai , Samuel Holland , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Raphael Gallais-Pou , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Algea Cao , Daniel Stone , Liu Ying , Phong LE , Helge Deller Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-fbdev@vger.kernel.org X-Mailer: b4 0.15.2 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [3.34 / 15.00]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; R_DKIM_ALLOW(0.00)[collabora.com:s=mail]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; PRECEDENCE_BULK(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[34]; TAGGED_RCPT(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo,collabora.com:email,collabora.com:dkim]; RCVD_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[cristian.ciocaltea@collabora.com,linux-sunxi@lists.linux.dev]; TAGGED_FROM(0.00)[bounces-25436-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114:c]; DKIM_TRACE(0.00)[collabora.com:+]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.90.174.1:received,100.64.0.241:received,148.251.105.195:received]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; DMARC_POLICY_ALLOW(0.00)[collabora.com,none]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; FREEMAIL_TO(0.00)[linux.intel.com,kernel.org,suse.de,gmail.com,ffwll.ch,raspberrypi.com,intel.com,linaro.org,ideasonboard.com,kwiboo.se,bootlin.com,sholland.org,igalia.com,rock-chips.com,sntech.de,collabora.com,nxp.com,baylibre.com,gmx.de]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from] X-Rspamd-Queue-Id: 1B2851C15D4 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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: 162 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 Signed-off-by: Cristian Ciocaltea --- 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 */