From patchwork Fri Dec 6 10:15:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C4BDE77179 for ; Fri, 6 Dec 2024 10:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6J18swAT19ESE2KXNOUyafZB7YIIg/3RRLJcnXld7gI=; b=1jPGByidNaKOHZ fvSLvLObV8fhaZ89idJfBxr20fLz27VK3uTc4KXF1GxHLKxfil8V55DqEInhojm+2nXy+/QUPxunp HIlArRbCV3r1AJdvJ9YOI8hyth6Gh4+hFI85XzhUqjaSh4zNvXvtfef3dnpWoLWMn0MV9pZnIP9Sf rbqL0D65Rnp3SVrWWwe72Livv9FXq1op6DnlPI8eiwaI0iS0AbZ6TBYkZSr2gtaYvrElgzx5yWOOe i640Y73TAGJM4RgMwkusq/rnt5w8404NlVWbwuz9CqRum7m8UZ8U2bIaVZvhEr2ICx4pcrLkva6y5 Y+/eKeWV+xX1zgVAX3ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJVdE-00000001IsY-2vxu; Fri, 06 Dec 2024 10:32:20 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJVOB-00000001EBV-0pvB for linux-rockchip@lists.infradead.org; Fri, 06 Dec 2024 10:16:49 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53df67d6659so1827880e87.3 for ; Fri, 06 Dec 2024 02:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480205; x=1734085005; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=GMu0r/m4fzk4vy8ni1/jP/ytexs8H5s1m6UVlxoiIzM=; b=n1QlUomymX+NqArRK9NsQ8gdZh2NlWiJHc3a9rdw/m+ONeIFM9y+6Jb6kuW0a4Akaa 9l4N94u6RDPOdREXBfyj5g23T9d40KFssvvxVY3/Tku7saIbo0+B5aBTU/HFpd+4i590 z1qmmcMC8DbAwSKmDnMjVWMfPGLudYa+Cjk6ZBkxht0naFaFMFs5rFtD5qQ4EAVgMP1S 3PTzGxtZaoUHmy1ws19bZ3bSZk64aUUHZS1FJEVm/FIwqjv++U7EXvpbg40y7VLXjCtD 0c26953L4rk0LAz0c0Yqd7BBRAD9Wh7WHqbgIrVIzErJaoe7ON+VNbv/EbHViB6+PHee xZwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480205; x=1734085005; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GMu0r/m4fzk4vy8ni1/jP/ytexs8H5s1m6UVlxoiIzM=; b=DrmBKebYuPG28E2Z6QPra/HsX75WL5ugZZ3EVwwXyKbAdLViwFIorzpumh4Np0YdmB MYVq87fCw1her/qj13TKTzCnBfkcNLJ47fwGgeO1ENhqHyRPn67DOGoc0l/9lM9Pknx6 rWF458HOUQezzv7nPaAabb4EyCG9JsPf9vN/zbfOTiTVCXhi3qbolnbr+IijmF5xRI9X Z5Q8r+Ku0JW1I7pfU7tfs0UD2M95m4ZfLNCW8QJ/SsCHk4Bi9BaBZhqjxoRik9HpQnQr ryQHWoiVc7QQch1n++PZJmWOB6IeLYoRpm+vGpPLPWzussxbz7dNr03xurt0uBdToSvT 6q7w== X-Forwarded-Encrypted: i=1; AJvYcCWQsvz8bMuWShLMPX5DKnvN6u/XYWCnLnRut8BCBLW2SEm2v8LXdrg3Ci0Zo/TaM/1ELdCzTkPdjM55zv+QHQ==@lists.infradead.org X-Gm-Message-State: AOJu0Yxk9GDb3TfIng2gk3VmfDX0+7rFsj1wX9V9YvkGoN2Xl8JYQUSp 1IYa2E352oaG44O5Sg5UKWomLDeOK2BgifDmadH/g25YshZ10PVKSnQNVePeTGs= X-Gm-Gg: ASbGnctohqaEyvaTRIfcz6Ai6PEFM1pTHP4Zi8NTHT/qaLzGevrl5MErP+/cv4JP8k3 lfOfMLqN1SZwCLfO93c0TaB9AxX9B70vsfNNGCKGTwVEjgfZsAIr2aiHiG6K2mAJMH2Eo2ClrJa I83JN5gidGAsILyMBpHCzYOVbklb67fAGZIKCUGoq/TVEppMA5rgufEoAZLFUSpfY6Jpe7JZQsG WLc3v721anseU8fI2oQku0gqlsLDK764+G8tK4oI9eQ1I2ctlrv5Vp+Jw== X-Google-Smtp-Source: AGHT+IFoNdCoX9yAN9f6E4/wn97zmUD4xfv4UmC2Fb6ivX/IzUxT2UJ0tEJKhb3Ba6M0U4YvvS3rmw== X-Received: by 2002:ac2:5212:0:b0:53e:2ed9:8122 with SMTP id 2adb3069b0e04-53e2ed98271mr483370e87.22.1733480205200; Fri, 06 Dec 2024 02:16:45 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:43 -0800 (PST) From: Dmitry Baryshkov Subject: [PATCH v6 00/10] drm: add DRM HDMI Codec framework Date: Fri, 06 Dec 2024 12:15:54 +0200 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIANrOUmcC/33RwW6EIBAA0F8xnEsrICie+h9NDwjDSrJii66x2 ey/d1zTuhsTL4SBmTeBuZIBUoCB1NmVJJjCEPqIgXrJiG1NPAENDmPCc17kUuTUpY42KTi8aV0 XqO1jBDv2ieom96rkUpcCCNZ/JfBhvtsfnxi3YcC0n3uriS2nq6qYPFAnRrGp1N6WlZKm4e/nE E3qX/t0Igs78X+KsZwdURypUmjw2jjnNewo8UjpI0ogZZk03lkjq6rYUcUDxfkRVSDVFE5pp0A 0Tu8ouVH8+IFyoaRgCiruFTNP1G2dSYLvC455XAezTbnOnjpsKpwd7S4jzLQyQhshAZeqxn9Hs DEDYG7XhbHOlrouDPbtb0MjzCN2vv0C/vUs5GgCAAA= X-Change-ID: 20240530-drm-bridge-hdmi-connector-9b0f6725973e To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7229; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=X9kaSDtRP1MgSeYirvVG+XyehxBCw+87eheLybmqpYo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8IyVydnpBlAcAHh/cXorjU91qWaV7pIsj38 2HxLjH62cyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCAAKCRCLPIo+Aiko 1VNVB/98WtyAUjEWVIPrfqZFogwDMChB2E3F91aMuAO5L1y25H5WYJcPWv69B5Xc2pV2tb5JX5W VjbizeqJ4/CraKCMUGpGUGJ8O+JaYQ+ZzZQjogS4f/irTluKP5JH0gOKfBg5yTVJ6R9W0XLpUNP oUN6rEmaLqKEiNbRo040BvPDi+1wYFwg10PnBdzRXDF/Q91Uxh9wokseT7SouqP36U9jIQwTFpL 98w14nh5sW5flZ/suxJZkpFUvHHXOp0wpbk6WiVtsdL9RJFXPRrqqpO7bbTfT3idPOtTEIg3PHs UCznbLm0RFr43E4gqaM7+j9yZv1QHF6kvjzzpiuc6U6qK1cY X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241206_021647_235422_8E132F18 X-CRM114-Status: GOOD ( 19.92 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org While porting lt9611 DSI-to-HDMI bridge driver to use HDMI Connector framework, I stumbled upon an issue while handling the Audio InfoFrames. The HDMI codec callbacks weren't receiving the drm_atomic_state, so there was no simple way to get the drm_connector that stayed at the end of the bridge chain. At the same point the drm_hdmi_connector functions expected to get drm_connector instance. While looking for a way to solve the issue, I stumbled upon several deficiencies in existing hdmi_codec_ops implementations. Only few of the implementations were able to handle codec's 'plugged' callback. One third of the drivers didn't implement the get_eld() callback. Most of the issues can be solved if drm_connector handles hdmi-audio-codec on its own, delegating functionality to the actual implementation, be it a driver that implements drm_connector or drm_bridge. Implement such high-level framework, adding proper support for Audio InfoFrame generation to the LT9611 driver. Several design decisions to be kept in mind: - drm_connector_hdmi_codec is kept as simple as possible. It implements generic functionality (ELD, hotplug, registration). - drm_hdmi_connector sets up HDMI codec device if the connector is setup correspondingly (either I2S or S/PDIF is marked as supported). - drm_bridge_connector provides a way to link HDMI audio codec funcionality in the drm_bridge with the drm_connector_hdmi_codec framework. - It might be worth reverting the no_i2s_capture / no_spdif_capture bits. Only TDA889x driver sets them, while it's safe to assume that most of HDMI / DP devices do not support ARC / capture. I think the drivers should opt-in capture support rather than having to opt-out of it. This series depends on the ELD mutex series [1] [1] https://lore.kernel.org/r/20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org Signed-off-by: Dmitry Baryshkov --- Changes in v6: - Dropped extra checks on the EDID (Jani) - Reworked drmm_connector_hdmi_init(), splitting the codec init to a separate optional function rather than passing arguments through drm_connector (Maxime) - Reworked EDID update functions (Maxime, Jani) - No longer refresh the EDID in vc4_hdmi_connector_get_modes(), it is redundant as vc4_hdmi_connector_detect_cxtx() already does that. - Link to v5: https://lore.kernel.org/r/20241201-drm-bridge-hdmi-connector-v5-0-b5316e82f61a@linaro.org Changes in v5: - Moved prototypes from drm_internal.h to drm_connector_hdmi_codec_internal.h (Jani) - Rebased on top of ELD mutex series, resolving the long-standing FIXME - Converted the VC4 driver (compile-tested only) - Link to v4: https://lore.kernel.org/r/20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org Changes in v4: - Added forward declaration of struct drm_edid (LKP) - Fixed kerneldoc for drm_atomic_helper_connector_hdmi_update_edid(). - Link to v3: https://lore.kernel.org/r/20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org Changes in v3: - Dropped RFC status - Fixed drm_connector_hdmi_codec_init() kerneldoc (LKP) - Dropped double underscore prefix from __drm_atomic_helper_connector_hdmi_update_edid() (Jani) - Moved drm_edid_free() from drm_atomic_helper_connector_hdmi_update_edid() to the caller's side (Jani) - Link to v2: https://lore.kernel.org/r/20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org Changes in v2: - Use drm_atomic_get_old_connector_for_encoder in atomic_disable() to prevent it from crashing - Reworked HDMI codec init/exit, removing drmm_ calls (Maxime) - Drafted the helper to be called from .detect_ctx() that performs HDMI Connector maintenance duties (Maxime) - Moved no_capture_mute to struct hdmi_codec_pdata - Link to v1: https://lore.kernel.org/r/20240615-drm-bridge-hdmi-connector-v1-0-d59fc7865ab2@linaro.org --- Dmitry Baryshkov (10): ASoC: hdmi-codec: pass data to get_dai_id too ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata drm/connector: implement generic HDMI codec helpers drm/bridge: connector: add support for HDMI codec framework drm/bridge: lt9611: switch to using the DRM HDMI codec framework drm/display/hdmi: implement hotplug functions drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_hotplug_edid() drm/vc4: hdmi: switch to using generic HDMI Codec infrastructure drm/vc4: hdmi: stop rereading EDID in get_modes() drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug_edid() drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 3 +- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 169 ++++++++----------- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 +- drivers/gpu/drm/bridge/sii902x.c | 5 +- .../gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 3 +- drivers/gpu/drm/display/drm_bridge_connector.c | 127 +++++++++++++- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 61 +++++++ drivers/gpu/drm/drm_connector.c | 5 + drivers/gpu/drm/drm_connector_hdmi_codec.c | 185 +++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/i2c/tda998x_drv.c | 2 +- drivers/gpu/drm/mediatek/mtk_dp.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 98 ++--------- drivers/gpu/drm/vc4/vc4_hdmi.h | 2 - include/drm/display/drm_hdmi_state_helper.h | 8 + include/drm/drm_bridge.h | 38 +++++ include/drm/drm_connector.h | 80 +++++++++ include/sound/hdmi-codec.h | 7 +- sound/soc/codecs/hdmi-codec.c | 4 +- 25 files changed, 610 insertions(+), 206 deletions(-) --- base-commit: 84e541b1e58e04d808e1bb13ef566ffbe87aa89b change-id: 20240530-drm-bridge-hdmi-connector-9b0f6725973e prerequisite-change-id: 20241201-drm-connector-eld-mutex-8a39a35e9a38:v2 prerequisite-patch-id: 8373a0638371955d1a695a6253a5429c5c79ee05 prerequisite-patch-id: cd898cf6d758d05fda796b0ab685ed53d7ccd72e prerequisite-patch-id: 92115dfe744bb79f3ef0a10fc1fb3c8ef22f3bda prerequisite-patch-id: cc8334b2d881be3418f1d4d2fdea8b05776fdb73 prerequisite-patch-id: 8c6c14a1dc11e4b70ea67b25dc3d2f6ef3234160 prerequisite-patch-id: e0dbd26699df8fcde52a46a66e4ab4dc705b2c2d prerequisite-patch-id: c6ca8b52338034569c09e35061d34b277a876253 prerequisite-patch-id: 32bdfe82c8f8573fc9132395520bf6ed949b8915 prerequisite-patch-id: 865b400514c2207990c07d9f789c05e414d19fd6 prerequisite-patch-id: 0e05e8ce53477acfc686620b9e212763ad3058aa Best regards,