From patchwork Fri Nov 22 00:47:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882518 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 93B32E65D0B for ; Fri, 22 Nov 2024 00:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bJnQ0tRphnuqXv8JlNdv1AMzWLMUZZkvEPXzsxnLu/s=; b=Z1E80Iu3yWeJVQPQBPsoHLnxRV VU7IRbA6k6xTIuOW1pGioikSliozKzkKeEYbE7VWde/rs6cFrFj1RcGryj2NgNj8Pb+iY9PaSV4MI j1IJOuj01zzjOBDTNDBrhsKbQT762KgSvNynYkNECBMwWqffup5ck3d0k3e6KIf/P+rtOomPve8Vw vs15o6Ox/FLd/uU8xaPC3LyVwn/mtUCh4o5RVKbkMJGw/vvBE4J00dgSOEGVTvZ0vM1y+n0coy1rx 4T5mfO9Oqf9FO6O1/twYb3oNZO+qvSO+R4q8JdR6czCOG571Mda+EjoEeydyszPXAWw5Z+qJ6Tjj/ JB7c0WGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHrh-00000001GVC-31p6; Fri, 22 Nov 2024 00:49:41 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHpo-00000001Fut-0whx for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:45 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-539e4b7409fso1631891e87.0 for ; Thu, 21 Nov 2024 16:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236462; x=1732841262; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bJnQ0tRphnuqXv8JlNdv1AMzWLMUZZkvEPXzsxnLu/s=; b=Oiev5LmJxd/WNMZKF5C8EutfJwDTBZqBJ1YM619lPTqcMGrz31+k5oppj4zqn5/HA8 69bMWTO85BJQtXtvBIzDOpC089zlVieOmWN+zE2LrG2Ugb8DvmEwgs+xtsSy8KfWKsKm anmGQ7E57wstPn94mKFOkz2+PLSIKScEbMykMDOnhKcQ7JKRiQJUA3Y6BxMB2vy41koO vfEm5hxWUKlC2J3u0APQ7gCwhn9U9ET78AoAU1j/XgTA2O/FJk1/Cv0d0Dt7Bhkldm98 7TONvsWT0JCGa31Wpzfhqu38CC+QGf2GatXLC0+wkZ3wspN4gQ7dKEHeVXhUvJVxaixX TpdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236462; x=1732841262; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bJnQ0tRphnuqXv8JlNdv1AMzWLMUZZkvEPXzsxnLu/s=; b=Em7qk1r634f+JcNh32tOIrAodGyFiepNWRX+d/dRj+daHOkjQBBw2pAjcnxu9HnHTj wfpxGN+/qHpy7oWmTvh9UVXgTSlM/Tp+cxN4vZVqJY15pkj66K8/0mnlRLrEE7C3NsA4 s7p94BP9XAyaooAvEB5XvbYMtlhptIOYcCHyf1Tw0mW4N0P6BTfqmuS7j7Mn84n8eV15 Eid7DrNwM+lCV55T5OpmQPR3AWB4q4hfwWbGm45oMLc0eUz36aCEQFevTG7xX/RO6IlZ 6t3ZGQOzNaZhauGMouuY+B01IvPsdmz8wDAgcrgCVsFIDuQZr0zWUvx9DqOkttrA444F Q5Dg== X-Forwarded-Encrypted: i=1; AJvYcCVqH1TmbhHlCO6s8Dkiy1kMTEwH4N41tWN+QB+N4sZHUqna9FA+FDrhmJTp+FyFqWTps21moz7kCkwS9DgI6g==@lists.infradead.org X-Gm-Message-State: AOJu0Yw99CLT3fRN2Zxkr6s9Ojz02U24k4RDPazZCtBx0HznbQkImX+W al2zVOSt3fU9SveCISZwvDj63fQBUFvki8e5nduh/nMuXapsDxqea8FrvpZ15EE= X-Gm-Gg: ASbGnctBKc5a49duE6OW2P1AXpRl9GhH54RgAXefVPoyFpTlQi7y3UELzMRYodgUY71 K1SVocVqELJZrI+zsQ1D2hQ1q6F3GjklM9Ju8hXURLHEIZ7mhaSlGS5FOccoOOjRYsvUdDaJGyK EqnEpROg6d4HTufBUbxwoZuGZx46tlRbxz2iAmAGXnVs/VfwDMK1B0WvWd5bqC8k/hoS7XPGrH/ 2FQHwwNMZK4cAj0jydKbldLW6VZsRxy5+k8Z0bFddloU1yJ5e5Lsrve/g== X-Google-Smtp-Source: AGHT+IG/8gcw9tO0mI/52yh8VIeaAAyZzDyqsI74Djucy9hy39QFmFazcqdbIrJ2pfZcz+Sl5JhPdQ== X-Received: by 2002:a05:6512:31d1:b0:53d:d0a1:f544 with SMTP id 2adb3069b0e04-53dd0a1f58bmr945032e87.14.1732236462208; Thu, 21 Nov 2024 16:47:42 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:40 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:31 +0200 Subject: [PATCH v4 1/7] ASoC: hdmi-codec: pass data to get_dai_id too MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-1-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=5692; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=eQ8kIXg5Uwc5J/4F/1E4S0ElrF44S0HR7t35Q9p34ko=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7r9lRWHOeJj0xJXqGlEODEX7BI65easv2vPzJOHn93e0 R+762pTJ6MxCwMjF4OsmCKLT0HL1JhNyWEfdkythxnEygQyhYGLUwAmkrmW/b/Lz59n5s88JK4R XSpdkiO50je7/9HHN3vZGFPuP/n2bv+3qJZFGuqr3y6q3M60Run8/b8vpNhuNYaH5a6/7lAXyD/ b6taTL8VOLLGxm0q/nencxtdp9jDSq+da2zG+wr9aWxW7nCIkoqTann3btIm9eU9DaKTEzq//ej SEPbQynCrl95g8eH43acLd9P9yBrFWSt+93fUsTdpPMdyfyu+952XFHjv19uSi+MU5edc0MtgsY qaev2TE5q5Q9Uz8sYCya6579MK7/fafZtaFPbLw6l2movxpI6vBzPqkWLsoFSmP1/4npmfXbz/3 XFAmNe18maG84EWOzSVa3963MrmnVxRIiJfuWpcqWhkJAA== 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-20241121_164744_263937_6FF9315F X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The upcoming DRM connector HDMI codec implementation is going to use codec-specific data in the .get_dai_id to get drm_connector. Pass data to the callback, as it is done with other hdmi_codec_ops callbacks. Acked-by: Mark Brown Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 3 ++- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 ++- drivers/gpu/drm/bridge/sii902x.c | 3 ++- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 3 ++- include/sound/hdmi-codec.h | 3 ++- sound/soc/codecs/hdmi-codec.c | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c index 61f4a38e7d2bf6905683cbc9e762b28ecc999d05..51fb9a574b4e28450b2598a92e2930ace5128b71 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c @@ -204,7 +204,8 @@ static void audio_shutdown(struct device *dev, void *data) } static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index a2675b121fe44b96945f34215fd900f35bfde43a..926437346b6c9a651d495faf25162cac7407d30d 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1952,7 +1952,8 @@ static void anx7625_audio_shutdown(struct device *dev, void *data) } static int anx7625_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 8f25b338a8d8f95dc0691735ac6343675098f7f7..6bc1b2476847c3bccbbf9874bb384c1f60674da6 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -1059,7 +1059,8 @@ static void lt9611_audio_shutdown(struct device *dev, void *data) } static int lt9611_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index f89af8203c9d67cb05b629b27f66cf996baedd16..77bc09b875323d88f7346db9d24ea89a355c99b1 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -522,7 +522,8 @@ static void lt9611uxc_audio_shutdown(struct device *dev, void *data) } static int lt9611uxc_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 9be9cc5b902594ebe6e1ac29ab8684623e336796..f0be803cc2274ca2199ed7661cf752b0a91434b6 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -815,7 +815,8 @@ static int sii902x_audio_get_eld(struct device *dev, void *data, } static int sii902x_audio_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index 26c187d20d973dc65801a3baa59ecf57d20072eb..86c412e9cbc80bb82bad5db3aa0263a7acd9c2d7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -148,7 +148,8 @@ static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, } static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) + struct device_node *endpoint, + void *data) { struct of_endpoint of_ep; int ret; diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 5e1a9eafd10f5d4f831abbb6f4c0fff661909584..b3407b47b4a7878532ecf3b08eeecd443d6fdb07 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -105,7 +105,8 @@ struct hdmi_codec_ops { * Optional */ int (*get_dai_id)(struct snd_soc_component *comment, - struct device_node *endpoint); + struct device_node *endpoint, + void *data); /* * Hook callback function to handle connector plug event. diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 74caae52e1273fda45ab8dd079ae800827f0231f..abd7c9b0fda9ee6fa6c4efde1f583af667716611 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -981,7 +981,7 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ if (hcp->hcd.ops->get_dai_id) - ret = hcp->hcd.ops->get_dai_id(component, endpoint); + ret = hcp->hcd.ops->get_dai_id(component, endpoint, hcp->hcd.data); return ret; } From patchwork Fri Nov 22 00:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882519 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 54A13E65D0B for ; Fri, 22 Nov 2024 00:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ak8gRHgoBR7wXxN3OTsHJhxEAFWfUvaDSuz/ZDqmUPU=; b=23TyImM6PpfBrkFJcGVBlHbuUB hRwUecaC4M7jQ6cEnxYUHwON+lzG2tDa8msDBGOSXEotI7maD/4QDRbozfRhZCitUYjj8WrXBDhq9 pM8cRdnghT6A/o6uXYR5SeNezCMm3hS7svnAt0rIhjsoqK76lDj8z7HP8rzLycvDGfpPTRkR7SV7p zTSMlZDuAH8OW77VPv70cGN1P1F0lzGTZiGLi+GzJom4s0qZGosZKvpSisM1QSlTemvk/anTzAmFY 7OJrPKRxgLDcL5iDNqT3U7WYYdoM2jR421JYmsfqkducjB4WlrWwI5b/qagTj92VZWkH2eTfFgLhS TN0euPIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHsd-00000001GgW-1XH8; Fri, 22 Nov 2024 00:50:39 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHpq-00000001FwI-3Wxs for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:49 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2fb5fa911aaso27991951fa.2 for ; Thu, 21 Nov 2024 16:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236465; x=1732841265; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Ak8gRHgoBR7wXxN3OTsHJhxEAFWfUvaDSuz/ZDqmUPU=; b=c+MM9HbQqqjOBAnWHcxpjncRG67TWpVJmiTO/WpvXtNTx46AIdCxQ2j8kdiFbgXvYU X2igUBdSuRxiYzxvGQQuQG/znqVzmJgkh9np6nF9lklD2BQB0/MmhxprbcfmooLcRuCX fuK9IA3nSZeSaGl0KgnNwgN1GDCQ4QAcfYshnYbM9CZThOJBMv4Yk1lUEZIz2qMVrqBE tRNd6Vt2iGoQWcD47AHF3olTxF9UrI3yeNnvya9dLmRqAUZeVEssE+RXrerB9GpmyeEb 2Twle2/1aKabyGmODiLIcSKtBgWCLmEcQXvXe1Pt9AYTunt1sRw5BKFKQUOFvZATPicB Zbqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236465; x=1732841265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ak8gRHgoBR7wXxN3OTsHJhxEAFWfUvaDSuz/ZDqmUPU=; b=Cgm70+R5EVEmD6YnBej9W4PxlL3dtctfuoi2RDfjxv1x40VIdoPRW96SjX73HgToHS Ojr4jX378+im08KeyU6BNKZjI8VY7H1JTKiqB3MjxX+E8pVQL2qAlLy26OUsuEXiLTuB zb4rSjJTdJgpsbR7TfxrKIeyM2rhEtkjhi4fHE1A4bl0jNNzIXw0V0T5UsAypNqnbZlO s30CRkB6HPQ4/hMYY4MHuDa+QYtiXAm32rYPcTWASI/+Ec5oJvTu9P8aclbX+9MrNTfc m+GHwOHAVlwky637fXy9pd2IEvklqeKlkgzzZtCxuIq2TpPYp6hAsJ9ABPowYNE8tp3+ 7kgw== X-Forwarded-Encrypted: i=1; AJvYcCWVWkDrjOjDssRGK+KvyYJIREEwawanMILYd0L/nQlvPQB7oKhxeDWQLJNy5AhiHmDV2TaXxrvIWtqdU332xQ==@lists.infradead.org X-Gm-Message-State: AOJu0YyaGHASBCd1InzEMKvvw3qTfCBKw0h99UDt5iHT8fnm7qWbakYR hktVqNN/DjQ2ttmrXfz1tGta2VqpY/+HH5bXCG+fQ50IN4VxYn7PhldH0/buLbc= X-Gm-Gg: ASbGnct4p255nEvb3BHtwU494u2yN4PJUJNQUZzLZ0ND/dF+ho8C6Koq3oT5ENGS2VW 6JybZqTarr2s7eR5pxTsmkQG4iEpXXdVeFbdDYZTYlTH0zkn/ah2hZ+07hNCzzouB053yETqVxq NEDoEBEJJj8PJhV9bCXopwOSH3FP1KJ1HICyOL8neh0TfZ0iQ709dBMuukUASJSakwuVgF1T9J9 Q8iv6tkpCCAFJhPqtGzO/+5jPBv82R49+lJtJZ+Zk4K4Uisn0si6a2Gvw== X-Google-Smtp-Source: AGHT+IGmZbXKNzuaVctS0Pej9crIvWrOV7VdQgJgHI3Iy10PqIaNo/7gHPJCX3fH8j0NUWfmoyf6NA== X-Received: by 2002:a05:651c:985:b0:2ff:95d7:9ed2 with SMTP id 38308e7fff4ca-2ffa716ed4fmr6047761fa.32.1732236464826; Thu, 21 Nov 2024 16:47:44 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:43 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:32 +0200 Subject: [PATCH v4 2/7] ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-2-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=8709; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=QgvPV95aCKZk0jjfModEdw/2ZuJp4AQ4+MiWPaLAiFs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoX/WmdVL8hw73RcqrNT84gccFs0OOWDEXZ w3h4HUZ23+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1QMmB/0dJ0r46o68jwO2QWL6u3ieZBudls3bPrbQFSj3kdlVf4OzvJiHRbz3uIg+R6fVdURhqax 40uuRhOaV/URnc2TQK1U/JprQosppitU8ihj6YuNOIe2Z9OUE4afZhKnTeWFAROF/nPrWAQuupM Z8ZwVvXukodqTzRDxbLTrGa0bZ5gILu71rza7D4pXqkg/wZErRmQ/ewRVaaXMk+phLcwGB5Q0Wp 9wcLj4k2+2xuYvYFkB4DZstDx0s+cbvFRt3gpodNiEpHRaeY0/oMhKcvgXL/kpOl6P9XX9qGSJV qrX/rlQv98PaJj4uN8xLqNNFKmSTFTNR4RX6rby8CFsrYTpL 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-20241121_164747_416900_A86287C4 X-CRM114-Status: GOOD ( 15.09 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The no_capture_mute flag might differ from platform to platform, especially in the case of the wrapping implementations, like the upcoming DRM HDMI Codec framework. Move the flag next to all other flags in struct hdmi_codec_pdata. Acked-by: Mark Brown Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- drivers/gpu/drm/bridge/sii902x.c | 2 +- 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 +- include/sound/hdmi-codec.h | 4 +--- sound/soc/codecs/hdmi-codec.c | 2 +- 10 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 35ae3f0e8f51f768229e055a086b53a419ffcd9f..98669470d1e955fef36bb4592795fed6ca97139c 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1464,7 +1464,6 @@ static const struct hdmi_codec_ops it66121_audio_codec_ops = { .audio_shutdown = it66121_audio_shutdown, .mute_stream = it66121_audio_mute, .get_eld = it66121_audio_get_eld, - .no_capture_mute = 1, }; static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device *dev) @@ -1474,6 +1473,7 @@ static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device *dev) .i2s = 1, /* Only i2s support for now */ .spdif = 0, .max_i2s_channels = 8, + .no_capture_mute = 1, }; dev_dbg(dev, "%s\n", __func__); diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index f0be803cc2274ca2199ed7661cf752b0a91434b6..5248676b0036a7e8f2142bd2f099c36efb529471 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -841,7 +841,6 @@ static const struct hdmi_codec_ops sii902x_audio_codec_ops = { .mute_stream = sii902x_audio_mute, .get_eld = sii902x_audio_get_eld, .get_dai_id = sii902x_audio_get_dai_id, - .no_capture_mute = 1, }; static int sii902x_audio_codec_init(struct sii902x *sii902x, @@ -864,6 +863,7 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x, .i2s = 1, /* Only i2s support for now. */ .spdif = 0, .max_i2s_channels = 0, + .no_capture_mute = 1, }; u8 lanes[4]; int num_lanes, i; diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c9d4b9146df95bb46cb6bea4849c331616c2b463..2a74396ac846dc34d87fadea700c387d597ba307 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1658,7 +1658,6 @@ static const struct hdmi_codec_ops audio_codec_ops = { .audio_shutdown = hdmi_audio_shutdown, .mute_stream = hdmi_audio_mute, .get_eld = hdmi_audio_get_eld, - .no_capture_mute = 1, }; static int hdmi_register_audio_device(struct hdmi_context *hdata) @@ -1667,6 +1666,7 @@ static int hdmi_register_audio_device(struct hdmi_context *hdata) .ops = &audio_codec_ops, .max_i2s_channels = 6, .i2s = 1, + .no_capture_mute = 1, }; hdata->audio.pdev = platform_device_register_data( diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 2160f05bbd16d2346e27365e5549b75ad26fdcb9..10a4195d667ff577183788f8fc7ca806660e2b9c 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1165,7 +1165,6 @@ static const struct hdmi_codec_ops audio_codec_ops = { .audio_shutdown = tda998x_audio_shutdown, .mute_stream = tda998x_audio_mute_stream, .get_eld = tda998x_audio_get_eld, - .no_capture_mute = 1, }; static int tda998x_audio_codec_init(struct tda998x_priv *priv, @@ -1176,6 +1175,7 @@ static int tda998x_audio_codec_init(struct tda998x_priv *priv, .max_i2s_channels = 2, .no_i2s_capture = 1, .no_spdif_capture = 1, + .no_capture_mute = 1, }; if (priv->audio_port_enable[AUDIO_ROUTE_I2S]) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 1cc916b164713d71461a0b2ad370032a14604be6..6a42459792ec75692fadb45a75b138fc43cc37a2 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2615,7 +2615,6 @@ static const struct hdmi_codec_ops mtk_dp_audio_codec_ops = { .audio_shutdown = mtk_dp_audio_shutdown, .get_eld = mtk_dp_audio_get_eld, .hook_plugged_cb = mtk_dp_audio_hook_plugged_cb, - .no_capture_mute = 1, }; static int mtk_dp_register_audio_driver(struct device *dev) @@ -2626,6 +2625,7 @@ static int mtk_dp_register_audio_driver(struct device *dev) .max_i2s_channels = 8, .i2s = 1, .data = mtk_dp, + .no_capture_mute = 1, }; mtk_dp->audio_pdev = platform_device_register_data(dev, diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 7687f673964ec7df0d76328a43ed76d71b192350..a4b144b3bda8362a6c6c303723c6d3eef9ca338e 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1660,7 +1660,6 @@ static const struct hdmi_codec_ops mtk_hdmi_audio_codec_ops = { .mute_stream = mtk_hdmi_audio_mute, .get_eld = mtk_hdmi_audio_get_eld, .hook_plugged_cb = mtk_hdmi_audio_hook_plugged_cb, - .no_capture_mute = 1, }; static int mtk_hdmi_register_audio_driver(struct device *dev) @@ -1671,6 +1670,7 @@ static int mtk_hdmi_register_audio_driver(struct device *dev) .max_i2s_channels = 2, .i2s = 1, .data = hdmi, + .no_capture_mute = 1, }; struct platform_device *pdev; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index f576b1aa86d1434d75b3770e08d91537aca4f5c4..5c2c124a7a38fbadaec554f08797020260e29045 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -885,7 +885,6 @@ static const struct hdmi_codec_ops audio_codec_ops = { .mute_stream = cdn_dp_audio_mute_stream, .get_eld = cdn_dp_audio_get_eld, .hook_plugged_cb = cdn_dp_audio_hook_plugged_cb, - .no_capture_mute = 1, }; static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp, @@ -896,6 +895,7 @@ static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp, .spdif = 1, .ops = &audio_codec_ops, .max_i2s_channels = 8, + .no_capture_mute = 1, }; dp->audio_pdev = platform_device_register_data( diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 847470f747c0efad61c2ebdc3fb3746a7a13a863..dfb8e2887fae10cf3275e8f8427f39279982c5e6 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1235,7 +1235,6 @@ static const struct hdmi_codec_ops audio_codec_ops = { .audio_shutdown = hdmi_audio_shutdown, .mute_stream = hdmi_audio_mute, .get_eld = hdmi_audio_get_eld, - .no_capture_mute = 1, }; static int sti_hdmi_register_audio_driver(struct device *dev, @@ -1245,6 +1244,7 @@ static int sti_hdmi_register_audio_driver(struct device *dev, .ops = &audio_codec_ops, .max_i2s_channels = 8, .i2s = 1, + .no_capture_mute = 1, }; DRM_DEBUG_DRIVER("\n"); diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index b3407b47b4a7878532ecf3b08eeecd443d6fdb07..b220072cfa1baf503efbe2d530d7e8392dc16603 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -115,9 +115,6 @@ struct hdmi_codec_ops { int (*hook_plugged_cb)(struct device *dev, void *data, hdmi_codec_plugged_cb fn, struct device *codec_dev); - - /* bit field */ - unsigned int no_capture_mute:1; }; /* HDMI codec initalization data */ @@ -129,6 +126,7 @@ struct hdmi_codec_pdata { uint spdif:1; uint no_spdif_playback:1; uint no_spdif_capture:1; + uint no_capture_mute:1; int max_i2s_channels; void *data; }; diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index abd7c9b0fda9ee6fa6c4efde1f583af667716611..e8aac8069587785bcd2bd09b5f9e0140304fb8fb 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -700,7 +700,7 @@ static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction) */ if (hcp->hcd.ops->mute_stream && (direction == SNDRV_PCM_STREAM_PLAYBACK || - !hcp->hcd.ops->no_capture_mute)) + !hcp->hcd.no_capture_mute)) return hcp->hcd.ops->mute_stream(dai->dev->parent, hcp->hcd.data, mute, direction); From patchwork Fri Nov 22 00:47:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882520 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 3871AE65D0A for ; Fri, 22 Nov 2024 00:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kUsRn0052tIDeO/cBuLCGWRoGXp1tAzW+Qpn79ZJEc0=; b=s73oKz4m/JYECjVQ/T0ACyW2B7 MeLLAWOHH4UqsAxwcfs3xw1r8fKjAm3s17/R24KZOyqXiMLHpFPb8zmF920fIGoAv6XgH7nUxAnUm 43zTw5PLW5aHpaelRyRqaXSbhIF4Ze2G+GVCQR+CXtHA273WB+CynLaCTsWajXgMdMw721sbqrLqF /DQ91Slx83UtGgc5hnIvOjoE9dzb6BdY6PBxdUUGNYpirE5LWygSxxfKq1Jt1wuUhl5uS7Ul67qY+ dsDK5ixox0ZE8IPyKSMFNr56n20Hpjcvqgu8bRd9E4vYvWDGYGD4MXeuCkk66uJU8/4dgolPLq0Jd JjNIPYJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHtX-00000001Gnk-1MIZ; Fri, 22 Nov 2024 00:51:35 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHpt-00000001FyD-2eD3 for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:50 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ff99b5ede4so14925831fa.1 for ; Thu, 21 Nov 2024 16:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236468; x=1732841268; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kUsRn0052tIDeO/cBuLCGWRoGXp1tAzW+Qpn79ZJEc0=; b=vlISbo8lMmRdR1HTK9riu7J7CPYEqIlcKj7onTMmVP/VVhX+/52NLCBN/NkWa6pxw3 i4v+IBmHsowkCcRNmaTe5/YMaTCtUuVS2iacgv0jCjFzItIaEHwZylVhVDk5fkpUppbM qxbGd0yUdb8bhgJJDmLMmwCHzmxgRvW4fpDGOHJKYPD0H1wIHgHQh4mgtLeMLZB/5Q0z v6v9DdgoHOapRcPJ668nDXB8owfTTBbt4RYPA0t/umjaRAzlbOrFDj7w/Nj9JQQ/DNlI bkZlSggzXtdYQbSfCT2A1rH3sxBDH1FJvtohfKKnnlaP4XuKiy3iuBQ0kjDZ6vvMEpcj /dHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236468; x=1732841268; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kUsRn0052tIDeO/cBuLCGWRoGXp1tAzW+Qpn79ZJEc0=; b=ZSdp+/JAEIfcPmvNYZb0z88xkgDfWzkFAuvXjJShOdHD1J2SbnkF0AUnAglLFNUQ88 J5JZ6haz8RMQ5GUGflr2v6ofprSKwtuF8u60Gh94i6HQpmKdLV+aka6bI3HusySBLYNJ HjB23C1IIta+TLbE1RE0wU9IRSRkDNlB8PQG4qelbUvb/PRF4sqe+fAAAB9kHQkmVkvQ U6gfldikzSnCn4bSMIF2TFC8W++gc2fzHIg3yPF67onnPjlb3QArk3K6HfuKdtA1c7Eo iXgre7odkAdMzBRgnFh5+MSAgRcYvkq6WoVxJghFRPfUUAztYuIDDufv3z2oygidGRtS 9jSw== X-Forwarded-Encrypted: i=1; AJvYcCXxa68QMS8Ba6HDKy/2Xf15sBIeY3jLNNk3dipKkAjU+5I+Xw/4xEm5csI1+ucoM53GNjUpvwzTNIKKQySDug==@lists.infradead.org X-Gm-Message-State: AOJu0Yz4AsEUyKJipBJCK+PuweYpE6Q5Dddd/5Z6bjrdV1z+a6IqDCUa ZA6AIs8+QxYJ7nRLJxlPmnXpRpRntFVkE3IScozSrqU/tEISL+sBvTR9eDz7sKE= X-Gm-Gg: ASbGncsrGpG/GMlyJxecVuxvfvnvziKPDmoNd7tiKstngmUm7b8J4wFiKcxO0HXM8gk yZU3L1HbQ1t5/5oT3HXbxUSNr/KTHhH3Ko2/KeCUCoM5YpZ2BBhSZevdvopOElfkuKdGtMjrmr2 b762Q44KojpcOboj8o2c7o9uVBit6BfQseWRnCOfjwBPvrN2/z43/N8pbxZA5I7zYsxxRzGb/wd Td6clWi3wtiQtMl7Xns/qIm0US9aSWVJXetvtucbKfT0KI3fi2SM3RI1g== X-Google-Smtp-Source: AGHT+IH0ngFsUmrHxVFXRYZ8IQTN2xYiOvGwCUNgKSsisACK/yWk3bJkWF/S2L9Vmlglv32JfDmhqg== X-Received: by 2002:a2e:8809:0:b0:2ff:a7cd:ef7c with SMTP id 38308e7fff4ca-2ffa7cdf066mr1168911fa.17.1732236467533; Thu, 21 Nov 2024 16:47:47 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:46 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:33 +0200 Subject: [PATCH v4 3/7] drm/connector: implement generic HDMI codec helpers MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-3-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=12999; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=m9zfJO4BshYapRasGcJd4L8a7HQu0P+fqRupSDJ+fRk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoviORIVo7TBWsSstKi+38c7+SpUj8oiIQE 9oEECNhQViJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1XTwCACp0JnCB0kVzW01osJCn4CmwoLmqtPHBi6DbWqXGiRIsVW6mxsF3UGofNWR+ZG+U8ye+u+ TxyANB46vZR8DSG9DngHzY78xPC+zvLnnbkI78iRHQzKVdeA4jyVo4pZTO2QMO1m4JrVKHGq+5o OznpDfQTusMKV37P9UkX2sAa9vHDEFSnoSRzeLzd3pGc+DSO2MGDBlcPKf2ZCoQKTiXeTDa4yhz G1TnDvVp1dkUj7MrxxiLigrsmIQl18wfc5kcfJk/txmi9EAtU11aTrMg95Esi3Pt3TGP9dR1u4q AF+igFZD712+/RnQ/xsTAIo4kCRcDBnpztxJm2ZkyOPP4lXt 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-20241121_164749_700918_39F4328E X-CRM114-Status: GOOD ( 23.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Several DRM drivers implement HDMI codec support (despite its name it applies to both HDMI and DisplayPort drivers). Implement generic framework to be used by these drivers. This removes a requirement to implement get_eld() callback and provides default implementation for codec's plug handling. The framework is integrated with the DRM HDMI Connector framework, but can be used by DisplayPort drivers. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_connector.c | 10 ++ drivers/gpu/drm/drm_connector_hdmi_codec.c | 186 +++++++++++++++++++++++++++++ drivers/gpu/drm/drm_internal.h | 5 + include/drm/drm_connector.h | 80 +++++++++++++ 5 files changed, 282 insertions(+) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1677c1f335fbb0c6114bdb4cc0b12eb407d84564..afdd9268ca23ac7602e73bbe45f3f9cd090a3afd 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -42,6 +42,7 @@ drm-y := \ drm_cache.o \ drm_color_mgmt.o \ drm_connector.o \ + drm_connector_hdmi_codec.o \ drm_crtc.o \ drm_displayid.o \ drm_drv.o \ diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index fc35f47e2849ed6786d6223ac9c69e1c359fc648..1a155a9fb401f687e5a88e72faca1e81d944b6d2 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -279,6 +279,7 @@ static int __drm_connector_init(struct drm_device *dev, mutex_init(&connector->mutex); mutex_init(&connector->edid_override_mutex); mutex_init(&connector->hdmi.infoframes.lock); + mutex_init(&connector->hdmi_codec.lock); connector->edid_blob_ptr = NULL; connector->epoch_counter = 0; connector->tile_blob_ptr = NULL; @@ -533,6 +534,12 @@ int drmm_connector_hdmi_init(struct drm_device *dev, connector->hdmi.funcs = hdmi_funcs; + if (connector->hdmi_codec.i2s || connector->hdmi_codec.spdif) { + ret = drm_connector_hdmi_codec_init(connector); + if (ret) + return ret; + } + return 0; } EXPORT_SYMBOL(drmm_connector_hdmi_init); @@ -631,6 +638,8 @@ void drm_connector_cleanup(struct drm_connector *connector) DRM_CONNECTOR_REGISTERED)) drm_connector_unregister(connector); + drm_connector_hdmi_codec_cleanup(connector); + if (connector->privacy_screen) { drm_privacy_screen_put(connector->privacy_screen); connector->privacy_screen = NULL; @@ -669,6 +678,7 @@ void drm_connector_cleanup(struct drm_connector *connector) connector->funcs->atomic_destroy_state(connector, connector->state); + mutex_destroy(&connector->hdmi_codec.lock); mutex_destroy(&connector->hdmi.infoframes.lock); mutex_destroy(&connector->mutex); diff --git a/drivers/gpu/drm/drm_connector_hdmi_codec.c b/drivers/gpu/drm/drm_connector_hdmi_codec.c new file mode 100644 index 0000000000000000000000000000000000000000..e362852c186109644e9033eb8eaf63b864166d5a --- /dev/null +++ b/drivers/gpu/drm/drm_connector_hdmi_codec.c @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright (c) 2024 Linaro Ltd + */ + +#include +#include +#include + +#include +#include + +#include + +#include "drm_internal.h" + +static int drm_connector_hdmi_codec_audio_startup(struct device *dev, void *data) +{ + struct drm_connector *connector = data; + const struct drm_connector_hdmi_codec_funcs *funcs = + connector->hdmi.funcs->codec_funcs; + + if (funcs->audio_startup) + return funcs->audio_startup(connector); + + return 0; +} + +static int drm_connector_hdmi_codec_prepare(struct device *dev, void *data, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms) +{ + struct drm_connector *connector = data; + const struct drm_connector_hdmi_codec_funcs *funcs = + connector->hdmi.funcs->codec_funcs; + + return funcs->prepare(connector, fmt, hparms); +} + +static void drm_connector_hdmi_codec_audio_shutdown(struct device *dev, void *data) +{ + struct drm_connector *connector = data; + const struct drm_connector_hdmi_codec_funcs *funcs = + connector->hdmi.funcs->codec_funcs; + + return funcs->audio_shutdown(connector); +} + +static int drm_connector_hdmi_codec_mute_stream(struct device *dev, void *data, + bool enable, int direction) +{ + struct drm_connector *connector = data; + const struct drm_connector_hdmi_codec_funcs *funcs = + connector->hdmi.funcs->codec_funcs; + + if (funcs->mute_stream) + return funcs->mute_stream(connector, enable, direction); + + return -ENOTSUPP; +} + +static int drm_connector_hdmi_codec_get_dai_id(struct snd_soc_component *comment, + struct device_node *endpoint, + void *data) +{ + struct drm_connector *connector = data; + struct of_endpoint of_ep; + int ret; + + if (connector->hdmi_codec.sound_dai_port < 0) + return -ENOTSUPP; + + ret = of_graph_parse_endpoint(endpoint, &of_ep); + if (ret < 0) + return ret; + + if (of_ep.port == connector->hdmi_codec.sound_dai_port) + return 0; + + return -EINVAL; +} + +static int drm_connector_hdmi_codec_get_eld(struct device *dev, void *data, + uint8_t *buf, size_t len) +{ + struct drm_connector *connector = data; + + // FIXME: locking against drm_edid_to_eld ? + memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); + + return 0; +} + +static int drm_connector_hdmi_codec_hook_plugged_cb(struct device *dev, + void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct drm_connector *connector = data; + + mutex_lock(&connector->hdmi_codec.lock); + + connector->hdmi_codec.plugged_cb = fn; + connector->hdmi_codec.plugged_cb_dev = codec_dev; + + fn(codec_dev, connector->hdmi_codec.last_state); + + mutex_unlock(&connector->hdmi_codec.lock); + + return 0; +} + +void drm_connector_hdmi_codec_plugged_notify(struct drm_connector *connector, + bool plugged) +{ + mutex_lock(&connector->hdmi_codec.lock); + + connector->hdmi_codec.last_state = plugged; + + if (connector->hdmi_codec.plugged_cb && + connector->hdmi_codec.plugged_cb_dev) + connector->hdmi_codec.plugged_cb(connector->hdmi_codec.plugged_cb_dev, + connector->hdmi_codec.last_state); + + mutex_unlock(&connector->hdmi_codec.lock); +} +EXPORT_SYMBOL(drm_connector_hdmi_codec_plugged_notify); + +static const struct hdmi_codec_ops drm_connector_hdmi_codec_ops = { + .audio_startup = drm_connector_hdmi_codec_audio_startup, + .prepare = drm_connector_hdmi_codec_prepare, + .audio_shutdown = drm_connector_hdmi_codec_audio_shutdown, + .mute_stream = drm_connector_hdmi_codec_mute_stream, + .get_eld = drm_connector_hdmi_codec_get_eld, + .get_dai_id = drm_connector_hdmi_codec_get_dai_id, + .hook_plugged_cb = drm_connector_hdmi_codec_hook_plugged_cb, +}; + +/** + * drm_connector_hdmi_codec_cleanup - Cleanup the HDMI Codec for the connector + * @connector: A pointer to the connector to cleanup + * + * Cleanup the HDMI codec device created for the specified connector. + * Can be called even if the codec wasn't allocated. + */ +void drm_connector_hdmi_codec_cleanup(struct drm_connector *connector) +{ + platform_device_unregister(connector->hdmi_codec.codec_pdev); +} + +/** + * drm_connector_hdmi_codec_init - Initialize HDMI Codec device for the DRM connector + * @connector: A pointer to the connector to allocate codec for + * + * Create a HDMI codec device to be used with the specified connector. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_connector_hdmi_codec_init(struct drm_connector *connector) +{ + struct hdmi_codec_pdata codec_pdata = {}; + struct platform_device *pdev; + + if (!connector->hdmi.funcs->codec_funcs->prepare || + !connector->hdmi.funcs->codec_funcs->audio_shutdown || + !connector->hdmi_codec.dev) + return -EINVAL; + + codec_pdata.ops = &drm_connector_hdmi_codec_ops; + codec_pdata.i2s = connector->hdmi_codec.i2s, + codec_pdata.spdif = connector->hdmi_codec.spdif, + codec_pdata.max_i2s_channels = connector->hdmi_codec.max_i2s_channels, + codec_pdata.data = connector; + + pdev = platform_device_register_data(connector->hdmi_codec.dev, + HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_AUTO, + &codec_pdata, sizeof(codec_pdata)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + connector->hdmi_codec.codec_pdev = pdev; + + return 0; +} diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index b2b6a8e49dda46f1cb3b048ef7b28356dd3aaa4e..8ed58e482fac4662b659276e8bc17690e1fdb9b7 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -280,4 +280,9 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, const struct drm_framebuffer *fb); void drm_framebuffer_debugfs_init(struct drm_device *dev); +/* drm_connector_hdmi_codec.c */ + +int drm_connector_hdmi_codec_init(struct drm_connector *connector); +void drm_connector_hdmi_codec_cleanup(struct drm_connector *connector); + #endif /* __DRM_INTERNAL_H__ */ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index e3fa43291f449d70f3b92a00985336c4f2237bc6..b89f791cfa2be86ce1c5aa124c0f071d7c8a6489 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -46,6 +46,8 @@ struct drm_property_blob; struct drm_printer; struct drm_privacy_screen; struct edid; +struct hdmi_codec_daifmt; +struct hdmi_codec_params; struct i2c_adapter; enum drm_connector_force { @@ -1141,6 +1143,52 @@ struct drm_connector_state { struct drm_connector_hdmi_state hdmi; }; +struct drm_connector_hdmi_codec_funcs { + /** + * @audio_startup: + * + * Called when ASoC starts an audio stream setup. The + * @hdmi_audio_startup is optional. + * + * Returns: + * 0 on success, a negative error code otherwise + */ + int (*audio_startup)(struct drm_connector *connector); + + /** + * @prepare: + * Configures HDMI-encoder for audio stream. Can be called + * multiple times for each setup. Mandatory. + * + * Returns: + * 0 on success, a negative error code otherwise + */ + int (*prepare)(struct drm_connector *connector, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms); + /** + * @audio_shutdown: + * + * Shut down the audio stream. Mandatory. + * + * Returns: + * 0 on success, a negative error code otherwise + */ + void (*audio_shutdown)(struct drm_connector *connector); + + /** + * @mute_stream: + * + * Mute/unmute HDMI audio stream. The @mute_stream callback is + * optional. + * + * Returns: + * 0 on success, a negative error code otherwise + */ + int (*mute_stream)(struct drm_connector *connector, + bool enable, int direction); +}; + /** * struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions */ @@ -1198,6 +1246,14 @@ struct drm_connector_hdmi_funcs { int (*write_infoframe)(struct drm_connector *connector, enum hdmi_infoframe_type type, const u8 *buffer, size_t len); + + /** + * @codec_funcs: + * + * Implementation of the HDMI codec functionality to be used by the DRM + * HDMI Codec framework. + */ + const struct drm_connector_hdmi_codec_funcs *codec_funcs; }; /** @@ -1660,6 +1716,22 @@ struct drm_cmdline_mode { bool tv_mode_specified; }; +struct drm_connector_hdmi_codec { + struct platform_device *codec_pdev; + struct device *dev; + + struct mutex lock; /* protects last_state and plugged_cb */ + void (*plugged_cb)(struct device *dev, bool plugged); + struct device *plugged_cb_dev; + bool last_state; + + int max_i2s_channels; + uint i2s: 1; + uint spdif: 1; + + int sound_dai_port; +}; + /* * struct drm_connector_hdmi - DRM Connector HDMI-related structure */ @@ -2118,6 +2190,11 @@ struct drm_connector { * @hdmi: HDMI-related variable and properties. */ struct drm_connector_hdmi hdmi; + + /** + * @hdmi_codec: HDMI codec properties and non-DRM state. + */ + struct drm_connector_hdmi_codec hdmi_codec; }; #define obj_to_connector(x) container_of(x, struct drm_connector, base) @@ -2151,6 +2228,9 @@ void drm_connector_unregister(struct drm_connector *connector); int drm_connector_attach_encoder(struct drm_connector *connector, struct drm_encoder *encoder); +void drm_connector_hdmi_codec_plugged_notify(struct drm_connector *connector, + bool plugged); + void drm_connector_cleanup(struct drm_connector *connector); static inline unsigned int drm_connector_index(const struct drm_connector *connector) From patchwork Fri Nov 22 00:47:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882521 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 6D2FFE65D0D for ; Fri, 22 Nov 2024 00:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=Dnx8ktVFdJ1EJM/B5T/3V3ItC3 Rpvz5wrBXkfJQpBIcIpV/GQ+k7S8ZuOymsflVxxDqfFUXunKhlOIjsixRbONIKb/rhe3hSpnCwfvt K739WK3U8I1dS/3SYiByLAEI3fIYa/+5gKB98cQAlivz/dc+BXQ8Goc6N1Jm0zHs2TqxP6kJsXkGq DJnXaE5WkR19VPjW9TFOAJ2ZNyk8cGkwM6tCOkM1UequiVc7GxLFqiKOi+pJQ8V93rF8sd04rDzJS UI+uoEFbIZsIBVcBY+DQcqvsrxEnV77nE0vxV3x0t2DnTrz7+sX1oap0FBD2ZMx6JsCaiUio6+SZG xsc/Z42Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHtY-00000001Got-1mdh; Fri, 22 Nov 2024 00:51:36 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHpw-00000001G0o-0IA4 for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:53 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2fb5743074bso13559851fa.1 for ; Thu, 21 Nov 2024 16:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236470; x=1732841270; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=ZqhGatcYs9BViTo7RZHFibl8QP5QbrA+h3Cao+PAmqjaS/lxTV8fNRCPuaXVIlxM5/ ANS+8xrsomfzXx6ZLGwMOza2v2TU6LMEVpJhiny8LLzrqqOq3TgLPY1g640rL1Bn+feY 2h1Z/31C4D6BdpzVI2AK1RE84hx3Kc290Lxj9TV5DnZK0dm/Rw6SyoLrx32t6SMMNXme 0kwUhWCS+3/5VQq8iOvrR5cNzJvB5/Q+8Ci9q9ZlaoZr/eSi70jCPAtuu8oAwZR7BcA/ yZBhFy4sBs6GiAheTD0UuCrxnVXbQNd4gbeN9jDfNBWtt61OIXPt304mRaC5P3hhI23M t6Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236470; x=1732841270; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=IrHzciaZqAjtf1HZn4pU1MFhWoPaZ/QV981m7CNR2t0CKShDaLrdBbcJ4iUdRpcR7W XYEcEft1sxguU7MKE5XX/FO6C/lI2HXHUJrP1bnVtBwMyOto+NQUY1YtlDAhboh/oT6c QXWckBYwmNJJ0pTmPxOk2tEDIpJ46zLm288O2qJq5voGqpGjrvTyWRIkbpq45hzEX078 tiN+wdqjEK+iXM/F7xIMcEa+EUbk5TjGqWqye+shyuNjiv55man0UnGG+JKA5uaH1dUq j6nRAX42dvoE3ULijdsN7qsjEJ3pVl2ZGOSgBaT6rIwFufYUGU6tYyR2I8VCciLgwD3R E12g== X-Forwarded-Encrypted: i=1; AJvYcCXTNZfkoSQmohT6TrcTGfFszOfVer+YTOaB9N8O8rzASBzJCpqXA1Ji5LMd0MBUbwjHZiqq+sv9NC1bfcguGw==@lists.infradead.org X-Gm-Message-State: AOJu0YyuRPT1s8T5yQ/xjB18LqmxNPcqPFZY/UXlEpc7+YYwU7B1hiOf vU/BuIWgXbTm2ISMCHDvsXOquSMSsm1rxuxTtbhlfBBX0yzR8DfqXTotC5qEHC0= X-Gm-Gg: ASbGncsWi9o7OQqJ5ydcLLdk7ZsQC4wE/xcFnXNutwlh6If1ZYWLiuSjUa9DfMmu3vO YF4a3i6bDJpQuwiYMM0wnUkEBJc52EELNDgjGm7E6lxA9KADN2gJ0QIcqHNIXYMF7SWm3XScgQv L+j6O8JPxS9z9iYPoQbbP7hsrjMIdijMNv/XOsnDEcV7x5sfFT7eSP60QFlmAU8xz4eqSWYUI6Q rB/y+iB4uHGCz3jXuj/7eqEp/kAiRBr7s4N0lrIMC0aHumJdPfmzbK1FA== X-Google-Smtp-Source: AGHT+IHMUBebaip5YS2333T99HLNYNQnqajAn6gIrSEoon9GZQlCjBJW4sy6ZaybDfZqPdwcSk1J5Q== X-Received: by 2002:a05:651c:2122:b0:2fb:510c:7203 with SMTP id 38308e7fff4ca-2ffa4d810ffmr3580851fa.3.1732236470136; Thu, 21 Nov 2024 16:47:50 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:48 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:34 +0200 Subject: [PATCH v4 4/7] drm/bridge: connector: add support for HDMI codec framework MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-4-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=6723; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9So9qMT3ZtFSACzG1F69b6sWsU/NKcanhYPD U7fAUazNZuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1aswB/4o4XWFPj5i22aq4AhbTDk7K898EseN5rIUmg+inr5nuvgvyBw6gxjBEBD+i3qMV6QRQdN NXPyJA55z/eEGXBv018b2hA6dwtlEtYfUDyA8DQDSxffIrlNJRhADyNex8/J3VIJ+rL1MWRk2bs 6Gy8KMfrHyoUepjN5cD2Qq7NbNJWKL9hOXZS28PsQ9qleYId6mE9a7aGMEYAAEMnD31lazAJdcq Cd+2IzTdQoEdzzwFQ74JZgBeVPH8Ku4eT/unWo6xRSeE38v5B2+kF1/x4QK1ZrQf/KRQPvPgNkf XYdVNJCDdKAYFPPPUZL13q8AYThzeeiLsgJULnY3xFaQgLgw 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-20241121_164752_167379_165E4B16 X-CRM114-Status: GOOD ( 18.84 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add necessary glue code to be able to use new HDMI codec framework from the DRM bridge drivers. The drm_bridge implements a limited set of the hdmi_codec_ops interface, with the functions accepting both drm_connector and drm_bridge instead of just a generic void pointer. This framework is integrated with the DRM HDMI Connector framework, but can also be used for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 95 +++++++++++++++++++++++++- include/drm/drm_bridge.h | 23 +++++++ 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..12ab9f14cc8a8672478ae2804c9a68d766d88ea5 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -20,6 +20,8 @@ #include #include +#include + /** * DOC: overview * @@ -354,10 +356,80 @@ static int drm_bridge_connector_write_infoframe(struct drm_connector *connector, return bridge->funcs->hdmi_write_infoframe(bridge, type, buffer, len); } +static int drm_bridge_connector_audio_startup(struct drm_connector *connector) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_hdmi; + if (!bridge) + return -EINVAL; + + if (bridge->funcs->hdmi_codec_audio_startup) + return bridge->funcs->hdmi_codec_audio_startup(connector, bridge); + else + return 0; +} + +static int drm_bridge_connector_prepare(struct drm_connector *connector, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_hdmi; + if (!bridge) + return -EINVAL; + + return bridge->funcs->hdmi_codec_prepare(connector, bridge, fmt, hparms); +} + +static void drm_bridge_connector_audio_shutdown(struct drm_connector *connector) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_hdmi; + if (!bridge) + return; + + bridge->funcs->hdmi_codec_audio_shutdown(connector, bridge); +} + +static int drm_bridge_connector_mute_stream(struct drm_connector *connector, + bool enable, int direction) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_hdmi; + if (!bridge) + return -EINVAL; + + if (bridge->funcs->hdmi_codec_mute_stream) + return bridge->funcs->hdmi_codec_mute_stream(connector, bridge, + enable, direction); + else + return -ENOTSUPP; +} + +static const struct drm_connector_hdmi_codec_funcs drm_bridge_connector_hdmi_codec_funcs = { + .audio_startup = drm_bridge_connector_audio_startup, + .prepare = drm_bridge_connector_prepare, + .audio_shutdown = drm_bridge_connector_audio_shutdown, + .mute_stream = drm_bridge_connector_mute_stream, +}; + static const struct drm_connector_hdmi_funcs drm_bridge_connector_hdmi_funcs = { .tmds_char_rate_valid = drm_bridge_connector_tmds_char_rate_valid, .clear_infoframe = drm_bridge_connector_clear_infoframe, .write_infoframe = drm_bridge_connector_write_infoframe, + .codec_funcs = &drm_bridge_connector_hdmi_codec_funcs, }; /* ----------------------------------------------------------------------------- @@ -459,7 +531,25 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (connector_type == DRM_MODE_CONNECTOR_Unknown) return ERR_PTR(-EINVAL); - if (bridge_connector->bridge_hdmi) + if (bridge_connector->bridge_hdmi) { + bridge = bridge_connector->bridge_hdmi; + + if (bridge->hdmi_codec_i2s || + bridge->hdmi_codec_spdif) { + if (!bridge->funcs->hdmi_codec_prepare || + !bridge->funcs->hdmi_codec_audio_shutdown) + return ERR_PTR(-EINVAL); + + bridge_connector->bridge_hdmi = bridge; + + connector->hdmi_codec.dev = bridge->hdmi_codec_dev; + connector->hdmi_codec.i2s = bridge->hdmi_codec_i2s; + connector->hdmi_codec.spdif = bridge->hdmi_codec_spdif; + connector->hdmi_codec.max_i2s_channels = + bridge->hdmi_codec_max_i2s_channels; + connector->hdmi_codec.sound_dai_port = bridge->hdmi_codec_dai_port; + } + ret = drmm_connector_hdmi_init(drm, connector, bridge_connector->bridge_hdmi->vendor, bridge_connector->bridge_hdmi->product, @@ -468,10 +558,11 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector_type, ddc, supported_formats, max_bpc); - else + } else { ret = drmm_connector_init(drm, connector, &drm_bridge_connector_funcs, connector_type, ddc); + } if (ret) return ERR_PTR(ret); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index e8d735b7f6a480468c88287e2517b387ceec0f22..0ef9580ef6669f84327bdcb85a24fc83f76541bb 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -41,6 +41,8 @@ struct drm_display_info; struct drm_minor; struct drm_panel; struct edid; +struct hdmi_codec_daifmt; +struct hdmi_codec_params; struct i2c_adapter; /** @@ -676,6 +678,21 @@ struct drm_bridge_funcs { enum hdmi_infoframe_type type, const u8 *buffer, size_t len); + int (*hdmi_codec_audio_startup)(struct drm_connector *connector, + struct drm_bridge *bridge); + + int (*hdmi_codec_prepare)(struct drm_connector *connector, + struct drm_bridge *bridge, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms); + + void (*hdmi_codec_audio_shutdown)(struct drm_connector *connector, + struct drm_bridge *bridge); + + int (*hdmi_codec_mute_stream)(struct drm_connector *connector, + struct drm_bridge *bridge, + bool enable, int direction); + /** * @debugfs_init: * @@ -859,6 +876,12 @@ struct drm_bridge { * @DRM_BRIDGE_OP_HDMI is set. */ unsigned int max_bpc; + + struct device *hdmi_codec_dev; + int hdmi_codec_max_i2s_channels; + unsigned int hdmi_codec_i2s : 1; + unsigned int hdmi_codec_spdif : 1; + int hdmi_codec_dai_port; }; static inline struct drm_bridge * From patchwork Fri Nov 22 00:47:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882522 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 36071E65D0B for ; Fri, 22 Nov 2024 00:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O72gbUDbM7kl3JMP7ZBWI3LnDF87C5Sg9KKzLKy42H4=; b=2deA3zvnReWG40WLTj2+08ijBr IcA2mTqMO7uMwCEs+oHScyufatQzZ7YqN+uG8LOfOQ6x9RnLolA1WawdUnBHEdywQwZO1yWgTfSnE sKpY5Jc0BjWQxOLwFACSfEGDLEFXvXDGW0DjcNjC5uXjLoc0EQXkS+a90AJN49KQoDgxEMaSxnL6q D6AwSwGOgHWz6Q01Or2xD2XhbOTQ/15rlgYYeYg6tEQmavbEweqTSz+L451cPllpBwjYrRpk/Br6A kl1kyDCVc5OmuoctxuPaGA43Y9jVokPnaQ1TZy/jNgLlt4gyQxmDwf8R/okEBsiy+ErZi2o1Cyq8P qh83qPcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHub-00000001GzZ-1AJJ; Fri, 22 Nov 2024 00:52:41 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHpy-00000001G3v-342G for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:56 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2ffa8092e34so533861fa.1 for ; Thu, 21 Nov 2024 16:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236473; x=1732841273; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=O72gbUDbM7kl3JMP7ZBWI3LnDF87C5Sg9KKzLKy42H4=; b=bNIkjoxT5xgzVfSPEiXdkUDZZVS5++1goxy8SmwDmyqLU0oJocnKru/56OXiVuBgYn EGfC3CZhgJEgXi3qshaid2w5exsWaAEVTT1Oqq/iQ37+BTs2x426lUPT4MYcY0Nr3ts/ W/TXTwK5wRaDqmOSeYLpRazedKa9c5/bJCQfxJmGLICtlyQzZ8MxZpD6jLXE8n9BvIxb rkvwrBtC/x/u9SRPYIaGZ3avpLD8uEEUVVVjk64x7ttMXEMsrPMjETihzZi6H4Ls3GtI NVRHBLfqe0vVL7FOP59dvdsUgcOFspiaErayi6+NKHViXoDCytFECtXSOJDpZ+0/gJKY Q2JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236473; x=1732841273; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O72gbUDbM7kl3JMP7ZBWI3LnDF87C5Sg9KKzLKy42H4=; b=E8xNweTv/c8E69hc9u1UjwzFFJ3T9zVEQilql01chia9v5SGQyeuRkuN55D1CyoKny 4JLUYURjlHlIV94VJf7daIcp4IFdzvKP1h2KbAUjJrt8aMF4wc7cauH9GuNbvgUGeuc3 HhjjEpBZyClnIvdxY54+JUegoBqLks22ACkm1AY/NR1KXEV55V2ekc1J/QR/jLjtpkp5 5wVvN4/bu3/1aMPituEow4WCqvdbgo8tYXDS8Wztzzw+1+woxLpKgfoK7rZz9rpuKxUG 9jEcWXrGoWtYw5UuITbPmyqtdSfGF9eEmLDbtpwdBg5Ao9ZbHDkEs263bKKlibPhAXgl CXyQ== X-Forwarded-Encrypted: i=1; AJvYcCWNvWrXDHaoyIfUIwQ9Md5oBFHcPVRib8pY7+tJm+o62AOaVnmXKBeEDF4rSOc4JNJySCwZszpN0lcIS9fJaw==@lists.infradead.org X-Gm-Message-State: AOJu0YwGxLugOwUO5zUx+ileO7FddDQvQh1UrVfSIupdQmpEkKIbOomc YrRv8u7AMoWMBZahlcNtWHZsjTC1OevKbduM6BVNBn+2PNLm8pp2ZkzD8FNgXyc= X-Gm-Gg: ASbGncu58O5XJbBdynJmbyNQXTdkh7ymY2po0FxpI6RwaXNWM1C0dPvCZ4x6J0g97K0 zV9Ops+hdRVuAYSWJIaSLZktRJQakgkjOrlfp4nhm1axPlhkSxToQ77PaIdpw2Rfbu8WE++a+OC eWn98gZgrhOStPy1+eZKrNlNkscvy3ihynzyLST+wMU4MQ/7fYKnOML1ITdRYaGyy9/JQijpWwe Q6ZtszrlELUvgSb52JqR67ArQa0VhnwbF66xGVXswiaxDlvKTrtlJJueA== X-Google-Smtp-Source: AGHT+IEw/tBhKCFnrD14V+38zGlfbN8e7LPKpMB+4Z8aXDW1EfcDZZTa3uwrT+gXFjqv/lAO6wbLqw== X-Received: by 2002:a2e:bea5:0:b0:2fb:2b5d:215d with SMTP id 38308e7fff4ca-2ffa70f6bf8mr2984791fa.7.1732236472809; Thu, 21 Nov 2024 16:47:52 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:51 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:35 +0200 Subject: [PATCH v4 5/7] drm/bridge: lt9611: switch to using the DRM HDMI codec framework MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-5-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=7869; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=bt7FTSnaJ4ZdPpnvHjWH+URnk6jSCm36E7PfRw7YH9s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9So7yNOTs3PU0tlh/78i+WzL4AXI6hFFscud eqjnzdTataJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1a+2CACDNgeJkOfQ15ZRYAG61L1nsbntHptkDVFNvgxnghsubCnD8Fjge8LoUNrhPQ7yzQPyDv6 hjAmdsvJtiRQeB42d6eGoAdtM1XrN5e91ZQwywq8qIv4bLly0EBycEehUneCuL4BPUMeF/GDHjw mcGVknPaIjdxXCcw4F2EmPaEdQHL55vOZDQZU/AoRDWRTaoYz+1VwNDlMIQr3nl5m1JIVRkCRZv KJlqXu7leU+ii/TlmrZn6njMhVV73rSKLZ0wTXspe39rtzxcUoewdI2kPb0Z3JryhM1uZR5SJsr 5diZwzxk14+/B4gDnhm7IPXRWwP+z9IkbC+6pJnwbR3hyAH8 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-20241121_164754_917800_33C37BC8 X-CRM114-Status: GOOD ( 17.21 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Make the Lontium LT9611 DSI-to-HDMI bridge driver use the DRM HDMI Codec framework. This enables programming of Audio InfoFrames using the HDMI Connector interface and also enables support for the missing features, including the ELD retrieval and better hotplug support. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 171 +++++++++++++------------------- 1 file changed, 69 insertions(+), 102 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 6bc1b2476847c3bccbbf9874bb384c1f60674da6..f3ac67440a941327308ddf1fbb77744c6a8fe42e 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -45,7 +45,6 @@ struct lt9611 { struct device_node *dsi1_node; struct mipi_dsi_device *dsi0; struct mipi_dsi_device *dsi1; - struct platform_device *audio_pdev; bool ac_mode; @@ -866,6 +865,10 @@ static int lt9611_hdmi_clear_infoframe(struct drm_bridge *bridge, unsigned int mask; switch (type) { + case HDMI_INFOFRAME_TYPE_AUDIO: + mask = LT9611_INFOFRAME_AUDIO; + break; + case HDMI_INFOFRAME_TYPE_AVI: mask = LT9611_INFOFRAME_AVI; break; @@ -899,6 +902,11 @@ static int lt9611_hdmi_write_infoframe(struct drm_bridge *bridge, int i; switch (type) { + case HDMI_INFOFRAME_TYPE_AUDIO: + mask = LT9611_INFOFRAME_AUDIO; + addr = 0x84b2; + break; + case HDMI_INFOFRAME_TYPE_AVI: mask = LT9611_INFOFRAME_AVI; addr = 0x8440; @@ -942,6 +950,55 @@ lt9611_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge, return MODE_OK; } +static int lt9611_hdmi_codec_audio_startup(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + + regmap_write(lt9611->regmap, 0x82d6, 0x8c); + regmap_write(lt9611->regmap, 0x82d7, 0x04); + + regmap_write(lt9611->regmap, 0x8406, 0x08); + regmap_write(lt9611->regmap, 0x8407, 0x10); + + regmap_write(lt9611->regmap, 0x8434, 0xd5); + + return 0; +} + +static int lt9611_hdmi_codec_prepare(struct drm_connector *connector, + struct drm_bridge *bridge, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms) +{ + struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + + if (hparms->sample_rate == 48000) + regmap_write(lt9611->regmap, 0x840f, 0x2b); + else if (hparms->sample_rate == 96000) + regmap_write(lt9611->regmap, 0x840f, 0xab); + else + return -EINVAL; + + regmap_write(lt9611->regmap, 0x8435, 0x00); + regmap_write(lt9611->regmap, 0x8436, 0x18); + regmap_write(lt9611->regmap, 0x8437, 0x00); + + return drm_atomic_helper_connector_hdmi_update_audio_infoframe(connector, + &hparms->cea); +} + +static void lt9611_hdmi_codec_audio_shutdown(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + + drm_atomic_helper_connector_hdmi_clear_audio_infoframe(connector); + + regmap_write(lt9611->regmap, 0x8406, 0x00); + regmap_write(lt9611->regmap, 0x8407, 0x00); +} + static const struct drm_bridge_funcs lt9611_bridge_funcs = { .attach = lt9611_bridge_attach, .mode_valid = lt9611_bridge_mode_valid, @@ -962,6 +1019,10 @@ static const struct drm_bridge_funcs lt9611_bridge_funcs = { .hdmi_tmds_char_rate_valid = lt9611_hdmi_tmds_char_rate_valid, .hdmi_write_infoframe = lt9611_hdmi_write_infoframe, .hdmi_clear_infoframe = lt9611_hdmi_clear_infoframe, + + .hdmi_codec_audio_startup = lt9611_hdmi_codec_audio_startup, + .hdmi_codec_prepare = lt9611_hdmi_codec_prepare, + .hdmi_codec_audio_shutdown = lt9611_hdmi_codec_audio_shutdown, }; static int lt9611_parse_dt(struct device *dev, @@ -1015,102 +1076,6 @@ static int lt9611_read_device_rev(struct lt9611 *lt9611) return ret; } -static int lt9611_hdmi_hw_params(struct device *dev, void *data, - struct hdmi_codec_daifmt *fmt, - struct hdmi_codec_params *hparms) -{ - struct lt9611 *lt9611 = data; - - if (hparms->sample_rate == 48000) - regmap_write(lt9611->regmap, 0x840f, 0x2b); - else if (hparms->sample_rate == 96000) - regmap_write(lt9611->regmap, 0x840f, 0xab); - else - return -EINVAL; - - regmap_write(lt9611->regmap, 0x8435, 0x00); - regmap_write(lt9611->regmap, 0x8436, 0x18); - regmap_write(lt9611->regmap, 0x8437, 0x00); - - return 0; -} - -static int lt9611_audio_startup(struct device *dev, void *data) -{ - struct lt9611 *lt9611 = data; - - regmap_write(lt9611->regmap, 0x82d6, 0x8c); - regmap_write(lt9611->regmap, 0x82d7, 0x04); - - regmap_write(lt9611->regmap, 0x8406, 0x08); - regmap_write(lt9611->regmap, 0x8407, 0x10); - - regmap_write(lt9611->regmap, 0x8434, 0xd5); - - return 0; -} - -static void lt9611_audio_shutdown(struct device *dev, void *data) -{ - struct lt9611 *lt9611 = data; - - regmap_write(lt9611->regmap, 0x8406, 0x00); - regmap_write(lt9611->regmap, 0x8407, 0x00); -} - -static int lt9611_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint, - void *data) -{ - struct of_endpoint of_ep; - int ret; - - ret = of_graph_parse_endpoint(endpoint, &of_ep); - if (ret < 0) - return ret; - - /* - * HDMI sound should be located as reg = <2> - * Then, it is sound port 0 - */ - if (of_ep.port == 2) - return 0; - - return -EINVAL; -} - -static const struct hdmi_codec_ops lt9611_codec_ops = { - .hw_params = lt9611_hdmi_hw_params, - .audio_shutdown = lt9611_audio_shutdown, - .audio_startup = lt9611_audio_startup, - .get_dai_id = lt9611_hdmi_i2s_get_dai_id, -}; - -static struct hdmi_codec_pdata codec_data = { - .ops = <9611_codec_ops, - .max_i2s_channels = 8, - .i2s = 1, -}; - -static int lt9611_audio_init(struct device *dev, struct lt9611 *lt9611) -{ - codec_data.data = lt9611; - lt9611->audio_pdev = - platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, - PLATFORM_DEVID_AUTO, - &codec_data, sizeof(codec_data)); - - return PTR_ERR_OR_ZERO(lt9611->audio_pdev); -} - -static void lt9611_audio_exit(struct lt9611 *lt9611) -{ - if (lt9611->audio_pdev) { - platform_device_unregister(lt9611->audio_pdev); - lt9611->audio_pdev = NULL; - } -} - static int lt9611_probe(struct i2c_client *client) { struct lt9611 *lt9611; @@ -1174,6 +1139,9 @@ static int lt9611_probe(struct i2c_client *client) i2c_set_clientdata(client, lt9611); + /* Disable Audio InfoFrame, enabled by default */ + regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AUDIO, 0); + lt9611->bridge.funcs = <9611_bridge_funcs; lt9611->bridge.of_node = client->dev.of_node; lt9611->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | @@ -1182,6 +1150,10 @@ static int lt9611_probe(struct i2c_client *client) lt9611->bridge.type = DRM_MODE_CONNECTOR_HDMIA; lt9611->bridge.vendor = "Lontium"; lt9611->bridge.product = "LT9611"; + lt9611->bridge.hdmi_codec_max_i2s_channels = 8; + lt9611->bridge.hdmi_codec_i2s = 1; + lt9611->bridge.hdmi_codec_dev = dev; + lt9611->bridge.hdmi_codec_dai_port = 2; drm_bridge_add(<9611->bridge); @@ -1203,10 +1175,6 @@ static int lt9611_probe(struct i2c_client *client) lt9611_enable_hpd_interrupts(lt9611); - ret = lt9611_audio_init(dev, lt9611); - if (ret) - goto err_remove_bridge; - return 0; err_remove_bridge: @@ -1227,7 +1195,6 @@ static void lt9611_remove(struct i2c_client *client) struct lt9611 *lt9611 = i2c_get_clientdata(client); disable_irq(client->irq); - lt9611_audio_exit(lt9611); drm_bridge_remove(<9611->bridge); regulator_bulk_disable(ARRAY_SIZE(lt9611->supplies), lt9611->supplies); From patchwork Fri Nov 22 00:47:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882523 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 64B31E65D0A for ; Fri, 22 Nov 2024 00:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AekznUw/DJYmSVBNFKXzyv34fWwrWZN8k5LwtkQDlbE=; b=Fe+g0ZRW63/ugQoIiqjQ2JB46c RBSDy6TJsz9Gkxw+vs24otZkLE/l1kG0QDqkjrl3vG3Xm/AsjIVQ8r1nCuvpUO+2JQILnqTuYwL8A GHNP6mMYtIVC6co58lTbbOwhXElbqTP7m2RnfRtSA8j4ndoDjDtASY0lVqC/ouJ6Bxfk0mAuazYp9 cIKlAsqna2BLm/zfzBW2T0q0mN0VSzFEBSLDjj+rPkXE9XkGuCBybxCibzGmHF1s8FDqJje4WE58k 2g4BV68XLAsq8/lZ9l8GHdQK8dJF/57ZtXu6gGa4a5oUl8KQNXtGYknsl82F7pz+AfVjZo8Mbx8bl tLmOXwbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHvW-00000001H97-2NbP; Fri, 22 Nov 2024 00:53:38 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHq1-00000001G66-1D9e for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:47:58 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2fb5743074bso13560341fa.1 for ; Thu, 21 Nov 2024 16:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236476; x=1732841276; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AekznUw/DJYmSVBNFKXzyv34fWwrWZN8k5LwtkQDlbE=; b=SvI5qQQuph8IgYj+dy96JnRN/vjjTNH0wIYRV9NWKKFD4Q1hMTfbjxrdtSPz6FBV0X 5eb3517IE53HEH3J5UMqv9Vp2R01tJHNlNnwI8mqSpSdciwTm/GWBfKdVRhYMS+fBWa2 e+Wg3A9IgiYDOVLcvqCLHM3VM8Y5N3m+iIEAOcNFyoEwE8pVhYFjuQ13xeCD7Y8QdKPb a2PBJ9jA+vvDiDfPvks15avnaiFaFTzKEwQrRYj8XwVE5EKSwRJTF4ptiKueTjhe8ZS6 O6oxQdJn+MqEwvJr0JKTR9k1nipeFzuADRTePuvVgdYnxCCtOWHXJaKnLo4GaGuqQ4NX VtOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236476; x=1732841276; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AekznUw/DJYmSVBNFKXzyv34fWwrWZN8k5LwtkQDlbE=; b=omUkNGcbC+uUCFv5ctbyYQd8LpbIeKqxKWMdkJvl0m3/MraTp9fiU6dZxvP4o1BJhF ZJ33/ixIi6+RHEZHyvOzS5R79uO86xdQPaAs9138sjE8ZxMcuEKetlkngTyDT83s1Dgs 7+uDvO83w0Oq4ZdQEA4lZiSG4SitWtqhsDcxtSod9I+FaJu4gcDbY2w/l88Nm7wQtHf9 pgFMwYUoao9HQkoSdeW0SAnLo0iQ/CsZ0kVCI22eQR99EeAebBumfqCQzanlukFp0RJm dSM9eL1Y4HE61qkzVn6NspYrqamRnlYuS7jT8TPXggIP9/g/n8y4EMBGvOrDjIDMgyE3 3oRQ== X-Forwarded-Encrypted: i=1; AJvYcCUA/tIZSLEMoO3EtPKmy8+6AtpziKNAIAx70GoanROU8GbbqFN1FxqkhvyxGgS/45VYl36Q87Tu+tUpidtRCQ==@lists.infradead.org X-Gm-Message-State: AOJu0YwZgt3hDPT7R+BZi+Ir8hZRCNEeKGy6Zk4OYXJoe2FhtEDwQPpm k0w2dxdUMfgD0Of+Xo19zRaL1NTrJNns/aPzA/idEkbUVsvypzW06FHcAlWGFXA= X-Gm-Gg: ASbGncvqXIxWwgL5gFAQwxXEmPy4m8iU9RzyBhkPoMJOPcH3t82ogorv4vX45mahb2U 3jwM+z0pidyz3dwOVYUXfIn6qLJtK8AZT+cgQQ5JMAjyn6Z5ETkRbCHAzCDINEo3hY7TxkqWd90 +8BX6lw/LrsspPtcFkmefH6PjjEfVG/A9o0qhysX3D4G221pW/9NaTPornyzvZCAtP6jPKNA0EU V8C6mSkA4WSLHm4MKo1dUj1v6pdE9UG9kFal1AtUOMZ6m08bzbBpEnzpg== X-Google-Smtp-Source: AGHT+IHkN4nXkCVt6nZPpHcWzC2bWbGpwg4sMZCFQ0fvcq24XIw4gri2A5l4rqWLYlEyB/ESg+byOw== X-Received: by 2002:a2e:a593:0:b0:2fa:d086:bca0 with SMTP id 38308e7fff4ca-2ff969a16ddmr15367841fa.10.1732236475685; Thu, 21 Nov 2024 16:47:55 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:54 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:36 +0200 Subject: [PATCH v4 6/7] drm/display/hdmi: implement connector update functions MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-6-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=4091; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=h4SDlLdLeTf2M3phGYhMa3icgLWVQxFU2Yi+KA0yVFA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoeZGpNl267MxKzahXC2JqO9fXLs+4r7B2b jseNQkh83WJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1RYrCACo07vR5CSktkmxVEZbETbBqQjxDEeirXgkPjqknr/6Ldh0teXQADgZkx9HHdy58CDSdc+ ga4kgK0+ZJXjgpg7TnqA4pPgCDv7PJoOvu6y0R7OjtUAaSt01YNT2WdetJ/IKZIgYMz5us0+iaQ k0/tU7kVnXK5+fblJV+pE18lR12Yt+SV+MVUlmv/ftN7GvhZJEJ6Df6cHgmGNg/Sdy8rSrFHBFR w3uWFPjcHPScLXfZLrdBHstD1OaRB/6FKaVApC2rme2tOi4WXrmB2Itk78OwNOC/b64r9oLTmhO inwbgxXewxRuJicQQlp2xm2P+7/BdBVJMjpy58NyXHJAQ+3f 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-20241121_164757_344125_683F8C0D X-CRM114-Status: GOOD ( 14.91 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The HDMI Connectors need to perform a variety of tasks when the HDMI connector state changes. Such tasks include setting or invalidating CEC address, notifying HDMI codec driver, updating scrambler data, etc. Implementing such tasks in a driver-specific callbacks is error prone. Start implementing the generic helper function (currently handling only the HDMI Codec framework) to be used by driver utilizing HDMI Connector framework. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 59 +++++++++++++++++++++++++ include/drm/display/drm_hdmi_state_helper.h | 5 +++ 2 files changed, 64 insertions(+) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..2230b7fc92cfee46a9cad2479edce71822d30934 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -748,3 +748,62 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *con return ret; } EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_clear_audio_infoframe); + +/** + * drm_atomic_helper_connector_hdmi_update_edid - Update the HDMI Connector basing on passed EDID + * @connector: A pointer to the HDMI connector + * @drm_edid: EDID to process + * + * This function should be called as a part of the .detect() / .detect_ctx() + * and .force() callbacks, updating the HDMI-specific connector's data. Most of + * the drivers should be able to use @drm_atomic_helper_connector_hdmi_update() + * instead. + * + * Returns: + * Zero on success, error code on failure. + */ +int +drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *connector, + const struct drm_edid *drm_edid) +{ + drm_edid_connector_update(connector, drm_edid); + + if (!drm_edid) { + drm_connector_hdmi_codec_plugged_notify(connector, false); + + // TODO: also handle CEC and scramber, HDMI sink disconnected. + + return 0; + } + + drm_connector_hdmi_codec_plugged_notify(connector, true); + + // TODO: also handle CEC and scramber, HDMI sink is now connected. + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update_edid); + +/** + * drm_atomic_helper_connector_hdmi_update - Update the HDMI Connector after reading the EDID + * @connector: A pointer to the HDMI connector + * + * This function should be called as a part of the .detect() / .detect_ctx() + * and .force() callbacks, updating the HDMI-specific connector's data. + * + * Returns: + * Zero on success, error code on failure. + */ +int +drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector) +{ + const struct drm_edid *drm_edid; + int ret; + + drm_edid = drm_edid_read(connector); + ret = drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edid); + drm_edid_free(drm_edid); + + return ret; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..61c43e744051886ba5f2024197fcc90688670ebe 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -6,6 +6,7 @@ struct drm_atomic_state; struct drm_connector; struct drm_connector_state; +struct drm_edid; struct hdmi_audio_infoframe; void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, @@ -20,4 +21,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector, struct drm_atomic_state *state); +int drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *connector, + const struct drm_edid *drm_edid); +int drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector); + #endif // DRM_HDMI_STATE_HELPER_H_ From patchwork Fri Nov 22 00:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882533 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 C7441E65D0B for ; Fri, 22 Nov 2024 00:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=x2Nv6/3a3JYilc2GG+pM4uGAcs M/iwljIxIw9DW7pRDWBCfdlXrp9HZflqID2eUXEKVYivOxXez48UqeGDmYmDYol9Ku0rK+oAUYE9r W4pN0jcrDra3I5b2NwFtI1zgHZYX1NTvWyil3BcnIW78qSqf1cmZvfueb9y4gJ+kTbt02IuOb+P97 FbhA15wte0zxLY0BTjeBLAM7QqsYFT2a3CbPWA4Mi4AkRSN0tNdSC1WcMZUOIKREZ4Nk6ksVvjy6s zysnF4RhH4deLNQFaYFz+XsyKBnSRQSzKyUhEqvXUPbSGTW6qHXWo2GAQ6KpEykUYeCevdcilOARN zW5LKnYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEHxM-00000001HV5-3gqJ; Fri, 22 Nov 2024 00:55:32 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEHq4-00000001G8h-1E5A for linux-mediatek@lists.infradead.org; Fri, 22 Nov 2024 00:48:03 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2fb561f273eso17979741fa.2 for ; Thu, 21 Nov 2024 16:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236478; x=1732841278; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=uDn/9XgqQ8aCNz85uLvMn59i1oDOauIKltAtA261uKo2fnJCC7GjEw/KGEXP4evArK DLqHtatOQcqkS/MNEvbqNac+kHDDK3wzKA70oGEy158pIwOjuViBpFVQ1Fbco8KDPLL1 aonUlpnU7QWvLXHzxoXW7dLF16oCS7VrOONGJHUPkPHs985Sfn0aPOQt3zumcg59+x7D V2fXvY5XRo1MZTltjmlG2LIq1cAkafu983V4sCG5DPdgepGvSed8/5sSTPTJoIpMaMV/ OYQLUY4NELvdKR5CynENvWJS5aJ0lIYfyBB3qkQT2ALsxZ/kZOsoa3VmWgUOAiDGsUwy KUUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236478; x=1732841278; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=eJa+KJ3xO+zGso8as8ftmYP2DDLNAKX+O53mE1sIEgcyhZOgNphucWR3h2n+Bl085Y tY15ZgkrN6iC+XqUcC92R9LYhSNOatnXi1WtMlTUrzM/Hg9CfGav/BRYeKlnqguR0/Rr NrcmnkjPtWNVv4jbeiahYk3ZIGWPUJWenScGBw2OaJ5ufFKIL9AM9VR/cFyqSKdWMt8b FCUxbMyuT9xMBHJfT8Mvyiq9beZCGSMU0Z38hMFeNfwoqekA+PDJx1sWbGtcfHL2o5L1 4NCc4tV8cxuyhzDS8liYFPg78fKzeekY4vBruZqn9o3MX+bxx8wZLbtuTW5oOyHuPvnn t7tQ== X-Forwarded-Encrypted: i=1; AJvYcCW3mmKpt53YVJK+2TD9qJlqdunlrzYJOv5mrhj86Qjr99xy+I90ScvD3zAPNWcmYEiswId0c+ppWr2VtC4gtw==@lists.infradead.org X-Gm-Message-State: AOJu0YzDBs4ejF2OuS/AHCuELs69Xl0rWmTCkkB5e/DldOQ7nutZKQRW cs5BSHouSCWGxfEqKh0PWrq30SJBadIVygcVasFMi9WoJNA94o9LwHIqzF1UjwA= X-Gm-Gg: ASbGncsSIPWjR6sUfE6UQ6IO4l9hrIXFwoMTWKTFnyxJVdqw+RZ7vCGeAO9LcHhZ9FU p/4nFeaHQwQU3aBZ0BDXgFDuBN6koKpiI3Wucw74AYaDIwUcAYikecoqJ4H9R6cf4TEc2YbbgPu 2pbQI6MTFGl3V3YiwVQ+uI6kj3Jv9jRvVr9tOnyfVaeabd6t0adRZShywn4AA6lExDxV8G1Myjg Woly1JYRifQInOtZM5LDOPF+eoK5mc/N0a+XTNViB9BfcykBMsdwSSoNA== X-Google-Smtp-Source: AGHT+IHaHNlUP8086xz3tRzLnaul8Avo5PbX/8+kDiLnQ5OGtpX084LsUh/kakZmuNiZbNZCIacxWw== X-Received: by 2002:a2e:a58d:0:b0:2fa:d978:a6a2 with SMTP id 38308e7fff4ca-2ffa716cecamr3853321fa.27.1732236478310; Thu, 21 Nov 2024 16:47:58 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:56 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:37 +0200 Subject: [PATCH v4 7/7] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_update_edid() MIME-Version: 1.0 Message-Id: <20241122-drm-bridge-hdmi-connector-v4-7-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> 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 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=4107; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yRmYAaGG5FuJnzbiAwK+r8Wa4ofx1aRyHEGe3Ks/gxw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SpVDpn/N8z6K6hlLcRgonLl5v1k8kXcTVuO Og+AMEkfmSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqQAKCRCLPIo+Aiko 1dLPB/wLm/x1f8KlUeomrCfmp3UZ6g0DI5BUacJw80/8n2QLtYdBuGeBGuVq2z7lkL3AHGUhaHY gZn/7tubJGIZ3vjMeKLSgs49f7JxTUS6dJBGNbBYpupT5L25MoRX3pe9lCr+eDE/wpGoALXBcmE PYfPqUfPhHmNEOGYcD1oL742/t4WqmXtKa1ni1Hv+otodOq367Sfr44Xyqic+u1VV5eN4WWqpoU LtUDOu58YxNAOkrtyEGmrV/bbh6D4P9e6DioI4eij6CMhhiLhAp29UjK/+78DvZ3TgpR5uqrrOb ERZMg7fJCawdHkXiMo8nIfO8uK5pR0cgN6c6V904Ac5pSqFu 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-20241121_164800_336381_C7CA64F5 X-CRM114-Status: GOOD ( 16.97 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Extend drm_bridge_connector code to read the EDID and use it to update connector status if the bridge chain implements HDMI bridge. Performing it from the generic location minimizes individual bridge's code and enforces standard behaviour from all corresponding drivers. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 67 ++++++++++++++++++++------ 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 12ab9f14cc8a8672478ae2804c9a68d766d88ea5..71ae3b2c9049016d1cc0d39a787f6461633efd53 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -175,17 +176,55 @@ static void drm_bridge_connector_disable_hpd(struct drm_connector *connector) * Bridge Connector Functions */ +static const struct drm_edid * +drm_bridge_connector_read_edid(struct drm_connector *connector, + enum drm_connector_status status) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + const struct drm_edid *drm_edid; + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_edid; + if (!bridge) + return NULL; + + if (status != connector_status_connected) + return NULL; + + drm_edid = drm_bridge_edid_read(bridge, connector); + if (!drm_edid_valid(drm_edid)) { + drm_edid_free(drm_edid); + return NULL; + } + + return drm_edid; +} + static enum drm_connector_status drm_bridge_connector_detect(struct drm_connector *connector, bool force) { struct drm_bridge_connector *bridge_connector = to_drm_bridge_connector(connector); struct drm_bridge *detect = bridge_connector->bridge_detect; + struct drm_bridge *hdmi = bridge_connector->bridge_hdmi; enum drm_connector_status status; if (detect) { status = detect->funcs->detect(detect); + if (hdmi) { + const struct drm_edid *drm_edid; + int ret; + + drm_edid = drm_bridge_connector_read_edid(connector, status); + ret = drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edid); + if (ret) + drm_warn(connector->dev, "updating EDID failed with %d\n", ret); + + drm_edid_free(drm_edid); + } + drm_bridge_connector_hpd_notify(connector, status); } else { switch (connector->connector_type) { @@ -246,29 +285,29 @@ static const struct drm_connector_funcs drm_bridge_connector_funcs = { static int drm_bridge_connector_get_modes_edid(struct drm_connector *connector, struct drm_bridge *bridge) { + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *hdmi = bridge_connector->bridge_hdmi; enum drm_connector_status status; const struct drm_edid *drm_edid; - int n; status = drm_bridge_connector_detect(connector, false); if (status != connector_status_connected) - goto no_edid; + return 0; - drm_edid = drm_bridge_edid_read(bridge, connector); - if (!drm_edid_valid(drm_edid)) { + /* In HDMI setup the EDID has been read and handled as a part of .detect() */ + if (!hdmi) { + drm_edid = drm_bridge_connector_read_edid(connector, status); + if (!drm_edid) { + drm_edid_connector_update(connector, NULL); + return 0; + } + + drm_edid_connector_update(connector, drm_edid); drm_edid_free(drm_edid); - goto no_edid; } - drm_edid_connector_update(connector, drm_edid); - n = drm_edid_connector_add_modes(connector); - - drm_edid_free(drm_edid); - return n; - -no_edid: - drm_edid_connector_update(connector, NULL); - return 0; + return drm_edid_connector_add_modes(connector); } static int drm_bridge_connector_get_modes(struct drm_connector *connector)