From patchwork Fri Dec 6 10:15:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896870 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0085200139 for ; Fri, 6 Dec 2024 10:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480211; cv=none; b=X3CBn9E7VJrBAvD89H+f+xMGKhTWTks3aThPAKaOUCtotu7PadXhtLxoXmts+oxK9na3GsKt7dV7JXDK4cX08rUO70rtJfcwNWTzKDJT6UMOWtIJIEoznDLgF684+aClmO9w4XVoc7tO4P0nz98EpAK6KqWWhprO3hno4VLEpvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480211; c=relaxed/simple; bh=mf+Mbo35eir6B+rLArs//796iJiX64HF7YQK4dBg7Bc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EXLOnsrCA/2JBUJIBDaVabRE1jo82gw3iZt8/JZUQtXK/oymSt/Db19DZklAJMqMHhV9vuwn5FQb0TKtBxznnNk85cxdAvs3Au41hgoGHFSTT/xGFjJJEVuIEy8ZubvyvuBQmnx2vnguc1S9gTCHQcmHxrmSey8Ym02fNbwEJXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bhjs0qV7; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bhjs0qV7" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53df6322ea7so2196650e87.0 for ; Fri, 06 Dec 2024 02:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480207; x=1734085007; darn=vger.kernel.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=XdpsanGAJq/HJAcg8LOfnw7m4WhAfgPQTWEy7/V+0WA=; b=bhjs0qV7oOhBS6EOCUhMvAuCGFUKJ+1sLHr7K/zyAFidF/OA99ZiC+DJLJW4WOaZ+p MJ4lPmGBPgluTr0FjZtcqI1ZkzZkEwFABB9jKECLjIk4xGZM0sZHR+mpmBzRBHuB6BGD SERUfruYSd3yqidIzm7WFR8NCv3HUTg+m8G0vGXKdE5JFENBX8zDGOskZbuslugIU0Dd 2j8NkdOgqjD4MLpHcVSO9k29lW58GgUhraYKkLVHG1s9LUYIGljSMf+fkaGBA3wCU5xC NhhnGmZMA6IgMJrvm8RnboeR7hiK2zANzK6iTMExwpq32I1IWvHggY1UwJDcSO8mrr/o 8YAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480207; x=1734085007; 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=XdpsanGAJq/HJAcg8LOfnw7m4WhAfgPQTWEy7/V+0WA=; b=eX8Cipt4dGRkEDRfAZ6rtc8ElDCr3WtRzFfKjQtcaCQg4TjvaSHFPXLXTwlqfQF+Ec Wj2KnreOp+e3dDpUnhruV8m3RlUWpfp3521bpcc7ji8IzN5rCuP01SNFu7EY6V5bMmR+ D8ndQoAkcY8Mk5EN/SGEkLZ6j9O/XtSqDpriBXFGv5J0m/8nkunSzl5kUUd+qsh84jA8 TbmZWjY7ek/iRTR1roJ3P8yvOHgI/5JD/xdUSBfRaoh0f+rJK330MxKJw+iM8mt+nuE8 LNCXbiNqUJYT2yF4LgY0evwA2BCIkURnmIkeGe/GdAMsk8t8TlUeBPnrbwSx5HpI+C9E 7xzw== X-Forwarded-Encrypted: i=1; AJvYcCUqRufVDzR+z/pQ/20B/AixbA4oj+ZByWEeqRepd3yWG4WRCYjqvcqOHilXA3/ZwhCaMh7RqOIhbcJg+tojTESyDg==@vger.kernel.org X-Gm-Message-State: AOJu0YzjKPOj6GdAm+zz7buqO9YYm9kd/ZFx0veBQ8Fv4D0wKBoF4a0o KKpCJOa20GEljd7DDot3c6YAN5Kz5tja7AkotQjG7XRg9obdJXUTpekV4kcyWq0= X-Gm-Gg: ASbGncssEI9LOZi/jNMnlY0hUrgb2LI/M42X2xP6EK/UypX+wDDVx3wh4eqlMoQT7j1 M/BPphQoY/AXP9P+f+eNlT1/6D6dF/UArXWpSyphSiKKjrcpFSSNCKn3V43fAxT6ssiEAKqe8O8 aXxcIu5wukWN+EMWqzjQMuPvsDinFFuhN6ZeyWkXVBzZd6A+nH0jR+U3g2/7IQkCWMKao2qV/Yi RP6PGcVvkeM7tPi1pvk9gAcV0VoLh3UahyZ26uJwAQcAUompKJRziqO5w== X-Google-Smtp-Source: AGHT+IFkrbYIrOOX+notTKc9sLOnekf4EyYqfJ1UPx3hlsMd+eSwOGD1rvbmH6UCcVPjOPfN3YJGzQ== X-Received: by 2002:ac2:5212:0:b0:53e:2ed9:8122 with SMTP id 2adb3069b0e04-53e2ed98271mr483402e87.22.1733480207015; Fri, 06 Dec 2024 02:16:47 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:45 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:15:55 +0200 Subject: [PATCH v6 01/10] ASoC: hdmi-codec: pass data to get_dai_id too Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-1-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5692; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=mf+Mbo35eir6B+rLArs//796iJiX64HF7YQK4dBg7Bc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8IaYJW+k5SE3hHwYqHHBuqemef33RuRKCYf kdE0NK2gquJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCAAKCRCLPIo+Aiko 1bSBCACCtZjKIQS+Bj+44o3OJdoyxZmYPBE6MN//iugAoMcK5In7DBzfTnazsoUgTXTlJV+KBzs K6VspCTgwjXkFNiH18fKKUpEoIblZrZeBNA54jsgl/75JHwhjlILpGNMzV0lJBIo8lBXgNRV5eE E06RaRtbicWAG/0OLMg6mHDo84Mrjz+ZkZUuGHOJUDN/Ssh5ykbFVbytxek+cFeC9IPAdQkmGw2 pRkjnWyIDW3lVFvTJWIm5m767qmw/GNwPGZNllOJBhOkjd0rWVf8PyVasjzuZE0D7sQ1jypZYWF b5EcXqqIdOsFD4zZYm5ADR/o1EstOZMJ740FO/kps0HNPO// X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 c036bbc92ba96ec4663c55cca091cd5da9f6d271..943dd3cf57738d8c232d57d793756eb2e3bf1c5a 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 1ffbe473e4103dfc315a8cd3571e9407bf518797..60b7305c0fd1935e35742713c78937392b7faa79 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -1057,7 +1057,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 d9df29a26f4f213a30a2ebcdb63a593f9cf4b901..f536ca60e162dca6b50b37854ca6de2c114bc2a1 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -995,7 +995,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 Dec 6 10:15:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896871 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC5E0200139 for ; Fri, 6 Dec 2024 10:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480216; cv=none; b=dz/VxMEV0Uo8eAHv/qThXd27HPBbWQEDIt11ZtlyBlFyAV2MyCipzkMAwhetzzJiL0dF/FsOHOBFFjgnzoW02E2BYoflAYuu1JmwaCm+uVCEPV2OH24rA0KXvkTz5fJe2r6PYdISGUAOd4U29uJDi46KzK2PMjN5iCK2gSWVYFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480216; c=relaxed/simple; bh=EegHdO43wttEGSvBPAP1XP9XLQCza9RJKUHmlnMlwfM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uFR+vA8vcqI/quVLfoPTJNB2fVATMv23shDKzxDnjCnN8bZgpF9jPgFgKPGd+aKBnwgqTMTUUPM/oSb4OZwgBKnAL78AVQpMaejF5Y5vAk9CuKkrqRTOCdX34vD333yvpSMzcIpUPk0/xrgMa0PplxxjgQ3apwI8EHDDtMYo9gg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XW0kXo9Y; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XW0kXo9Y" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53e2129be67so2198703e87.2 for ; Fri, 06 Dec 2024 02:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480210; x=1734085010; darn=vger.kernel.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=wmpYYo28h0VEi+0MxV5PobrvygOJ+6ttk3/QBKvz1U0=; b=XW0kXo9YkwpRF1+ZeqOgLLre2N1pA9aBvOttM4aRAsqN3E7zKIQjrsimyn/+uB7znP e55T8+29pTs2L4WLmnxYrMu8fjQMo64zNo7vZIgaMxwulTBL7sSvAJ2WWamdX3/RFh1W bORfLs8ca4BOCdwYtREYo2YG3RZiIw0PAt+xMM2yYqkdNkeEIcMcsE0+F5h7BvP0lzEe ulFcAlRjO21XOftCq9PbizuoW6uaFlh1Zpf0VHYEMKfTy/tA7pnF+QTbtsvRP0whqXJz YgvYcGFP+usRC+/iS3Jr6CX9EjZ8kMhhlOuKi5deRsGJRNW76knvx6mqbEVv/+VekNsV Ldzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480210; x=1734085010; 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=wmpYYo28h0VEi+0MxV5PobrvygOJ+6ttk3/QBKvz1U0=; b=we7Iud3xy6og593lhiGqyFhZn28lv52dwohQcrmhAJ1VEplpQcd1XisYa3k6d5+4PO mArgzSEHSjWtQ8a8btT5/zeXtjEPZXggKT58mt9niUsUcig37Bcz7GU3GcTz2NmSgVdM cNa/xrwbQ2OnCQlPXPC3htG3V0B8lpDaTuZZC1HpnoOHz5JAnMOpe2JyvyyhTtqR7BAL mBqdytL52Rv9ldgyrnd/+0as0eCbvUpEfuIH2kSbOD2RelEyepqj9j4jXqwlofoAVTlB V1B5N75DCIXC8QAL8a6lBTfmpDRwr00AekutuN5UJKIvFvOjlQ9xr7GtDxmMKtliNwRb ENIA== X-Forwarded-Encrypted: i=1; AJvYcCWS7Mq1jTz8fOFfUwjGK8NMQtx0jLA5AEWiS7fS8liMVxjObWvxbIoWoKJFXXEMOGzGaCU5/gGnkbqOKgz4cr6pog==@vger.kernel.org X-Gm-Message-State: AOJu0YwMC0Y9J/O8/GJWKeIRR+Pb1BkWRcpRpq9g4w6vFRugZ837681q Vr0KWX+/4qBEMyffLY0X0VelObPzZ/LlZ1O0HxObqc04+yD0sUhv50z83G4jauc= X-Gm-Gg: ASbGncuIbPE4hug7px4FG5b/hHb+fDoXQGB+y3D4oP8dYsJkeTe+wCdMmT5jPMGUfEU YOKHPBWPtWK+mgcuIRL/2o9M9wZIctnhCLFmJwsHyrbe7V1Hw1ltRV0+vX/HNn8SCmwflowWTVx HBsR7DCFBBpPTKH7q1zO9GTQB8dhCYQ4hgXGN/MJqjnUwB8CPb84aVfQKsVN5Z3+Bw/fVVb30sz Lz5WJo2FdftTC6gn3YUTzWN/zwPMMfcn6w9MBWflOLBGuSLLWKjenEYAg== X-Google-Smtp-Source: AGHT+IHBKN78R7j39kI8k6SwOOjSf0nf2zAscUO45Q82lKqTwh7rRketrVRkHyb2aOdJcrT2YhJwPw== X-Received: by 2002:ac2:5212:0:b0:53e:2ed9:8122 with SMTP id 2adb3069b0e04-53e2ed98271mr483438e87.22.1733480209570; Fri, 06 Dec 2024 02:16:49 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:48 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:15:56 +0200 Subject: [PATCH v6 02/10] ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-2-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8709; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=EegHdO43wttEGSvBPAP1XP9XLQCza9RJKUHmlnMlwfM=; b=owEBbAGT/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8JpZ0uzgiMkc1RQcGnziD6LviDnXwQJo39+ cmwDJDx3TCJATIEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCQAKCRCLPIo+Aiko 1flLB/dhCO0uUe810oaTMMYDetmU92yqUv3OIxKOSG7kcl+hytOoDgL6mTCUscXMhaHXOc664AP QseyGteNOmYqm89MhVCJ28zrWIfP0bvS0dpuCjRT9H8j5t73jV1kyoeuTHrd2aejzILukwFUoU8 FivcE6sIEITBtmrTDOzH7EvyTMIDtr5zP699plq77NXG9hGrr+wmEae/PE9Q8/CIg981R+s1gVo +gG9QcQpwgoNU/9Phu/8UktVbwn07vyhELpWEJWxe3wQAoQjoS7WFXCcMeu6QZyIpyejVdiWFFb kLkSQu68eGZx4H+hj4BfX5m+ZpNCW/cYa296HMhsF2sGtxA= X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 940083e5d2ddbfc56f14e2bdc6ddd0b9dd50b1f8..7734e389ca7692f7880aa9b8650e45aab228c7fd 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1466,7 +1466,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) @@ -1476,6 +1475,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 6fc537c9048f5c8e57e30f083121c9aea6b99a5f..5130e96acc34c28fb7a509b8b2a858ad465137a2 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1660,7 +1660,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) @@ -1669,6 +1668,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 3c8f3532c79723e7b1a720c855c90e40584cc6ca..6dbe3d0b7004e6d587bd868907d45e7f75c345d9 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1237,7 +1237,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, @@ -1247,6 +1246,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 f536ca60e162dca6b50b37854ca6de2c114bc2a1..69f98975e14ae367f482862724a358eb138ebf6a 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -714,7 +714,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 Dec 6 10:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896872 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 325A4202C2F for ; Fri, 6 Dec 2024 10:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480218; cv=none; b=fnHfdw7EA5Vvqs50UxKlb/eHuH7t08jttslPwKT5NroP1G/gu8lhUNK7zz44dxyDGrea122tqf9uU4olojjPD6DlP/5eQPo3zm9bq/giVO+HtCag1/Prqfx393IuXlAk+KuhrCD+xjGhGVfIl6KYVgvaLBf7SyIcrlvpbRHkV74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480218; c=relaxed/simple; bh=0yfSAj+Ddm4WUhYXZ6Zpqkhn0w9mLLpLbC5N4C3p0Yc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JGfB081uZpOm0x5hUi5XGBioQxOefBFUb8dwcVPfAe/dw9jssIPSZUfqL5jJdNwpk1Nvhj5s5xzx7it21kiq/yw4EbnHI612dhOc2AwP7W1i1jEwLbNglfmhJejag9iqJGKvyYeeM5SQqj/hlr9mY1vsVJDvI46YPmDTXqwEU/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QYtSs1u+; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QYtSs1u+" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53de8ecb39bso2524030e87.2 for ; Fri, 06 Dec 2024 02:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480212; x=1734085012; darn=vger.kernel.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=RHKs//nOKBy23KEY06Dh0ph1h3nqemTg+AYacD+4hL8=; b=QYtSs1u+N815SzBZtw2xtwhVWxvr0i6S8w+hHPcvKwB3di6CM1epM1RXAklbnJxziF YG7oYOzjoBLm8J5Usfk9W/OQ6hVmmvPz5tTlsIGcSlKlBtBaRADbFy9eYgqiwpI1NW8g DZWRPGCCZsZ+BVqXBgzHLJpMHyhIFI5iyMFDfnyDTBvlVJ9372hyjGOJD/0oHh3rlALq sKB4Ijn52n1WYblnkEKra8cWKW8k0jI9AhzgjMcSra8Ls2hDmb1wu4tlFqDAaBPslX08 3zYRvTgqzEFOUdMNFa2F/leFTLhSevphsmTbtthXmnTALSAbFpH2dSC1RZtDNUq9OavN fahg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480212; x=1734085012; 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=RHKs//nOKBy23KEY06Dh0ph1h3nqemTg+AYacD+4hL8=; b=cYShrtQqKB9ZDAfC6VpLvu0jeXtEK3eqQxW7u+L2LAXGimBuwPTGpIrEGoDpf/hGH/ UyKics0yGRM2Nh7uAbW6TAL3Wlodvu9UZ8KX2nqv2t3Bpui9wz49RiwqW1msWRgp/Krb VhTY/2T+Pw1gU6lXYRAdEhhMBVco4plQocxDUc8YcEjTBhfzW7wctuIl5TDkL2wY5iJK Vsw7zE06FU3C8aNa3KQZmtfDat92tmw0KyJeB/H8jKPk61zKWmL6RMW4WZTFHvrc214B CYA8+cl5dmHqgdFdHeqH/yU4oKFq7yiOvsLsSmyaAjGrBeG+ToQpzp/mZZK8OKLuh8FN XB4g== X-Forwarded-Encrypted: i=1; AJvYcCXR2d5JYrVykdhx/WBqxl8XqcIR5Qgtn6E1EmtMH5aLxvCDLQkUg2FyPWN3vgqt6Ew2HqkrUtpzTv1m0lIMrD9y/g==@vger.kernel.org X-Gm-Message-State: AOJu0YxlmbZbyLpAVVDh5mCcG7y85JeZbFhrb2h7S4NxQn9pUOlHokTX w+8n3HaQzETEaNX1pqZ/4DIi7eFi+hVPduOzRVZ4h+EKDA649elZbWUB9OrydPU= X-Gm-Gg: ASbGncszXq8Kkop6ipPczTSHuirFgMSXcmg77KtYnKHZvDiowGRki7N96Ji1/RAAIcu 8kpb25h2NM/ajjJqrvMButmAwgN2eGBmEPUDc7aH8Vykwn8MTX+k4qIveFw5nWuR2QEBu0gr/eU ujF5x97EadxjjcOUbIubhKLEXNll2fvhcrY1yDdEdiSGPAT3LICVAUjm0g/tIELSsJlyKdctt+m ftpCjO+ldgpBiKbsTB6aQtvRlF+YaAOpIsgJVuruV2oStg3IVC23i16og== X-Google-Smtp-Source: AGHT+IFoZ5ueeUOEXYSyd4R1xuvjuurob1TxEo4XEcBMUHjq9cOf/AGkf0uiijvLLApbZ4leIfX3jg== X-Received: by 2002:a05:6512:159a:b0:53e:1bb7:5896 with SMTP id 2adb3069b0e04-53e2c504beemr1108332e87.57.1733480212198; Fri, 06 Dec 2024 02:16:52 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:50 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:15:57 +0200 Subject: [PATCH v6 03/10] drm/connector: implement generic HDMI codec helpers Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-3-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=12561; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=0yfSAj+Ddm4WUhYXZ6Zpqkhn0w9mLLpLbC5N4C3p0Yc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8JRec8DWqtmbtDXZu9wSfsxHl4brT7Brggb vwUiPLPB0OJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCQAKCRCLPIo+Aiko 1U+UCACY4/MKhlAYB+OSf5BzHkkzwLeU0XSn55IY8RNYYZ8W6G2BAJz/Fbw5z+bNyH8hr2IQygn x0ud/l642NPfXRszQtev8kFWNwYE+MHypoBTrV5n4ITa3r0keTPbv2rno7l2jurM5rknk7Xxpd/ 5ibwWAeEa3tFWxmYx3iEANfxhjZmBEtDsx+Wc+45Fy0/dCv/mrJiwSCRatuIDmc/0n4v8DJWkLl meXp1j6MU9VQ7w3yqO0B0ehEX+cosrE8yhNdFhn01soWMY3zDaHOx9ic+BKX9BmyfXHFKIx8oWI yYCJ7dGP5lAsX3U+K7d/QHpC6UNDfqHYESafuXhhwdUMuejs X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 | 5 + drivers/gpu/drm/drm_connector_hdmi_codec.c | 185 +++++++++++++++++++++++++++++ include/drm/drm_connector.h | 80 +++++++++++++ 4 files changed, 271 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 bbdaaf7022b62d84594a29f1b60144920903a99a..4abfbded962bf45b793a2bd5b1b5c4d9f478a1f7 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -280,6 +281,7 @@ static int __drm_connector_init(struct drm_device *dev, mutex_init(&connector->eld_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; @@ -632,6 +634,8 @@ void drm_connector_cleanup(struct drm_connector *connector) DRM_CONNECTOR_REGISTERED)) drm_connector_unregister(connector); + platform_device_unregister(connector->hdmi_codec.codec_pdev); + if (connector->privacy_screen) { drm_privacy_screen_put(connector->privacy_screen); connector->privacy_screen = NULL; @@ -670,6 +674,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..1934fb53b4d128434559970c9fea548bbc4bedda --- /dev/null +++ b/drivers/gpu/drm/drm_connector_hdmi_codec.c @@ -0,0 +1,185 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright (c) 2024 Linaro Ltd + */ + +#include +#include +#include + +#include +#include + +#include + +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.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.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; + + mutex_lock(&connector->eld_mutex); + memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); + mutex_unlock(&connector->eld_mutex); + + 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_init - Initialize HDMI Codec device for the DRM connector + * @connector: A pointer to the connector to allocate codec for + * @hdmi_codec_dev: device to be used as a parent for the HDMI Codec + * @max_i2s_playback_channels: maximum number of playback I2S channels + * @spdif_playback: set if HDMI codec has S/PDIF playback port + * @dai_port: sound DAI port, -1 if it is not enabled + * + * 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 device *hdmi_codec_dev, + unsigned int max_i2s_playback_channels, + bool spdif_playback, + int dai_port) +{ + struct hdmi_codec_pdata codec_pdata = { + .ops = &drm_connector_hdmi_codec_ops, + .max_i2s_channels = max_i2s_playback_channels, + .i2s = !!max_i2s_playback_channels, + .spdif = spdif_playback, + .no_i2s_capture = true, + .no_spdif_capture = true, + .data = connector, + }; + struct platform_device *pdev; + + connector->hdmi_codec.dai_port = dai_port; + + if (!connector->hdmi.funcs->codec_funcs->prepare || + !connector->hdmi.funcs->codec_funcs->audio_shutdown) + return -EINVAL; + + pdev = platform_device_register_data(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; +} +EXPORT_SYMBOL(drm_connector_hdmi_codec_init); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 1e2b25e204cb523d61d30f5409faa059bf2b86eb..1d113c0ceec7ce8196a412d7c00a1737175c6fbe 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,17 @@ struct drm_cmdline_mode { bool tv_mode_specified; }; +struct drm_connector_hdmi_codec { + struct platform_device *codec_pdev; + + 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 dai_port; +}; + /* * struct drm_connector_hdmi - DRM Connector HDMI-related structure */ @@ -2121,6 +2188,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) @@ -2148,12 +2220,20 @@ int drmm_connector_hdmi_init(struct drm_device *dev, struct i2c_adapter *ddc, unsigned long supported_formats, unsigned int max_bpc); +int drm_connector_hdmi_codec_init(struct drm_connector *connector, + struct device *hdmi_codec_dev, + unsigned int max_i2s_playback_channels, + bool spdif_playback, + int sound_dai_port); void drm_connector_attach_edid_property(struct drm_connector *connector); int drm_connector_register(struct drm_connector *connector); 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 Dec 6 10:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896873 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F317F20765D for ; Fri, 6 Dec 2024 10:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480220; cv=none; b=a56on9XK8PDHT5xMFT89F3pID8gffRqLfwQhZgKakI1SYO2hI192CJ8/V6pxR871zkoszWJSR/xAX1kyUS3wg9730lnj6EcLY4zYUHpNLBQ/xo7dkzub1mbLL7dDaJiovkzcy59VuTixvXhYrKzgUh1tMu8tR0xRBh2rTKgZDOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480220; c=relaxed/simple; bh=b+kD+GGfMX4IeYm4/zVmi8YnnM9D7BF1gQ9GNsjSPBU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MSqjCcaDsEzLv3MSdDgEZfUGTqCD6vrGhblMjJUMm5+x7dfSqCNWztbPNkPUSISYFEhSrPfGrSIF0gHki1dZdlHRPnPdQcteFKceX85Ik2jTSfN+7hkxIiuCZheINx3uv52q3W/U6CJUoPkko3HRnmzXJT5JwqUgrI3MRS53zJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=o0Q6v8aA; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o0Q6v8aA" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53df80eeeedso1967691e87.2 for ; Fri, 06 Dec 2024 02:16:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480214; x=1734085014; darn=vger.kernel.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=23NpFOv9+trBwXgoTdLMEtZogD9sP0WWw4oqP5QnN+o=; b=o0Q6v8aA+HXNg0m+7ZniFeipqNEOwEr51Sakm1lFFYfNkM9PSiMLVaYXfBR5lg+mv5 nChbgHL1AAFyjMV9nlc2dIgnERsYIaDIzP7qIgndf9G8dCU4/eTVh5pWJhwDKy+E51Vb pPIdYPgNoCsh3reqoj3bKiNcLdh1iSsQAB7WyaqDbPz2Jl75UNfz8h2OYeaNQTkQMYe9 57sTp5NzVArNR4vQXUIQLm1Fd+3DL9uz7VRoNJzG1j2cRAulRS0P+YqqeYQncYdvyGSJ YUXA8vxm7S9JbCgPyjp6QGUWxNdlxWszQubaYeeDA8l161jeml3qBQwgHNV3RFM8ZA3H gREg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480214; x=1734085014; 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=23NpFOv9+trBwXgoTdLMEtZogD9sP0WWw4oqP5QnN+o=; b=sozb7qBsl2WNdWu1QbevP3bfrjFMrCJRvet4wydfGVTDa8lPZfs7EuMzgRyVQRh63Z lWfgio43pa/LBnQjy/miKdUT0DmadMt9YuQfc12JeYr0qv/RN2cUgQwYN0pMbvX5rb+q pUv0m40VHxDpyDGEyd/kI0z2PaYpyqiXqY6Gxh5Bx7ZgZuPUKYRz/Rv8+JyXH4DQSsrf dJYpSoBdBa6M8KohjDgvfhtt6o3gw7hhl9Vdqsu647qaPjgRUV6dwc2uUu7+NPJvDZiW tMoy0xzp7tpiuhHAbEyQeYoPJl4YRDwZ0uUWAzAIJJBgutFvVseo4wYfS/rdY8HG4/rs yqfA== X-Forwarded-Encrypted: i=1; AJvYcCWtgAZiSm7ESeJrx+e2q1QZndE7+n+qcOumfDHfZGp619rlV+wzk37iVpohlBPJsfJwxKoVgInU1kaRBiyHWnR6Rg==@vger.kernel.org X-Gm-Message-State: AOJu0YwoZmyw2nmy4JCJlZipDWmUo89kirP8fsBDVVet1UAvKU5lkIou fzk9mTkadbEdAWXCzDoDu/Y9hdD42qKdq8P/xl5PdJXA4w12OjUgGytUzujSu10= X-Gm-Gg: ASbGncsjcKGiTvFIMD1Y+3ctBPUBl+hhGV8cCh+C4G8GJmGqFi9PU/zkogxf0Zlk0rh cOMCT5bTREM+vAA2l72sodT96hfQEq4T98JvGLddU/y/5c58RqxR7+FaE8LEJYq2C/R9x8tAa2w 0LOg5lzCJR7bDiLKy9d3hpGg2GkFtBGEPp0UGF+Yg64ecJCJylFdtN5HJcNoWwz196me7jnpp+V Zgiv3sVJj1meyIqMvYIo9T5CbKb0Py/n2fnzyzuu+pn8zdE0DKNUhF7Iw== X-Google-Smtp-Source: AGHT+IHYoxoM7GYC/RXRXwsY9aIS+FgvCMwE8/kYFPGH+zE3IIcRoYFa8DmKuD5mvJKqJ85kxF63Tw== X-Received: by 2002:a05:6512:e84:b0:539:e9f8:d45d with SMTP id 2adb3069b0e04-53e2c2ede3fmr750213e87.52.1733480213923; Fri, 06 Dec 2024 02:16:53 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:52 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:15:58 +0200 Subject: [PATCH v6 04/10] drm/bridge: connector: add support for HDMI codec framework Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-4-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7190; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=b+kD+GGfMX4IeYm4/zVmi8YnnM9D7BF1gQ9GNsjSPBU=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ3rQec7WHOaVG4Q3BLwzEHlil613kO2lc1aUw16pyxtU7 96sSXTsZDRmYWDkYpAVU2TxKWiZGrMpOezDjqn1MINYmUCmMHBxCsBEjkax/6+3SdXnWqWzq1hQ r2rLD+UIs9eMS/c/PuO3N3SfuY3x4RcbVeYuuXszdMfyJwk98t/6+rvjloW/OqEvU1OgnJ6j7Gz csflks5z+VNF+AfnZ2X+u3rRwnr1ZQzLc9e7ve6+uCEhu2j97tzPTk7DzsZ1qd8S3e7FeVH29Yo u8aG20ZHx3Vvtp3zeCp1IqvS9zia7VuXwyUEdT40NpcbhSb0We/iIxtsQQi47KybYVu84vmpC5S qjSRebQAxFlG8vmeG737gPv2Pc9njrv1c8iRjblM4/v7UjztOFdcFWg9/36C6cLv0axPrQ8L7Et 5kr7n7qwsvVhIUs55JLeCCt0Cdb5Kh+SiF3Y+/nw47K7AA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 Reviewed-by: Maxime Ripard --- drivers/gpu/drm/display/drm_bridge_connector.c | 100 ++++++++++++++++++++++++- include/drm/drm_bridge.h | 38 ++++++++++ 2 files changed, 134 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 512ced87ea18c74e182a558a686ddd83de891814..4fa1bb73d430d02d5b79a1a184c203ec9e9c66e7 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -21,6 +21,8 @@ #include #include +#include + /** * DOC: overview * @@ -368,10 +370,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, }; /* ----------------------------------------------------------------------------- @@ -473,7 +545,9 @@ 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; + ret = drmm_connector_hdmi_init(drm, connector, bridge_connector->bridge_hdmi->vendor, bridge_connector->bridge_hdmi->product, @@ -482,12 +556,30 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector_type, ddc, supported_formats, max_bpc); - else + if (ret) + return ERR_PTR(ret); + + if (bridge->hdmi_codec_max_i2s_playback_channels || + bridge->hdmi_codec_spdif_playback) { + if (!bridge->funcs->hdmi_codec_prepare || + !bridge->funcs->hdmi_codec_audio_shutdown) + return ERR_PTR(-EINVAL); + + ret = drm_connector_hdmi_codec_init(connector, + bridge->hdmi_codec_dev, + bridge->hdmi_codec_max_i2s_playback_channels, + bridge->hdmi_codec_spdif_playback, + bridge->hdmi_codec_dai_port); + if (ret) + return ERR_PTR(ret); + } + } else { ret = drmm_connector_init(drm, connector, &drm_bridge_connector_funcs, connector_type, ddc); - if (ret) - return ERR_PTR(ret); + if (ret) + return ERR_PTR(ret); + } drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index e8d735b7f6a480468c88287e2517b387ceec0f22..fd7ad7315a8bfda90f02b0704c33ba0e356899fb 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,27 @@ struct drm_bridge { * @DRM_BRIDGE_OP_HDMI is set. */ unsigned int max_bpc; + + /** + * @hdmi_codec_dev: device to be used as a parent for the HDMI Codec + */ + struct device *hdmi_codec_dev; + + /** + * @hdmi_codec_max_i2s_playback_channels: maximum number of playback + * I2S channels for the HDMI codec + */ + int hdmi_codec_max_i2s_playback_channels; + + /** + * @hdmi_codec_spdif_playback: set if HDMI codec has S/PDIF playback port + */ + unsigned int hdmi_codec_spdif_playback : 1; + + /** + * @hdmi_codec_dai_port: sound DAI port, -1 if it is not enabled + */ + int hdmi_codec_dai_port; }; static inline struct drm_bridge * From patchwork Fri Dec 6 10:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896874 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA68320ADED for ; Fri, 6 Dec 2024 10:16:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480220; cv=none; b=FenRJPigzTr1uqL07bJ9wQLo/rivuqKvH4Ul7INtVQ6T9msnQHR3JoTE6k2aUjLV4n1KgCjhGg29GjkXdFEoPddF6Fq0gjlx23NBzr/KF2pNYjBNdaV0TvVxrUbH8QFXZitoVpr6pb0cA9+zARjIA6JJWCV25quYmbT2Um4HkI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480220; c=relaxed/simple; bh=+67Db5QR/nsja/ue4a+VGF3IOxdNSnDuXouI0gIrYtg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UsCu5OmueIZF/PhsRtHvLV2JDP+ttn3S3wG+hTM09Qcb08SFNDzgzWx4EuzzRpk3zdYJD95APqX3tf+5ZIHHPVWtS0iY+PqaTuTi+XICQ2lvHUOk5VVMftYeYM34ryPWPM8hUXg9gVNZ+pI4jk4tC7cxQiDDeF71JhLx5auOGgg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ELgbiB8F; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ELgbiB8F" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53e384e3481so93783e87.2 for ; Fri, 06 Dec 2024 02:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480216; x=1734085016; darn=vger.kernel.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=vdhbM8g3M0NP93FMRv6ZaSecbbnwku8p9d6VdNVGSLw=; b=ELgbiB8FJ9VbMvcfjhCr3zAKyLT/CLMsdPipb7cn7OGNkgh+6iLTZ+/WNiiwuvw2XL BDjzOwohqMoBX3eArctWa0Lc8DTn9/vxzh1Ti+RnGxkCAYxVLgqaB4fIMqOkafnlnQc4 jS936WPx5SWwHWKolTRxD7dJrA+PtIw0pAvySysAm4dlcMvs9FxVy3e46irHdY1hhiLb f/44FoW0zwQsZ5xUMTIdP/Ny/x3j4L8LhcI25iKNbeepFy/rADyyz/e1DU2Kvq081nNf aJwV0NUP5S+vbOvJsChw2ndWv6xTDwCHm8BiGoooU/9m+29We0SxQMhlsP6fbHyD4eRK eFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480216; x=1734085016; 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=vdhbM8g3M0NP93FMRv6ZaSecbbnwku8p9d6VdNVGSLw=; b=XlB83PUb4L/MKBMOfE0JZxgrP+f1yJxMLroREnWfreGDa7mQIAaqndIQYeQf6jnGjS Dz86JYJkLrx59fjvrVSefD4kTnp41E08DEa7y/wXrHdUeSoxCXMNPzrPtMuspb2v7KLQ iCe5d2kRZm7cwsAgBDN8/MpAA5eQ8kF7kgoZziT7g6mIqJ/u9UapwuxFAO8of+g19akB PG9QMxm+zNVuN9q+BLHCBJclNCq78rEzpEo0nXhXngs+6inASqf1wyOamvKNCT8n5JWw ZLkavoFTq5r7ZUCd/OZJ2mkJWqy+wcDqu1k2JKJaV2pz6/9vpBU+nx6ynCES+/c6uwHN tSYQ== X-Forwarded-Encrypted: i=1; AJvYcCViDnKrxoo6swgGyXnHRJgbkOMhp0KbTbp697zrSEX/MHTQuvqTNaJrcRax9pZ5OS+Sjp016xqDxPhyhNb7y8cBXQ==@vger.kernel.org X-Gm-Message-State: AOJu0Ywqec5ov19yzD/uDdOgI6rT50qvglXnKKoCE8KxiIay10K0qbFN CT7Nr30/r0RJ0BpyVO3Euv9ep41bEfz2PXh5VV+n10l7Iix2gUUvj1slajasiNR0iu/3KmxAGU8 x X-Gm-Gg: ASbGncuwdzBn4ONGt+XwMAi8GAISNT5hdjTmfssXv9zPXvAUO7ennpfrP7ympKapxF7 6IIvTU2loXWXT1B08FnP05ecX5rKUSa0wHlXJwySVZPC2e2upXhIcjhQTckd7ovuE4X8XQCryqz RjIxoSpH82EGj9eW2zTI5rMhoBWs5oSyOqIMt2N83RFHMyJ3PnXj6oV1zUp2lgkIJAIAXXbN2wH KewOjMLS+VEz8IXSZDobY5k7UMThx+CIf6g8Kk3UdTOOGjaIANgiQSV3A== X-Google-Smtp-Source: AGHT+IHLAMrwNntawycHSzAoyVtOkC7Gtw6N52xdlcAMQPWcfc0l+WCOL0Lh45bakS9i5aF/g9qeYQ== X-Received: by 2002:a05:6512:1594:b0:53e:284a:70e9 with SMTP id 2adb3069b0e04-53e2c2f0085mr1211346e87.57.1733480215645; Fri, 06 Dec 2024 02:16:55 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:55 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:15:59 +0200 Subject: [PATCH v6 05/10] drm/bridge: lt9611: switch to using the DRM HDMI codec framework Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-5-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7839; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+67Db5QR/nsja/ue4a+VGF3IOxdNSnDuXouI0gIrYtg=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ3rQeU6JW1urPoTcvv+n0cF5DfM82cKPquzdU2UEp+a8d Xf1P5rdyWjMwsDIxSArpsjiU9AyNWZTctiHHVPrYQaxMoFMYeDiFICJvOZg/6d1qv6zrv4+PZEE XnYWXQmH3C3vpBjnH3v4oaFKQqV17vf7M6fdfj33n6dt8K/mlGMhuj166gWtkdkBXt3foyT3pE0 +XbWplHXd7EApkYa+IimTfR1KB9/UiE83Sr7Lpf+hNnhidYbSWVnf/k3zki80N78496XvfxGXxQ nvg6aVUxbMlWOoXc682meZS7L3D0HeAl/d7bdktOf5XHerm/9IjXHmzGO3dp5/p3SiNUJRXaP29 iSFl4fui7s4J4vJLv8md+OMxNJZ79qS2n6e/et2cFaHW2aOBFMkr5cpj7BH5fTjAs89rD55bb4z aaq+S7G76c3nMowSK8SWMz1b8tUxpdjxWoH3GvUC1ccMAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 Reviewed-by: Maxime Ripard --- drivers/gpu/drm/bridge/lontium-lt9611.c | 170 +++++++++++++------------------- 1 file changed, 68 insertions(+), 102 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 60b7305c0fd1935e35742713c78937392b7faa79..63aa751c412fb90d6edb4b5331138e94f19de37d 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; @@ -864,6 +863,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; @@ -897,6 +900,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; @@ -940,6 +948,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, @@ -960,6 +1017,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, @@ -1013,102 +1074,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; @@ -1172,6 +1137,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 | @@ -1180,6 +1148,9 @@ 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_dev = dev; + lt9611->bridge.hdmi_codec_max_i2s_playback_channels = 8; + lt9611->bridge.hdmi_codec_dai_port = 2; drm_bridge_add(<9611->bridge); @@ -1201,10 +1172,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: @@ -1225,7 +1192,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 Dec 6 10:16:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896875 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFFEC20CCE1 for ; Fri, 6 Dec 2024 10:16:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480222; cv=none; b=cDLoUXP/vLktkyiUqqeOUTjnTdOlk6fzuk/aM17SK+UHzTW2ZuqW0Bza1bsqRNzeCQlKGbuZVFQ5jQUuKrnTvNH9IGG+fQe3O7VUqtjBh3pYePdoQSlRvHPp0IwLu8wqw7xZdlqIdCdOqkjPTZ1nUexZ7vi5B0OpBKZKxxtMkQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480222; c=relaxed/simple; bh=cLr7rcMCKctpWvNtnt4BFuThw021W03l57sijxoziRQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=psmTlXi6QqnpUcTLbRrthAzDi42f+9N9570Z58cdvyYx7tmE7mOZx+LuTBjaZaU50HnaeKJfwth5gG0tBNKkLX8/hhsq8PLYY2OsEfgLLXYS0DKxFyOlQyRl0v5siuqIgolRKzQslmptTRhDWhqu8kH7pIK1LKOwldyESq9j1lo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=r8rygyiW; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r8rygyiW" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53df80eeeedso1967749e87.2 for ; Fri, 06 Dec 2024 02:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480217; x=1734085017; darn=vger.kernel.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=GHXQ08P5B8mUzCAvgp3K0OAFdV2V7CRGE9vgNvuacPg=; b=r8rygyiW6eJuHAaHLtGnYJBI2F+A5P0n1PIS4yOBSP7c5C822aa1tKzhh1USr2FqQf EXbvMOkfeRLNNoU+Y7pDhy9rIo8g6fFIWKXvW6ZCram6P7itXYibaJ6CQf5c0PwCi+Id WX8E7/InPpGe+3xKVRnH0HvEecYWihkHdya6Wa8i5TRM71VYsKXSJnWkmtf5vIKmukV2 U5SxxxNtEKFs/9tOcpzqOOYrUfS31td+LJ9K9n6aru+0g4IHIzg2s1jcoq2Zm6qTvlii dnMO/NMckmu9SgyphgOyli1/h/EBbwyPKmamzVZ5cp0sz/sF9hRqLYmMbOhUB8cP5edX SHnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480217; x=1734085017; 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=GHXQ08P5B8mUzCAvgp3K0OAFdV2V7CRGE9vgNvuacPg=; b=CYoC8XW0iSk+okwAZfmEYJsyAp6DHbD2hb42Lhi8h9TnwbfFbCF2FYcEpUueJKuS+l g83bzBguCKH0R4qgxDXzm9CCx8iDWJYz1gFwkpe4YilgKJbRczBLTLqlaELS8ZQhedro hV448OznRMV55taky/kMKWxhJJvKdDVgX5XKFEnY69HymOjudPnjbO9HPBbMUB8BGlBg wJcYo8+IHN3PxZnAoQCHrBqz42J+ZdjI8PkHxtfyXGPAAFnBozKQw0RirI2xr0emUdmF UdOOEiwZUfChULkBOt+Zq+DzKq8pc9OIS/0AOfS9e3CvwP0gSE7cgLxSzqkIMczwvxUO 9qMw== X-Forwarded-Encrypted: i=1; AJvYcCUOBfmndBp2YO6J8IHi+LOyzxuKqlN0Pet9PJ+6mPG+OoBZHBT2gFP1P5j1J9NPSPPCf8Uw9dieMgr5z9d/YNER9Q==@vger.kernel.org X-Gm-Message-State: AOJu0YwEFqR5944f1cqdvDpE+rM9oh3qQdH50nyCaic2SMTzl4wRNu7f 8dlVlH1g9b3Ur18esqj4wruVFLW25Nwnef7lJwLydtkJiqxhTxz2315/PtuEmcU= X-Gm-Gg: ASbGncsRatyEEviKgYvPWHp4/w90YTNmpvblF1o/CZrutFUX0FBAEIdG1oi73pc9saE 8kortAd9iKR2g3D6af/lICb301l5k6MMFR0TwZY6RF4aNeorzrBDMRngmBnR+9/EtAZj//Tenrh YNgoMcswbAJf5Ilvjo48GqBgT83aFsOkMxgtg7CUs6THPh2WLVAn/BwL8oLXOkPz2J+DLZJhBPo wHb1navIfA1euhXKFXiXa50Q+S4GVxugwHofpwju+v2orRDhpqmRvuDPA== X-Google-Smtp-Source: AGHT+IHBBgF3TADMfzDewRh0RnUMlgyT5sj2IpwAyXtVR/5eduL7M8O2TXvbBzwVKqS3LKRU2nISMQ== X-Received: by 2002:a05:6512:3b06:b0:53d:ef60:ca9d with SMTP id 2adb3069b0e04-53e2c2ededcmr746863e87.55.1733480217491; Fri, 06 Dec 2024 02:16:57 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:56 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:16:00 +0200 Subject: [PATCH v6 06/10] drm/display/hdmi: implement hotplug functions Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-6-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4668; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=cLr7rcMCKctpWvNtnt4BFuThw021W03l57sijxoziRQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8J3TYcPOcFa14DxHDG+xCfnhUgeaSE3pmsZ R3RuvxUPtiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCQAKCRCLPIo+Aiko 1bY7B/4+CK2IPr0ZGyjRDhrjaTsOqjmocrfgRtyl3xVEfwHzU9LuHdX6kQQeAuBpj8yrhP95Lrc mJaqwUlGlJVWI2p41ZWrO45zfQXvGkclr3viN4DqtVp1wOkUrySmjzdDtwWb8O955/CXSlOkPj4 shNBlMA/0EzPl4Sey9z5n5owN0nB1SFzkv7pXmLDh+ueroDtWgyLV6lM8aK/oC2d2vB3p5NonFj iq5QAwa4io9tByWFbLUrhaD3YP49rrj6olPhm2uUF+4vE+bhp+jb5smE9iwO6URvP0KGtG7W5Y8 gww2J/ZuOGHRT1+pbIcV3exbZQ1jdd0TnTjcc8oprf9DeMWO X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 drivers utilizing HDMI Connector framework. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 61 +++++++++++++++++++++++++ include/drm/display/drm_hdmi_state_helper.h | 8 ++++ 2 files changed, 69 insertions(+) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index 80bf2829ba89b5f84fed4fa9eb1d6302e10a4f9e..4cdeb63688b9e48acd8e8ae87a45b6253f7dd12b 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -769,3 +769,64 @@ 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_hotplug_edid - Handle the hotplug event for the HDMI connector passing custom EDID + * @connector: A pointer to the HDMI connector + * @status: Connection status + * @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 + * drivers should be able to use @drm_atomic_helper_connector_hdmi_hotplug() + * instead. + * + * Returns: + * Zero on success, error code on failure. + */ +int +drm_atomic_helper_connector_hdmi_hotplug_edid(struct drm_connector *connector, + enum drm_connector_status status, + const struct drm_edid *drm_edid) +{ + if (status == connector_status_disconnected) { + // TODO: also handle CEC and scramber, HDMI sink disconnected. + drm_connector_hdmi_codec_plugged_notify(connector, false); + } + + drm_edid_connector_update(connector, drm_edid); + + if (status == connector_status_connected) { + // TODO: also handle CEC and scramber, HDMI sink is now connected. + drm_connector_hdmi_codec_plugged_notify(connector, true); + } + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_hotplug_edid); + +/** + * drm_atomic_helper_connector_hdmi_hotplug - Handle the hotplug event for the HDMI connector + * @connector: A pointer to the HDMI connector + * @status: Connection status + * + * 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_hotplug(struct drm_connector *connector, + enum drm_connector_status status) +{ + const struct drm_edid *drm_edid; + int ret; + + drm_edid = drm_edid_read(connector); + ret = drm_atomic_helper_connector_hdmi_hotplug_edid(connector, status, drm_edid); + drm_edid_free(drm_edid); + + return ret; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_hotplug); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h index d6d65da6d8f9ee46de33114cce2d6fbe6098a862..4ffd40d73d50d89449508b7a5ce5836a596638a1 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -6,8 +6,11 @@ struct drm_atomic_state; struct drm_connector; struct drm_connector_state; +struct drm_edid; struct hdmi_audio_infoframe; +enum drm_connector_status; + void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, struct drm_connector_state *new_conn_state); @@ -19,6 +22,11 @@ int drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector int drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *connector); int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector, struct drm_atomic_state *state); +int drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector, + enum drm_connector_status status); +int drm_atomic_helper_connector_hdmi_hotplug_edid(struct drm_connector *connector, + enum drm_connector_status status, + const struct drm_edid *drm_edid); enum drm_mode_status drm_hdmi_connector_mode_valid(struct drm_connector *connector, From patchwork Fri Dec 6 10:16:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896876 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 563FF20C02C for ; Fri, 6 Dec 2024 10:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480223; cv=none; b=dTDa5dQLOM2IKR0I7jo6p5Wecgt+uiN9kjsDjzqVOWI9Oc37ppz35BPDT5gDHz1r4WOXGPKGmeqSqN5nDlKkdvcdjFJCyGQb5cX/Bs0r+OlKyR/mdDOSoRy1AYXGIwCiDWMyxvo4majhVev6Qd5u5qVlNV38H0f+mD6EsQUVs7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480223; c=relaxed/simple; bh=mWpkFqjp1yyO8iD77i9han60egAD/evnvMAnr5hrOdc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MAqDemg8kw7flMaxnQnySKIC4hrP5KVGkpz1qUs3o1Hb+gClR8+GsWgFZdUya0uRsytiBX7JMM3X8t9QGPMjHXI3X/9gRhlhaW7EBoKUN2U3f3AMH1jwk8wiPEGqsJG1uVB5brIS31MByovKHtg/M0joZel6S98E9Uhyt5nGOYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dWmtt1Mt; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dWmtt1Mt" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53e3778bffdso220586e87.0 for ; Fri, 06 Dec 2024 02:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480219; x=1734085019; darn=vger.kernel.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=unYAkXaFAf42yLsiWl79k+U7AAWsXSetaGBwV9Nyen4=; b=dWmtt1Mt/ZF1LYcQpHG9u1Xo7Kdnso3Fw9+fbGy8Urs7m0oMYyyBklV9z8mdChoE+v QtrVnb529YmnsWBoJmxWvMdmtOyM3NY4SvUz8Ntsv2Q1m6boM0bgN7QTZ0r23ePP9NSy q80asJ6g6XJOgeDcPDqIradsE6GLp/C7AeqRHXF2gniy5y7DW1dKRomh4OH0wm2hJoeh 7/XmAR0FKhIbhR/6Am+xRGZudUWjgQ2HGCmmTIDGqAIQfogtFW8xCg+KPy7CKpBxFfQ3 gM3yE+BZI96m4DHwzs3vH6pSgAsPFOR2G+agualgpiMMb7jx3J+uoVjxWoQKjIEwYiWh XgUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480219; x=1734085019; 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=unYAkXaFAf42yLsiWl79k+U7AAWsXSetaGBwV9Nyen4=; b=JfWg8zAH/CbKGHRUYaji5lVczvopNFdAfznZblACrXMYOANzEHorueDm+Pgm0fDYr5 GhOOU37ig7VkMl9z0zON8l3MWNsLycNKNj+4wD8ckUNAw9NznEqGDnPe6W+l3S6SCCqo NGO2ughAaOxdgQ0k3FvDgSp0WiKD9VFAvdrpWBv2SqUf4v8ANciSuh1ZAvGpBkOWOOKw +U1vj5DiBhS3VgBreEpAR9aksOY4LwwWFTDe2Py7LY6EA+xT7Bqobtcz8NSFEvCkSuMz j16WQuU/AmKFhDfB+z0BwiGQ5NAWMyaOaux6s+i5hPgQ1Tj9Ry7dAj7yVQlEozWlLN44 X2bQ== X-Forwarded-Encrypted: i=1; AJvYcCWbywC2LT/HMU4NxcJ7FTIGaeRE7QwnyjZr6400VCOzx1aqxcLw0+CH282slezJcT1aU78BIcJBDStsKo+bJfye1w==@vger.kernel.org X-Gm-Message-State: AOJu0Yz9y2NNVDSCE9lHbkd2HfUhQRd9nRKRcW2HLCG5jwyy457j8H0L tN8wHboc65xKP8sJrRUgZfYFAMaOKlpTnCkKwsWcDFm+PJ+feMaW8kbkGMx6LEk= X-Gm-Gg: ASbGnctQsBrQbbE1BmhITHwKbRiHH8X26nO+ekWwfJi63rDPs6u2djR0BmaYpaFTzZK 4sPjQfAilxki5drjozDuJwTgxtFcm974KTQ9ccAsZzy9t7/Hp5EgZKLtFsL4A9/mjNi3w4Vlklz btDLi2EI80OFGBjhqojggStB3bhzUkgxzWuyVvyqAFLvy2sBtJg3K5W6g6VHaCo9I7LN4VWDndI hJXGe3FBlA7YmMyMkjkEQEMHC32YtUjXxgEFqRuAvMBqDuzoLMmha/XMQ== X-Google-Smtp-Source: AGHT+IH8kc6+cltsERv2tTI87w9RpzrI/Uxd36n75mjO1x7LsaWpJdqUf3dwGEmcu3AmNY3dvipvnQ== X-Received: by 2002:a05:6512:3c82:b0:53e:1bb7:588b with SMTP id 2adb3069b0e04-53e2c303797mr785196e87.44.1733480219213; Fri, 06 Dec 2024 02:16:59 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:16:58 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:16:01 +0200 Subject: [PATCH v6 07/10] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_hotplug_edid() Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-7-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2587; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=mWpkFqjp1yyO8iD77i9han60egAD/evnvMAnr5hrOdc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8JXoJleVeXT84oS2M6AvDZrSRqHGCIJXg/5 lKSomHX+x6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCQAKCRCLPIo+Aiko 1f/YB/41OkBVU1XNEzkbG3DFY23S7DFi6wn2p8ZEfwQDqQLsyhZyNih+ddfBVpgTUXQvmrBZq8m jEoBlwO6SyUFPTywjLRGEna/tCKshIaqoAP8bnj8L6rSMqfhmrLqUH66F7UYeIjwGGE0uE2JGRy f+WlCpQUacATeokiK7MFZVVHK4lACJtBnqABGrh1qEuBurO2OPyoDaHl8qncLNKcFYORUqQGUDF 5v7R06MJ22XXDshojT4piLRisvT1R3QxDA5xO6/+mZScp0e6U306TQvzKyV0Z034+8I07KtdgIZ lmUAoiLMZF2w/xvIwsLBKtV6o/962J/nSm2NMiY85RFQDbNh X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 4fa1bb73d430d02d5b79a1a184c203ec9e9c66e7..0ff82900bd07933e292948446b9637ebf2076694 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 #include @@ -182,11 +183,29 @@ 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; + struct drm_bridge *bridge; + int ret; + + bridge = bridge_connector->bridge_edid; + if (!bridge) + return status; + + drm_edid = drm_bridge_edid_read(bridge, connector); + ret = drm_atomic_helper_connector_hdmi_hotplug_edid(connector, status, 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) { @@ -278,6 +297,14 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector) to_drm_bridge_connector(connector); struct drm_bridge *bridge; + /* + * If there is a HDMI bridge, EDID has been updated as a part of + * the .detect(). Just update the modes here. + */ + bridge = bridge_connector->bridge_hdmi; + if (bridge) + return drm_edid_connector_add_modes(connector); + /* * If display exposes EDID, then we parse that in the normal way to * build table of supported modes. From patchwork Fri Dec 6 10:16:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896877 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF1AA20E315 for ; Fri, 6 Dec 2024 10:17:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480226; cv=none; b=OHhvsJyAlUI8SGi9PI3QRAFWRziyfPA8C8oZCF3w2Gny6lO/mzQNMKHgQIomtAufyGygYnXPvuOwGbEh/u28EsT8PPHcDjCuCnVrVsa6LeXwCSLGwuufaGFAsiyNbTWNxR5VHJ5bIZVRrWUnp07H1wmD/d1V8RRFbqzPYEChU6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480226; c=relaxed/simple; bh=PRnZq4B5Ktw6BMnqK7ttcTjo3h2X+ci9xQT/AomNEvo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o0W0tGsWsFMKXtmvvxE/CzclMRGBbby5OCqJAq7VGZE9FKyrKzQXaLiyMu/7NymYYgqc15g4OckWsLoo826Tk3isOqtEVU6eYpsZP/VNdErDeVnw8zmedNCg/oGV6+AaBwm0/nQmwE5k+egjyeOkYZzmLWh0H3fJS8VWa84xcn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UHnoZO4j; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UHnoZO4j" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53de880c77eso1989114e87.1 for ; Fri, 06 Dec 2024 02:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480222; x=1734085022; darn=vger.kernel.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=7E9JcfGQDN6ZUBFwEUPgAGm2RBAtRtCRdkRTCVbrXmE=; b=UHnoZO4jkU2xE/rYHTJrzjAyzA15yp+VE0n+Hxo8Xgwy5oxT//grTgrs7SYYA+UwSB zQVJc2VptprVCtB9m0ix9GRUaSo7qfyA3Rzm/9xcKlDsgqvJvqKKR55+eaw5ghJ6Sl8f 2O8QtZnbGvAu9DaWzV01I7NfE5YGj8gHOKTtivLsdd3a/HL3dGtGp+3at++vcTJGykob GLnBQBcGhVg5lnp4Osbi9ywEQctMNvuv4bD6SYNyFm7gu3VbEmoBp1XRNGqsXaF8NAye Bgt1dQuWb7231oPAHeo/BMpUoOHylLM1pimKV3sKCXwm0kgCp34mUBRqxe3KuxnLLooq oyjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480222; x=1734085022; 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=7E9JcfGQDN6ZUBFwEUPgAGm2RBAtRtCRdkRTCVbrXmE=; b=L0vmgH9uc6HisH1P7PDLXLbFlbuq0p0m6o58Uv6l0y8x/cDsXmGugFaQAMvkni1jb2 ey8+NN5D7HmECQfgzhxfVhVm8r0tDiO2QQd+zfRDZz6Z19oTtsnjATj388QF9iah3rBc ByMqgxUkBHegtDCR+7ySjUrKVlLRI8SWu9Le27zKVf8TZWEoJjG/52YFyYJ0QPatA5SQ P++ODjVRVdZn9A4ifGpCyq5lD68OgaTavWimQcK29PdI+uB1/5gk+qRRCFH5UVrPuczY eCdDbmiDwq+4J9qQPGTtR/SuKwoIdVc9/gLQ8gWpywEZMzwpMcMNkHcbJPYy1iuve/ti 4DQg== X-Forwarded-Encrypted: i=1; AJvYcCVziLw1thbN3mhDXNgWPfmT873tnZUhUVYjM2D7PMgs6gyIlqCZfKWZu8V8K3TcxGz4ZR0uy27jBQN2zkphNHdsZA==@vger.kernel.org X-Gm-Message-State: AOJu0YwRfhFa1MG8VXaVjs8eT0XS/wiX7grP/iEM+LzBUiFYON0wnIFz 87/FW0r7Jp8ulecpbtv3pJ0HfZXy80qCCe8BJANqXjAfkaQQleOXaB3coVVYftc= X-Gm-Gg: ASbGnctGeL0GJOz3m0HfN+2sxu6BrllYpY2XnQCQpy9Hk8SXuw6OZNUzmJrbFbo6Nwp 5i6I2P+DJp7i7ka/rw2P5kMdKsq2ptCjiPsgXsuJk6dNWcIzxq4+G4bouEHJqzfiq0sUjYheQhG UQFVtkZE8miWl82GjDc5fmIgA/Rmk23BuxM6nQHP1VF3JGqW0qBafFmda0qxx8UjdnbMVkzVeVz Gtv73m+7lUqC0dyP8sJJMbMB6KSNEwKnfkU02hVKdvPKAcpR3TWvBfuRA== X-Google-Smtp-Source: AGHT+IEC2BVOX/DQIuiiNOp1QiVCCXdIrMaFCzPJw0ZdKhdICHTciEnz1T4dSSvDlr0mcfJh/iz2YA== X-Received: by 2002:a05:6512:3caa:b0:53e:20d4:334a with SMTP id 2adb3069b0e04-53e2c2b5cd8mr720361e87.14.1733480221912; Fri, 06 Dec 2024 02:17:01 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:17:00 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:16:02 +0200 Subject: [PATCH v6 08/10] drm/vc4: hdmi: switch to using generic HDMI Codec infrastructure Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-8-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6786; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=PRnZq4B5Ktw6BMnqK7ttcTjo3h2X+ci9xQT/AomNEvo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8KVLoDRWj7WH319W1w/RLnRtHsbGLHohYKm YKafWEqVteJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCgAKCRCLPIo+Aiko 1ZlpB/4p+HFTN+BLlwyeSaGSzwPfl2wlqAF1r0NTeHzTV/JwWEKIDfnYREmyj0YrVnGYlEG1JqL qdPqJAlp/ja/+cPL9zZ/iGOLkCUGL4V8VcP7EfYLMaZ+Yk6IIeOumHBGR5bGFL65k406ZWvOhzd 3eBO0Qhz2sn5sXYvbbrOs/TbsGaxxWtbuoW+ztbMXLku5aWUd1OuTnxPP9st2MZPL216+Ew8m8D 6h6LdN+VwtNtTZPJ/Dhcq4IyGr6R9r3BhW8wGL8yEX6FFU+iQrRjvVMXcaDwENCg1FpQ/Zla/af XmPA4WHMWIDyS24iXKlpWn6wxM0LmiRGftyAsw/pkUiQSLH4 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Drop driver-specific implementation and use the generic HDMI Codec framework in order to implement the HDMI audio support. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 69 ++++++++++-------------------------------- drivers/gpu/drm/vc4/vc4_hdmi.h | 2 -- 2 files changed, 16 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index f98617b8bf6cf9d92a806e35584e8f8ab0ac9f96..e5ab42f72f618b90f956482db6c9c8074c1e3bf1 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -609,6 +609,10 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, if (ret) return ret; + ret = drm_connector_hdmi_codec_init(connector, dev->dev, 8, false, -1); + if (ret) + return ret; + drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs); /* @@ -1707,9 +1711,12 @@ vc4_hdmi_connector_clock_valid(const struct drm_connector *connector, return MODE_OK; } +static const struct drm_connector_hdmi_codec_funcs vc4_hdmi_codec_funcs; + static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = { .tmds_char_rate_valid = vc4_hdmi_connector_clock_valid, .write_infoframe = vc4_hdmi_write_infoframe, + .codec_funcs = &vc4_hdmi_codec_funcs, }; #define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL @@ -1921,9 +1928,9 @@ static bool vc4_hdmi_audio_can_stream(struct vc4_hdmi *vc4_hdmi) return true; } -static int vc4_hdmi_audio_startup(struct device *dev, void *data) +static int vc4_hdmi_audio_startup(struct drm_connector *connector) { - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); + struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); struct drm_device *drm = vc4_hdmi->connector.dev; unsigned long flags; int ret = 0; @@ -1985,9 +1992,9 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi) spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); } -static void vc4_hdmi_audio_shutdown(struct device *dev, void *data) +static void vc4_hdmi_audio_shutdown(struct drm_connector *connector) { - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); + struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); struct drm_device *drm = vc4_hdmi->connector.dev; unsigned long flags; int idx; @@ -2057,13 +2064,12 @@ static int sample_rate_to_mai_fmt(int samplerate) } /* HDMI audio codec callbacks */ -static int vc4_hdmi_audio_prepare(struct device *dev, void *data, +static int vc4_hdmi_audio_prepare(struct drm_connector *connector, struct hdmi_codec_daifmt *daifmt, struct hdmi_codec_params *params) { - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); + struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); struct drm_device *drm = vc4_hdmi->connector.dev; - struct drm_connector *connector = &vc4_hdmi->connector; struct vc4_dev *vc4 = to_vc4_dev(drm); unsigned int sample_rate = params->sample_rate; unsigned int channels = params->channels; @@ -2075,7 +2081,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data, int ret = 0; int idx; - dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__, + dev_dbg(&vc4_hdmi->pdev->dev, "%s: %u Hz, %d bit, %d channels\n", __func__, sample_rate, params->sample_width, channels); mutex_lock(&vc4_hdmi->mutex); @@ -2214,40 +2220,12 @@ static const struct snd_dmaengine_pcm_config pcm_conf = { .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, }; -static int vc4_hdmi_audio_get_eld(struct device *dev, void *data, - uint8_t *buf, size_t len) -{ - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); - struct drm_connector *connector = &vc4_hdmi->connector; - - mutex_lock(&connector->eld_mutex); - memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); - mutex_unlock(&connector->eld_mutex); - - return 0; -} - -static const struct hdmi_codec_ops vc4_hdmi_codec_ops = { - .get_eld = vc4_hdmi_audio_get_eld, +static const struct drm_connector_hdmi_codec_funcs vc4_hdmi_codec_funcs = { .prepare = vc4_hdmi_audio_prepare, .audio_shutdown = vc4_hdmi_audio_shutdown, .audio_startup = vc4_hdmi_audio_startup, }; -static struct hdmi_codec_pdata vc4_hdmi_codec_pdata = { - .ops = &vc4_hdmi_codec_ops, - .max_i2s_channels = 8, - .i2s = 1, -}; - -static void vc4_hdmi_audio_codec_release(void *ptr) -{ - struct vc4_hdmi *vc4_hdmi = ptr; - - platform_device_unregister(vc4_hdmi->audio.codec_pdev); - vc4_hdmi->audio.codec_pdev = NULL; -} - static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) { const struct vc4_hdmi_register *mai_data = @@ -2255,7 +2233,6 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) struct snd_soc_dai_link *dai_link = &vc4_hdmi->audio.link; struct snd_soc_card *card = &vc4_hdmi->audio.card; struct device *dev = &vc4_hdmi->pdev->dev; - struct platform_device *codec_pdev; const __be32 *addr; int index, len; int ret; @@ -2348,20 +2325,6 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) return ret; } - codec_pdev = platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, - PLATFORM_DEVID_AUTO, - &vc4_hdmi_codec_pdata, - sizeof(vc4_hdmi_codec_pdata)); - if (IS_ERR(codec_pdev)) { - dev_err(dev, "Couldn't register the HDMI codec: %ld\n", PTR_ERR(codec_pdev)); - return PTR_ERR(codec_pdev); - } - vc4_hdmi->audio.codec_pdev = codec_pdev; - - ret = devm_add_action_or_reset(dev, vc4_hdmi_audio_codec_release, vc4_hdmi); - if (ret) - return ret; - dai_link->cpus = &vc4_hdmi->audio.cpu; dai_link->codecs = &vc4_hdmi->audio.codec; dai_link->platforms = &vc4_hdmi->audio.platform; @@ -2374,7 +2337,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) dai_link->stream_name = "MAI PCM"; dai_link->codecs->dai_name = "i2s-hifi"; dai_link->cpus->dai_name = dev_name(dev); - dai_link->codecs->name = dev_name(&codec_pdev->dev); + dai_link->codecs->name = dev_name(&vc4_hdmi->connector.hdmi_codec.codec_pdev->dev); dai_link->platforms->name = dev_name(dev); card->dai_link = dai_link; diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index b2424a21da230db99db207efa293417faccd254d..e3d989ca302b72533c374dfa3fd0d5bd7fe64a82 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -104,8 +104,6 @@ struct vc4_hdmi_audio { struct snd_soc_dai_link_component codec; struct snd_soc_dai_link_component platform; struct snd_dmaengine_dai_dma_data dma_data; - struct hdmi_audio_infoframe infoframe; - struct platform_device *codec_pdev; bool streaming; }; From patchwork Fri Dec 6 10:16:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896878 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A212120E709 for ; Fri, 6 Dec 2024 10:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480228; cv=none; b=k9dQDRMCHadbaoZ/23X7+ZzgST2JSTq0EqT5fOH4JCI12aIQadu5ScLuHS9nF7TH1EFtQV/S3BW9Kj/6oEaO1AzWM6zvcIP3AHJW7RE00RQxKvrFh+t1STgOxqtQ4fK9Abpxbu23JCAK1FElmlJlG9j+L1fitx+IkYS01qqYWNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480228; c=relaxed/simple; bh=j2kemq017HscgmDjZnV9e0NQWZYYUNRM9WTXAZ5h3gA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fpoqae2a+lxsgNgxoumfVZcSPPDyrFKY9oYwXTcAl2gfP3rZ1E9Wbtli4GghTRJlb50XBBDSMw4wuienix0PhHGXZdoOosFtcA/1Z7o8xKOQwSohitnFsaDyUs1vE21Rnf/ck+NT8jZpCiiifEGsXP1dA6CPiMJXj5/IFyysrqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=l5o4RNKP; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l5o4RNKP" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-53de79c2be4so1966807e87.2 for ; Fri, 06 Dec 2024 02:17:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480225; x=1734085025; darn=vger.kernel.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=lFa29zGokenJpe5mqg9zveoS4Rwgzi3mBzBv5L26SAE=; b=l5o4RNKPbbfiM00a8JsWqapG4SMHPNGbT6XUo3r8iP1X4CtkMUiBxP53rCEaiHdVFB 7yMumDhbYs8rphUnDZ80u+eWKhMFxuJBW3ABYZqJSn7TneD+2xzQ11xHr2x0mA+BBB// bpe/eoX1n0ZudgSKJkAnzxv+oZljvcIpp4M0hJ/vYve3KNde/vQRKZRQZxiyGzwbWsMs XW04dTEPDCiCxU7FHuwJY6usyIqTMQD40kmqrJHbgXJQZAqyq5MxDQwz8lztBXDBsYbT c3R9wCPVJLmupOiBVe0k5sws+Rt3Bi24ShNHpyYrHus+bE2qiiqZEsU0CkBYj4LGiD5x w+AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480225; x=1734085025; 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=lFa29zGokenJpe5mqg9zveoS4Rwgzi3mBzBv5L26SAE=; b=uDPgU6r21FTJ6pfRCcOX0WuhR4D7B5DMJD/Rbz/T3altcon+Fu4rIEl/zlV1ndy/Jg heZ+Ri5+1UKfK3LPcBssUXT3P89WjjIzgo3gzVeB+ObPqAlI1C+A0LjNJK7qJJw2yIL8 R/L3uYu1AwPc/El+00hZPHyv/C/pdL/OmME2IHggkPW+gV9fsrhOpnG1ZfaICX90Gs5F Trbp3t4eiP1oDnvhCnU9wErRma/ajulrzg/xFAHTB7CabbFOc/qH1x9YvSQ7zFc53kmW ipzZYEBrVrrDqlFxdeQPDEp/7nIc1Vk31DjlAmwyM8+ZiWGgLG2sxT7yIEaDEN1uH4X1 iAMg== X-Forwarded-Encrypted: i=1; AJvYcCVkmB6s69u8XQs0/yZIv50KcSOdh/8IDL0V4YEAiPfxsISbZIbe6PYv6hJft2Pp8b2/b06vA5/IyIQ4mlgWUBVlGw==@vger.kernel.org X-Gm-Message-State: AOJu0YyWmEabVGDsdJspknXEN4C2bnOrP8KXcklSmjIrzdt3Y5XSTnKk rlGCWsxCSp2j3bZ0gk97cyzpj2dQq3nuMGzbAQ55/hTd0Sipv8bdrLsQNBe2dEk= X-Gm-Gg: ASbGncsRTkLcTMJEX8QUfCwB9UlwkXQ8orSvdLD9Q6tEJt/xL43ZmPMXSpvEBjTkz/G MQRBkvMuf/SbB9EK92y7X2QQ4tXlAt6zOhNdJfI1XC8t1ZhNJjEWc6XYu7zHfAADfixuXUTHcuy w7oMg2fHiDxb/r9slPpeI38sUANmzMi4aY61JBrJCt1U0pks1mNXThddDf2xOQMlVlOkiSGHkZd I3WED2sAfTHkArvUTCIw9cnCuDC4qPZyOlCyx3WfzemoVtUDeY9ZkyWIA== X-Google-Smtp-Source: AGHT+IHNpBuRwgKK1CNP9DRuR/Gs67kp3cCMnKwV+VXX45IVym/LnbP/Ke7fYrgOf+QZmiMXYQapcQ== X-Received: by 2002:a05:6512:6cd:b0:53d:d17f:9c82 with SMTP id 2adb3069b0e04-53e2c2eb825mr792722e87.41.1733480224767; Fri, 06 Dec 2024 02:17:04 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:17:03 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:16:03 +0200 Subject: [PATCH v6 09/10] drm/vc4: hdmi: stop rereading EDID in get_modes() Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-9-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1884; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=j2kemq017HscgmDjZnV9e0NQWZYYUNRM9WTXAZ5h3gA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8K05s0noSk+VgReu16bZ6zGhMIKEKZYWvMH cWDBoC5MeeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCgAKCRCLPIo+Aiko 1egSB/0eK1psxHQsYpRADr6zCNmEK9ALrprmuzg9K5OGMiQy4CeKh8wWSI8ng+ZMiQrN0gysIOa gP4xcWyhTKvzseLul6LUz7vNnN2oLBaT6a9kOqq7zHzZ5BC1htBwJHDvvs6gyNE328fVF96Vz1X o1rKdI0JsvDb7LgVYbZkcTMIWCAQjEs/CRHfthdOxmJLdTMad0FkWzEOQfDpKEXyPfaSLg3PpFX 6Vso3jxPVmBwM97QKw3Y/jVXRDBDC/Ltjr/SR4rwzm+rasXspSzT4DM52M5bK4BhVxBYMiNjtv4 TzyaS5rLJ4DQdUBsTW0TJ+Y66IYpoCUW/OdPh+fArsVpGgLm X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The vc4_hdmi_connector_detect_ctx() via vc4_hdmi_handle_hotplug() already reads EDID and propagates it to the drm_connector. Stop rereading EDID as a part of the .get_modes() callback and just update the list of modes. This matches the behaviour of the i915 driver. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index e5ab42f72f618b90f956482db6c9c8074c1e3bf1..3364ef90968dad3074800f02926300ffceb75c69 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -470,31 +470,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) { - struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); struct vc4_dev *vc4 = to_vc4_dev(connector->dev); - const struct drm_edid *drm_edid; int ret = 0; - /* - * NOTE: This function should really take vc4_hdmi->mutex, but doing so - * results in reentrancy issues since cec_s_phys_addr() might call - * .adap_enable, which leads to that funtion being called with our mutex - * held. - * - * Concurrency isn't an issue at the moment since we don't share - * any state with any of the other frameworks so we can ignore - * the lock for now. - */ - - drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); - drm_edid_connector_update(connector, drm_edid); - cec_s_phys_addr(vc4_hdmi->cec_adap, - connector->display_info.source_physical_address, false); - if (!drm_edid) - return 0; - ret = drm_edid_connector_add_modes(connector); - drm_edid_free(drm_edid); if (!vc4->hvs->vc5_hdmi_enable_hdmi_20) { struct drm_device *drm = connector->dev; From patchwork Fri Dec 6 10:16:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896879 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36C6920E709 for ; Fri, 6 Dec 2024 10:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480231; cv=none; b=UVHIAAn9Cj2xQBrkj+SsWfDRYJEJRg98xXV2qeTlgW3OZ0IuNPCWhWKGLoQ3Ermzg5nRJQoEwDGSp9HwM3CYx57Ff1jrzSvIDYJzzlOCGNVEcFDO6mhETQMW/urvRQAxHoxauan7QTo7IwsEPT3rIlhRZhToXw0pLTMdB6HeKL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480231; c=relaxed/simple; bh=7txoET57jmm2MW5aKrjVDlHM8PA3Hnz9H/pYu/wP770=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W5/9ZlUTzjQ4itdKkqOPw7cmR9JTuKixstY8+ugh+U9rPoGEiya2jgKSeZZQYeB43qoyDk4RNDhDlPWf0Waktdo1zOyyx7DkeKH8W0Iuv+g0NvIcf3GaY9NpOGR5eu8GPzNrjBmJR2O4i2ufjNkCbU8nfQMKvCP1DL5czScmedk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DmzWWeAF; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DmzWWeAF" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53dd57589c8so3285408e87.1 for ; Fri, 06 Dec 2024 02:17:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733480227; x=1734085027; darn=vger.kernel.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=Pny3/oZCZ9HdOf4g0MKJrdxu4AmPeKVKO+XjLSvPYWE=; b=DmzWWeAFtAyNipOFPnoXc4NzSanUJNOSYLlH0jF5J+GJgubPD9B70nq/F00VLWe+rJ ES7NGCKmQk8Q/owofhO27kyo8f5vA3guMDNjN+AZLPyW5powWY1V49xMtQY5tHcTwUPT Qf33dZPKft9MLVvXf3sLg1myPLumyY3qr6Yn0A7bo2f6dA87GVSYK2MLIYE9AyhOlI/O d2sOSYOxw6wrOxacElr7pQ18bZnaRE44+j8GPzpzxSovAq8NNWVSAXVycQR4Tt3vS8z4 AtS+xQgYjSZdDF37PdYKV8zJb20ZhPppgqdiZ0w4uX2fYlppTixZI1SlKX2T8HqU3akN Yh0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733480227; x=1734085027; 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=Pny3/oZCZ9HdOf4g0MKJrdxu4AmPeKVKO+XjLSvPYWE=; b=HGUyG7bU9zE5sv5LVfGgExBuB1WwKOa7vqcvh8V5eJIC/bev1g2vtEWELnrj3EEpeu WDjlfcwI5xWxYZNfogs3p1/KRzEE6WgDJizNjeT1W+iu7kWOq5xjwC7upqHZNGqcUtHS ZK8iHJXrn2JnmCuVo34TDLbTMp8EBImpoOm3/xXH+exrQvPmVyHEJg6YM2G+dLmij/N+ KKi8S8rqRb0bDeoaiI/M9b2Bxk6iTZ9GxpTtUfXlVxqc8ytFWeo4Gmkbsp2FWqPuKIcz dz6huY9J9Wm1raGyXaCXxHMZQZFt7cRs/tbHIKJh8AnghBodG8FgD3rvpXVXgZM29zMu /PXA== X-Forwarded-Encrypted: i=1; AJvYcCWgkJ9lt9XWl2oKi7Tp85eM4Chh9+J8Zi5mLKUEGFidhsTi1eFpMN7CjVzFkN4u5xKKgotJnZHeLO/JAmK3TLpbFg==@vger.kernel.org X-Gm-Message-State: AOJu0YwwpFqDmJsPyqwviJWFvAUPjqhUGki4JMdlRsWV9bbcbWRS0ncn rsaYFOEpYW4z8OX7yH+KA06QXGo+UFCWdDm2FOg9P9bMGpa/FLQ60JIhlr1GEDw= X-Gm-Gg: ASbGnctEFJHEgYtVxAP38+mSyD7ADdTNn4WQwKfPptQg14JS1AT8YyhFTQotfn4/7xs HzXybDzJJmEFKPvTVTlr7VyRrPSs2e4hKm+Mva+cjmHYJe90M0Xl3cUfOVlDnIUXChA4C4il2gp RNzxJxEC7/Cr+LgBUXaL5ZITrz5N9RZUNhZFAauNzO0q4URRJOH2w+AE2pRdsWLkMm6hGoRku37 /xY+yFOdPCek6xzxJutflLlkts39woRkg+4fNeOXwcyTQhRsA7qSZmkkg== X-Google-Smtp-Source: AGHT+IG0QcicheINkpKVEV+N7iY9KUPWDy1N6KSKw3gesi4tsLvAixCI3qsFKZ6xn3HsNze5iUigBQ== X-Received: by 2002:a05:6512:a92:b0:53e:335e:774c with SMTP id 2adb3069b0e04-53e335e7ba2mr484774e87.4.1733480227384; Fri, 06 Dec 2024 02:17:07 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53e2294738fsm462355e87.52.2024.12.06.02.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 02:17:06 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 12:16:04 +0200 Subject: [PATCH v6 10/10] drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug_edid() Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-drm-bridge-hdmi-connector-v6-10-50dc145a9c06@linaro.org> References: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@linaro.org> In-Reply-To: <20241206-drm-bridge-hdmi-connector-v6-0-50dc145a9c06@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 , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1476; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7txoET57jmm2MW5aKrjVDlHM8PA3Hnz9H/pYu/wP770=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUs8K5vHn00gwDj19cHn3nMju2ruWputUg2V4s rnN4SzdgMGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LPCgAKCRCLPIo+Aiko 1RVxB/9ibECV3IDeNQwRoXBtxBfb5q/3fQOiAqYySeNrd22PjQ76DgDyRwsiItUPMPc5OBiBz7R KSQ40mwZyXC2r5WzaKmY4gs1aaAPiwRIy/TMksz2RGvCApkg4Hd8RszaQi+oq6e9ZLtPrCaUdeo Jh4fAV9j95blixfhq/8PiFnIopXyYOGqUrL9GnlglKBRAS/27u0MRm3ay1l/GbNb+sg9tEOmo4D TZAS0Fi9bgzcOqAy5fbB10xB4BGALGKhX9Se5PnEl1aK+rp+EAbfkeKXHZ+QBunTMGd2ByF85Gl W+VlY+DypXhupcZsmPnLbRDQPG9h1x7PPZr+p5kNFuOmenmE X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use the helper function to update the connector's information. This makes sure that HDMI-related events are handled in a generic way. Currently it is limited to the HDMI state reporting to the sound system. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 3364ef90968dad3074800f02926300ffceb75c69..3fe025251f939290bb4430e2f5163b6549479fc0 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -383,7 +383,6 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, enum drm_connector_status status) { struct drm_connector *connector = &vc4_hdmi->connector; - const struct drm_edid *drm_edid; int ret; /* @@ -405,17 +404,14 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, return; } - drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); + drm_atomic_helper_connector_hdmi_hotplug(connector, status); - drm_edid_connector_update(connector, drm_edid); cec_s_phys_addr(vc4_hdmi->cec_adap, connector->display_info.source_physical_address, false); - if (!drm_edid) + if (status != connector_status_connected) return; - drm_edid_free(drm_edid); - for (;;) { ret = vc4_hdmi_reset_link(connector, ctx); if (ret == -EDEADLK) {