From nobody Sat Nov 23 22:48:40 2024 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 64FA1186E2F for ; Sat, 9 Nov 2024 12:48:37 +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=1731156519; cv=none; b=LXMa7zm08a5hIEAEoXAaC0PWmxRhu4x91ZB5wA7F6mfa/c5DZD0xAmYsm22xIOcuSqiZxSn1zqUoEMoKWWU9STqrodp6KPaHQzeePeQZmeWO/lTCuBxo5WuqFozBtj9td/sn2tRCioUn5rfUoO5wkVCxFh3tfP3Yh92+8Ja1pOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156519; c=relaxed/simple; bh=+Hp57m3QXnAn1W+61x8ZbDF7cVDM8XAonWljrtUU0rg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lO9N3Kh0Dfdaud/7Eowr3T5VNHvX2kWRG9KI/pgaLzdgvL+Wbxgg0Uyft7cnFjA0D0BmAbwvj7+kLlz6iEV0I30A+98nWPZLj0saN+LMhd7XHZPZHa9Iu0gWfB2lw7qD6SF+/msDLlA5hLmh1SZDxmdjTDEIzf/g+3FaesJq+6I= 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=u5v3q+hj; 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="u5v3q+hj" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53b13ea6b78so5297313e87.2 for ; Sat, 09 Nov 2024 04:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156516; x=1731761316; 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=Y44vew0lj4dDVronue+t+sjWiE6RZ4LKCNRar5uNqMk=; b=u5v3q+hjLbbqX4YG5mB9XDhhnnx28yd3Phn5b/Xc8xQmTWiw+Te4jtsvRgjRAQDwli EpLtvHbwS1u9gxXwSMHzlFxusOzET7Gc62c6+Mq15ZINx7gr1lg/TKGEEXVcYX8piTYv Ljr9ci44VUZ0l4AtlCB2IktBzCKTkd7J45AEKtt7KBXRm8M+vE9I+O8YE/YO4E55kGns 5Kk4IwK0/w74TVC87WcSfZxNwNH6fC4KDCOOi9Wcsh9wwq6gRZdfqvlzR29DGQCHSUKE 4TxaloRgevkJwAUa9MGcwozhMKS0Thn4kgL9E0M8+SHm5YPaAHtDt7MB3unItK9gW1MO s9XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156516; x=1731761316; 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=Y44vew0lj4dDVronue+t+sjWiE6RZ4LKCNRar5uNqMk=; b=qP2ZqP5UxCNT2/YDOg8C2U2q0hjtjlg1HLI+wOBIQ3/XIsd1HWKhW8RQbPMgulO8qx rmZc31T8R4lMCWA+kUd6mPFchTNP6wpiGZWGtZHlefdepHtezv2p9eDjIPtkDXeLpbRw A7w5n6DLNy3Y5GNZs3D75o//7VKfvdEo91k49jRwwTnCLTeL7xU+l/MU0J3dLQcdmjpg mNFYbtJQ1gKCHXCblDOYV9o+eRitvthVikM5qPi+q8BhactWo+PcQgMQhp5iG6KRwtRA ahUK4Ym1YYchYrLUaKslMnYUbNkwTUZfa9nYpuUXB+soxTzpvM8x4pgNhUOdcSpZ4Vyo jYXw== X-Forwarded-Encrypted: i=1; AJvYcCWhyRgUEJbXAUp4SpMh/rZQUBY/3cAG+20VMR3NqJ1eEzd8W2O7qABgHHjdtLnHM+eBXfgWzj4Z2bB6EKA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxlk9gWUIzqOs63Wlef0MmvKMnxwS27J4Ep+79MMkjlu2E1XJ6F t1CfQgJD/V+ib9Jhup5ZV3vMn3mAYUMIeWY1XLSWAF5ayfoeNEkOekv7eswU8Yk= X-Google-Smtp-Source: AGHT+IFYFfrb1yphzNwhn+Y3w9BQmp0wb0sT+WW9GTrrSq7v1u96KcETDtIrcIGrOem+yEuJm8YekQ== X-Received: by 2002:a05:6512:398c:b0:536:542e:ce1f with SMTP id 2adb3069b0e04-53d862c70a1mr4734807e87.18.1731156515475; Sat, 09 Nov 2024 04:48:35 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:34 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:27 +0200 Subject: [PATCH v3 1/7] ASoC: hdmi-codec: pass data to get_dai_id too Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-1-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 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=+Hp57m3QXnAn1W+61x8ZbDF7cVDM8XAonWljrtUU0rg=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1od9lng6ipcWJF0nqLg7q7WZl50DaD/EBp0Q tEzTf3ik1+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHQAKCRCLPIo+Aiko 1eu1B/98pWz6t/LY8OoI3JzejMRtwZFlOBEJA4mvkhfbtemflrITBCiD+1f6lkD4AttPQzpwOoG l+A+DJSNsTuWjRPtHNL0UMlOBmppwf5KMY2p7Ajs0uJ4/TvwEEx+icQt6aV4UNhZ665ACxoNMSi Dty/Rn9gS5strGv0F1Uk6B6QWEaZLGL3apu3HCseCbUkNddP3/GB+GyoEXvW9kuaBXvF6WLXnVh wd+s9TJXHlxKwpZqczWH47FGJ1QzkAHtisGeqCvlNoQgb347vi7s/f44LIIxLoTEc/fceepaIN2 vM0GG49HUsFGv5iUKdifXfMVKIOLnFxCHDUNzIZKoyHbw20W 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/d= rm/bridge/adv7511/adv7511_audio.c index 61f4a38e7d2bf6905683cbc9e762b28ecc999d05..51fb9a574b4e28450b2598a92e2= 930ace5128b71 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 *da= ta) } =20 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/br= idge/analogix/anx7625.c index a2675b121fe44b96945f34215fd900f35bfde43a..926437346b6c9a651d495faf251= 62cac7407d30d 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) } =20 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/brid= ge/lontium-lt9611.c index 1b31fdebe164063e6f3972fdf8a5801ef4c35c4e..4fa0dfc5539a5786278221f7c13= b6473ab320a9a 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -1059,7 +1059,8 @@ static void lt9611_audio_shutdown(struct device *dev,= void *data) } =20 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/b= ridge/lontium-lt9611uxc.c index 4d1d40e1f1b4d144f4aa9de7b83bedf13dfa4436..fd26aa36b15b8c0d3859f7ef488= a87573eea8507 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) } =20 static int lt9611uxc_hdmi_i2s_get_dai_id(struct snd_soc_component *compone= nt, - 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/sii9= 02x.c index 9be9cc5b902594ebe6e1ac29ab8684623e336796..f0be803cc2274ca2199ed7661cf= 752b0a91434b6 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, vo= id *data, } =20 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..86c412e9cbc80bb82bad5db3aa0= 263a7acd9c2d7 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, } =20 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..b3407b47b4a7878532ecf3b08ee= ecd443d6fdb07 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); =20 /* * Hook callback function to handle connector plug event. diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 74caae52e1273fda45ab8dd079ae800827f0231f..abd7c9b0fda9ee6fa6c4efde1f5= 83af667716611 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -981,7 +981,7 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_componen= t *component, int ret =3D -ENOTSUPP; /* see snd_soc_get_dai_id() */ =20 if (hcp->hcd.ops->get_dai_id) - ret =3D hcp->hcd.ops->get_dai_id(component, endpoint); + ret =3D hcp->hcd.ops->get_dai_id(component, endpoint, hcp->hcd.data); =20 return ret; } --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 E8F9B1946A8 for ; Sat, 9 Nov 2024 12:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156521; cv=none; b=JmDErlMKtDfGpQco1gJi9djVBu/8lXODwb4xn17h9yX4xI1Lg1qNje3GA5PIyOZ3NpSOu08Q76N0nwbnsk4i9b7ku8kBGQwka9Lt3TTpWOc8c8wq6VnSUNTUpFthDu16w3K62pQsFJfr0av/5xf0ee7jbQln8b72/EbRxw8l43A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156521; c=relaxed/simple; bh=4RHDtStQsuP3XnEfIXAZ9dpuNg8g6Z0G2md3CVvXL7o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gSYU+itgKuURxCAn+eSBK6irjIArWP3AKu2ZdYqJlYzWVYUms6LnFOZcrPaOpZlYLnrjgVGZi7f07qEREdfIkhF7fXg85psapyXpOyMVh7bhMfX59PaIBA+G19R30Q9wBySoW5CMBKNiaW42BlDAi7Q26rIfiTwlgpfA7PVIbhE= 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=xgsL5c73; arc=none smtp.client-ip=209.85.167.41 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="xgsL5c73" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539f2b95775so4091441e87.1 for ; Sat, 09 Nov 2024 04:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156518; x=1731761318; 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=qRQHcGUBlI3li/BhfVDTF9PQra92/P564gQBC06zyyA=; b=xgsL5c73POAOZ6K5ACWQSTSsl/w5a+tA4Jk/SVt6/4FJsNK7T2zNxtQWc15kuZ1vYE 57uD8ucQnY0YAFdIrFWMHVMeIfqFfrFzJqg+2oh8PpjrDwuiwvAI1QEB6iJUpHYXNpK3 sSzaKZETiddje3JLXM41bNip/gyliulpd1Ji7+rnL2x2jZMxqG3XRgVP5f1L0morNfDx l6dyk3wMAL0tLxwnZoa2r7pXB4NnUqrwb/2erGpJS9CicZLHoe9idKNXdiCrhox+R3hh arXy9QqDkKMu9nZXl3H+KyAvrg2vCeBGzR1I3nmvdFGBGa4LzHaynuUiz+bLnOQkMArJ zYlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156518; x=1731761318; 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=qRQHcGUBlI3li/BhfVDTF9PQra92/P564gQBC06zyyA=; b=aqc48GKwR9CxkPrFfFSyHmMW5uJPLdPldhmDBFPeplYORnmFm09J+mVCqF95hdNsTQ ukwSR9jPd9JdcH6YNtITa6f4LlZ1s/RNOE52GKkcd2rj7k9crJ5Mu5C4YeS8GcD07urP f1pIYLIuDbpDMVHLpEBfdr+9QHWNhje8+xCbziM6LpnPpgsZSxCep/PljRSyMHFobCYO V9gQDdOEdXbHwM00mwvbvySJ/h58iyrCnvTQvPESmHb9DFOUbrPAB+9EH6QU+9qDauXS OM2RM3dtwluoTTa82yYTGLmGubR7McxUoa7brL/dNSVAmX/Y1Z4t4lMYFL+Ngb62Jiez Gucw== X-Forwarded-Encrypted: i=1; AJvYcCUa1yOEk4FAdCqAgP9NXs/jPo6wh/zM+F7uBCFdfryp+1/0w2cOFxEBKBw//ATEhxDvWwOPhJ5FX+GCz04=@vger.kernel.org X-Gm-Message-State: AOJu0YyxUB78S2S6uwwwU4122es7L4o4759vdfDsBNiqc3g+B5z/iKK4 HCChPXyiKxwgGXXfdHZy9FPZUPUpsNjeSFP+R7YCsp21yuAiS8OOz7fuzLSyjiw= X-Google-Smtp-Source: AGHT+IHLcGsVW00+hhxOHllgWhNtSwyLF9SB9AVtjN83/6O7FIOmdAZojYpEQiwQq36gyNNZUBjGxQ== X-Received: by 2002:a05:6512:b1e:b0:53b:7ecc:5ddf with SMTP id 2adb3069b0e04-53d862cd080mr4596291e87.26.1731156518004; Sat, 09 Nov 2024 04:48:38 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:36 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:28 +0200 Subject: [PATCH v3 2/7] ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-2-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 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=4RHDtStQsuP3XnEfIXAZ9dpuNg8g6Z0G2md3CVvXL7o=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1odbv/gTHbC6rcjfvcQH8H951fFW0RC4y2BN 4V4P30twe6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHQAKCRCLPIo+Aiko 1VtGCACYb60Ptvu4nX4BvQoQSfARB5aEJKiKMDEbTPPiXxEz2UQ3bXuizyl1aKjiPaL0W7JIng+ 2yX424uoaz6wsiS94AZZ2GUD97n7f1QsWV28luVmp7yyBRupKIcvdx4DSX5Z5lgGFWD851/CnFL /k9ZLS2XPfe7B3F2adbK3jOkPDghwyEkM/DPZwVgUZNR81xSaWhVom3znhJHJl0b2Dic7pqF4HE dHyW9nSKXnqZclhqnln0VKmAaLmmKEM3cfTZ++XFbNtAJb8BCKtfBShkUFU0Lgj946a2p+MvXb5 mylKYO+vsSaaI+rCcG/Yn3Duj89gCl6xmwk270ygtKvpOpMK 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 35ae3f0e8f51f768229e055a086b53a419ffcd9f..98669470d1e955fef36bb459279= 5fed6ca97139c 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1464,7 +1464,6 @@ static const struct hdmi_codec_ops it66121_audio_code= c_ops =3D { .audio_shutdown =3D it66121_audio_shutdown, .mute_stream =3D it66121_audio_mute, .get_eld =3D it66121_audio_get_eld, - .no_capture_mute =3D 1, }; =20 static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device= *dev) @@ -1474,6 +1473,7 @@ static int it66121_audio_codec_init(struct it66121_ct= x *ctx, struct device *dev) .i2s =3D 1, /* Only i2s support for now */ .spdif =3D 0, .max_i2s_channels =3D 8, + .no_capture_mute =3D 1, }; =20 dev_dbg(dev, "%s\n", __func__); diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii9= 02x.c index f0be803cc2274ca2199ed7661cf752b0a91434b6..5248676b0036a7e8f2142bd2f09= 9c36efb529471 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 =3D { .mute_stream =3D sii902x_audio_mute, .get_eld =3D sii902x_audio_get_eld, .get_dai_id =3D sii902x_audio_get_dai_id, - .no_capture_mute =3D 1, }; =20 static int sii902x_audio_codec_init(struct sii902x *sii902x, @@ -864,6 +863,7 @@ static int sii902x_audio_codec_init(struct sii902x *sii= 902x, .i2s =3D 1, /* Only i2s support for now. */ .spdif =3D 0, .max_i2s_channels =3D 0, + .no_capture_mute =3D 1, }; u8 lanes[4]; int num_lanes, i; diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/= exynos_hdmi.c index c9d4b9146df95bb46cb6bea4849c331616c2b463..2a74396ac846dc34d87fadea700= c387d597ba307 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1658,7 +1658,6 @@ static const struct hdmi_codec_ops audio_codec_ops = =3D { .audio_shutdown =3D hdmi_audio_shutdown, .mute_stream =3D hdmi_audio_mute, .get_eld =3D hdmi_audio_get_eld, - .no_capture_mute =3D 1, }; =20 static int hdmi_register_audio_device(struct hdmi_context *hdata) @@ -1667,6 +1666,7 @@ static int hdmi_register_audio_device(struct hdmi_con= text *hdata) .ops =3D &audio_codec_ops, .max_i2s_channels =3D 6, .i2s =3D 1, + .no_capture_mute =3D 1, }; =20 hdata->audio.pdev =3D platform_device_register_data( diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998= x_drv.c index 2160f05bbd16d2346e27365e5549b75ad26fdcb9..10a4195d667ff577183788f8fc7= ca806660e2b9c 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 = =3D { .audio_shutdown =3D tda998x_audio_shutdown, .mute_stream =3D tda998x_audio_mute_stream, .get_eld =3D tda998x_audio_get_eld, - .no_capture_mute =3D 1, }; =20 static int tda998x_audio_codec_init(struct tda998x_priv *priv, @@ -1176,6 +1175,7 @@ static int tda998x_audio_codec_init(struct tda998x_pr= iv *priv, .max_i2s_channels =3D 2, .no_i2s_capture =3D 1, .no_spdif_capture =3D 1, + .no_capture_mute =3D 1, }; =20 if (priv->audio_port_enable[AUDIO_ROUTE_I2S]) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/m= tk_dp.c index 1cc916b164713d71461a0b2ad370032a14604be6..6a42459792ec75692fadb45a75b= 138fc43cc37a2 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 =3D { .audio_shutdown =3D mtk_dp_audio_shutdown, .get_eld =3D mtk_dp_audio_get_eld, .hook_plugged_cb =3D mtk_dp_audio_hook_plugged_cb, - .no_capture_mute =3D 1, }; =20 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 =3D 8, .i2s =3D 1, .data =3D mtk_dp, + .no_capture_mute =3D 1, }; =20 mtk_dp->audio_pdev =3D 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..a4b144b3bda8362a6c6c303723c= 6d3eef9ca338e 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_cod= ec_ops =3D { .mute_stream =3D mtk_hdmi_audio_mute, .get_eld =3D mtk_hdmi_audio_get_eld, .hook_plugged_cb =3D mtk_hdmi_audio_hook_plugged_cb, - .no_capture_mute =3D 1, }; =20 static int mtk_hdmi_register_audio_driver(struct device *dev) @@ -1671,6 +1670,7 @@ static int mtk_hdmi_register_audio_driver(struct devi= ce *dev) .max_i2s_channels =3D 2, .i2s =3D 1, .data =3D hdmi, + .no_capture_mute =3D 1, }; struct platform_device *pdev; =20 diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockc= hip/cdn-dp-core.c index b04538907f956cbf7732c9177c477951eaa32276..a1229d7fd57104c5c1f31b5b64d= 66e8249358d52 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 =3D { .mute_stream =3D cdn_dp_audio_mute_stream, .get_eld =3D cdn_dp_audio_get_eld, .hook_plugged_cb =3D cdn_dp_audio_hook_plugged_cb, - .no_capture_mute =3D 1, }; =20 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 =3D 1, .ops =3D &audio_codec_ops, .max_i2s_channels =3D 8, + .no_capture_mute =3D 1, }; =20 dp->audio_pdev =3D platform_device_register_data( diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 847470f747c0efad61c2ebdc3fb3746a7a13a863..dfb8e2887fae10cf3275e8f8427= f39279982c5e6 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1235,7 +1235,6 @@ static const struct hdmi_codec_ops audio_codec_ops = =3D { .audio_shutdown =3D hdmi_audio_shutdown, .mute_stream =3D hdmi_audio_mute, .get_eld =3D hdmi_audio_get_eld, - .no_capture_mute =3D 1, }; =20 static int sti_hdmi_register_audio_driver(struct device *dev, @@ -1245,6 +1244,7 @@ static int sti_hdmi_register_audio_driver(struct devi= ce *dev, .ops =3D &audio_codec_ops, .max_i2s_channels =3D 8, .i2s =3D 1, + .no_capture_mute =3D 1, }; =20 DRM_DEBUG_DRIVER("\n"); diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index b3407b47b4a7878532ecf3b08eeecd443d6fdb07..b220072cfa1baf503efbe2d530d= 7e8392dc16603 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; }; =20 /* HDMI codec initalization data */ @@ -129,6 +126,7 @@ struct hdmi_codec_pdata { uint spdif:1; uint no_spdif_playback:1; uint no_spdif_capture:1; + uint no_capture_mute:1; int max_i2s_channels; void *data; }; diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index abd7c9b0fda9ee6fa6c4efde1f583af667716611..e8aac8069587785bcd2bd09b5f9= e0140304fb8fb 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -700,7 +700,7 @@ static int hdmi_codec_mute(struct snd_soc_dai *dai, int= mute, int direction) */ if (hcp->hcd.ops->mute_stream && (direction =3D=3D 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); --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 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 A089B183CC3 for ; Sat, 9 Nov 2024 12:48:42 +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=1731156524; cv=none; b=crUhNuxWB6VnsMG+8O6KfwBcgDxgnjJrRvj+jVSmbCpxG+t7I36etRWKwkZXY5QMqHmKJTYo+GRgXgmd0zvqggawhz04UxamTrbjP5nnqoMWr14T9XbMoGuMM7gbw0prWziPC6n8EKUw51WgkRybu4ITI88x8hYDvxXv1tUPGW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156524; c=relaxed/simple; bh=U2tGaht2UtIOBSpeGeyquWKg2qOH/wq+COPSndCVO/g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hVIKRq513Z6kwkcb43z34LmrhexjYdUdCHR4t6X0RS37/++3aYDX0xj0SQhAUFDtuIqAYMdQtboveu5v9nggp1hl6elM34qU0KH1sqUB2AWIx7s4b8ARz1kAaOuJvfZnmfz9Ne90xqkbD2fh/TN4GpPaM6E9BROVA0v7IS2I/sM= 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=Jx6foc2E; 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="Jx6foc2E" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53c78ebe580so4526439e87.1 for ; Sat, 09 Nov 2024 04:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156521; x=1731761321; 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=+eyAoYfVD4GTFwuNLHegrvutJuWKGGHJN3n7yLsHG1I=; b=Jx6foc2ExD4GUPMXqjPwXUWjNP2DwLrG3q9JgZKvbeJ0CkfhR5WpVvDMBc6Iw7aOKB 954pe7QGdzvzBaTulG5a24yKkf6E1621yH3GzWrpi8CPLd01d5L8JqEK594CMCQrCfvn SM8H6ycdiXwkDtB2q7PHfw4/y1rd4OOp9zlc40bWw14XxGgW/XS6b5M749rTJx2ZACWt kfTNrHtNPPnhXvPvw3BgrcYxElhqhnpzwwid/epGdcYzya7U40+PeWRtjGOREz6ApWm/ ZhxEMxF7TXfFruAMGgrhzmjSVmJ1cgPd95jk3RRNJcFmSVAR33nQnY6qzLDsmMpp7eH3 9D4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156521; x=1731761321; 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=+eyAoYfVD4GTFwuNLHegrvutJuWKGGHJN3n7yLsHG1I=; b=qBG+q9pkSRJdCN18Srl/5OGTBUO5PkrrO9lTawkYg5IxpeiZz3TR91h/ihww95ALgd 3jMCIDOYcd6lJQHXgXPeHRjakNcQiC9fFfvjgPySzW4mak/SZDlg9J2qdS/QNLYI2ntj jYllwkei7R5I3zaT9WFeDY4vgm3qFdqD9JIl3aYt+r6ukMkaYY6G+BwBDXLSHWdKwtg7 n4h37bmkWR1p52D/sNvJEXq+5u/iJ/I0rYo67allhsiv0KeBWDp2ocZxU6q+b5vEaGUQ oSRrOgolGT0lxKT5cjOVUN/TbZUuKfaz9ymTv1oir1Et3PnRuOcHUaDsRCODqhK0Fsp3 FBqA== X-Forwarded-Encrypted: i=1; AJvYcCUzjmVVh1hmXkSkN3YTbBN6K9v6TM2dDDvffrBcQ+TYu0zUgSrjlVAIl96GEox9tJ69fzOOvHX1ih/nPfw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0zkCUvnxdGLlVCtGsk4Z8ulTtEetmp+TxehsWM+PZcMHd1YeF AkAOUNYzw7x9gGRIvJaofNyM/FG3/e/FlHtfZ0xz1c/5ua4p+DuB5fd+t68LC9Q= X-Google-Smtp-Source: AGHT+IHXuvwEEQF9W5/rviH6M34eZy76pTDi9HbPRF2bHzFyEHu2uqPeHq777qwg3qFX+dUCOCeoTA== X-Received: by 2002:a05:6512:1304:b0:539:e5d7:d7ff with SMTP id 2adb3069b0e04-53d866cb27dmr2111852e87.11.1731156520651; Sat, 09 Nov 2024 04:48:40 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:39 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:29 +0200 Subject: [PATCH v3 3/7] drm/connector: implement generic HDMI codec helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-3-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=12999; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=U2tGaht2UtIOBSpeGeyquWKg2qOH/wq+COPSndCVO/g=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1odAXOX0mAz8Svlq27tS+7gJG5FpmiVtXSpc tdjW0YzH5OJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHQAKCRCLPIo+Aiko 1ZRlB/9cXgR68Ef3l+W5ZdjE31pub/g3UK639EhmSVoUBaOnjTkkvYrN5kNuOrqu8oHGBo+k/Xl myP2RNVsdLm0bu2/+i0AnIomZ7VwOmUN1FKPnjz49h3M1lQW7VS9Qp7Dl2hwmIbO1pi74zH6QdP iKHGNa/A1TF5k0wHZyA+n3S28KHF0TN6OqRRjWtiP2pjw0k2m6iCuktd8fFpDj90ZHb0aehKoV+ SxKYu7XZQD74td80/DFHp1fydVzf1xqVHxkX5yzWASCMUzrkxUAHVzQF+6zUUEuLouhltT1+tiW /6ks/+YOQqA3hf6kt96cII6cJaBV06TSOofJZJpqib1nQNTB 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 | 10 ++ drivers/gpu/drm/drm_connector_hdmi_codec.c | 186 +++++++++++++++++++++++++= ++++ drivers/gpu/drm/drm_internal.h | 5 + include/drm/drm_connector.h | 80 +++++++++++++ 5 files changed, 282 insertions(+) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 463afad1b5ca6275e61223adc8ca036c3d4d6b03..ab5b052ad5229229ac46e3804be= 77dd1d1680f58 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -42,6 +42,7 @@ drm-y :=3D \ 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_connecto= r.c index fc35f47e2849ed6786d6223ac9c69e1c359fc648..1a155a9fb401f687e5a88e72fac= a1e81d944b6d2 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -279,6 +279,7 @@ static int __drm_connector_init(struct drm_device *dev, mutex_init(&connector->mutex); mutex_init(&connector->edid_override_mutex); mutex_init(&connector->hdmi.infoframes.lock); + mutex_init(&connector->hdmi_codec.lock); connector->edid_blob_ptr =3D NULL; connector->epoch_counter =3D 0; connector->tile_blob_ptr =3D NULL; @@ -533,6 +534,12 @@ int drmm_connector_hdmi_init(struct drm_device *dev, =20 connector->hdmi.funcs =3D hdmi_funcs; =20 + if (connector->hdmi_codec.i2s || connector->hdmi_codec.spdif) { + ret =3D drm_connector_hdmi_codec_init(connector); + if (ret) + return ret; + } + return 0; } EXPORT_SYMBOL(drmm_connector_hdmi_init); @@ -631,6 +638,8 @@ void drm_connector_cleanup(struct drm_connector *connec= tor) DRM_CONNECTOR_REGISTERED)) drm_connector_unregister(connector); =20 + drm_connector_hdmi_codec_cleanup(connector); + if (connector->privacy_screen) { drm_privacy_screen_put(connector->privacy_screen); connector->privacy_screen =3D NULL; @@ -669,6 +678,7 @@ void drm_connector_cleanup(struct drm_connector *connec= tor) connector->funcs->atomic_destroy_state(connector, connector->state); =20 + mutex_destroy(&connector->hdmi_codec.lock); mutex_destroy(&connector->hdmi.infoframes.lock); mutex_destroy(&connector->mutex); =20 diff --git a/drivers/gpu/drm/drm_connector_hdmi_codec.c b/drivers/gpu/drm/d= rm_connector_hdmi_codec.c new file mode 100644 index 0000000000000000000000000000000000000000..e362852c186109644e9033eb8ea= f63b864166d5a --- /dev/null +++ b/drivers/gpu/drm/drm_connector_hdmi_codec.c @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright (c) 2024 Linaro Ltd + */ + +#include +#include +#include + +#include +#include + +#include + +#include "drm_internal.h" + +static int drm_connector_hdmi_codec_audio_startup(struct device *dev, void= *data) +{ + struct drm_connector *connector =3D data; + const struct drm_connector_hdmi_codec_funcs *funcs =3D + 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 =3D data; + const struct drm_connector_hdmi_codec_funcs *funcs =3D + connector->hdmi.funcs->codec_funcs; + + return funcs->prepare(connector, fmt, hparms); +} + +static void drm_connector_hdmi_codec_audio_shutdown(struct device *dev, vo= id *data) +{ + struct drm_connector *connector =3D data; + const struct drm_connector_hdmi_codec_funcs *funcs =3D + 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 =3D data; + const struct drm_connector_hdmi_codec_funcs *funcs =3D + 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 *c= omment, + struct device_node *endpoint, + void *data) +{ + struct drm_connector *connector =3D data; + struct of_endpoint of_ep; + int ret; + + if (connector->hdmi_codec.sound_dai_port < 0) + return -ENOTSUPP; + + ret =3D of_graph_parse_endpoint(endpoint, &of_ep); + if (ret < 0) + return ret; + + if (of_ep.port =3D=3D connector->hdmi_codec.sound_dai_port) + return 0; + + return -EINVAL; +} + +static int drm_connector_hdmi_codec_get_eld(struct device *dev, void *data, + uint8_t *buf, size_t len) +{ + struct drm_connector *connector =3D data; + + // FIXME: locking against drm_edid_to_eld ? + memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); + + return 0; +} + +static int drm_connector_hdmi_codec_hook_plugged_cb(struct device *dev, + void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct drm_connector *connector =3D data; + + mutex_lock(&connector->hdmi_codec.lock); + + connector->hdmi_codec.plugged_cb =3D fn; + connector->hdmi_codec.plugged_cb_dev =3D 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 *connect= or, + bool plugged) +{ + mutex_lock(&connector->hdmi_codec.lock); + + connector->hdmi_codec.last_state =3D 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 =3D { + .audio_startup =3D drm_connector_hdmi_codec_audio_startup, + .prepare =3D drm_connector_hdmi_codec_prepare, + .audio_shutdown =3D drm_connector_hdmi_codec_audio_shutdown, + .mute_stream =3D drm_connector_hdmi_codec_mute_stream, + .get_eld =3D drm_connector_hdmi_codec_get_eld, + .get_dai_id =3D drm_connector_hdmi_codec_get_dai_id, + .hook_plugged_cb =3D drm_connector_hdmi_codec_hook_plugged_cb, +}; + +/** + * drm_connector_hdmi_codec_cleanup - Cleanup the HDMI Codec for the conne= ctor + * @connector: A pointer to the connector to cleanup + * + * Cleanup the HDMI codec device created for the specified connector. + * Can be called even if the codec wasn't allocated. + */ +void drm_connector_hdmi_codec_cleanup(struct drm_connector *connector) +{ + platform_device_unregister(connector->hdmi_codec.codec_pdev); +} + +/** + * drm_connector_hdmi_codec_init - Initialize HDMI Codec device for the DR= M connector + * @connector: A pointer to the connector to allocate codec for + * + * Create a HDMI codec device to be used with the specified connector. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_connector_hdmi_codec_init(struct drm_connector *connector) +{ + struct hdmi_codec_pdata codec_pdata =3D {}; + struct platform_device *pdev; + + if (!connector->hdmi.funcs->codec_funcs->prepare || + !connector->hdmi.funcs->codec_funcs->audio_shutdown || + !connector->hdmi_codec.dev) + return -EINVAL; + + codec_pdata.ops =3D &drm_connector_hdmi_codec_ops; + codec_pdata.i2s =3D connector->hdmi_codec.i2s, + codec_pdata.spdif =3D connector->hdmi_codec.spdif, + codec_pdata.max_i2s_channels =3D connector->hdmi_codec.max_i2s_channels, + codec_pdata.data =3D connector; + + pdev =3D platform_device_register_data(connector->hdmi_codec.dev, + HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_AUTO, + &codec_pdata, sizeof(codec_pdata)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + connector->hdmi_codec.codec_pdev =3D pdev; + + return 0; +} diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index b2b6a8e49dda46f1cb3b048ef7b28356dd3aaa4e..8ed58e482fac4662b659276e8bc= 17690e1fdb9b7 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -280,4 +280,9 @@ void drm_framebuffer_print_info(struct drm_printer *p, = unsigned int indent, const struct drm_framebuffer *fb); void drm_framebuffer_debugfs_init(struct drm_device *dev); =20 +/* drm_connector_hdmi_codec.c */ + +int drm_connector_hdmi_codec_init(struct drm_connector *connector); +void drm_connector_hdmi_codec_cleanup(struct drm_connector *connector); + #endif /* __DRM_INTERNAL_H__ */ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index e3fa43291f449d70f3b92a00985336c4f2237bc6..b89f791cfa2be86ce1c5aa124c0= f071d7c8a6489 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; =20 enum drm_connector_force { @@ -1141,6 +1143,52 @@ struct drm_connector_state { struct drm_connector_hdmi_state hdmi; }; =20 +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; }; =20 /** @@ -1660,6 +1716,22 @@ struct drm_cmdline_mode { bool tv_mode_specified; }; =20 +struct drm_connector_hdmi_codec { + struct platform_device *codec_pdev; + struct device *dev; + + struct mutex lock; /* protects last_state and plugged_cb */ + void (*plugged_cb)(struct device *dev, bool plugged); + struct device *plugged_cb_dev; + bool last_state; + + int max_i2s_channels; + uint i2s: 1; + uint spdif: 1; + + int sound_dai_port; +}; + /* * struct drm_connector_hdmi - DRM Connector HDMI-related structure */ @@ -2118,6 +2190,11 @@ struct drm_connector { * @hdmi: HDMI-related variable and properties. */ struct drm_connector_hdmi hdmi; + + /** + * @hdmi_codec: HDMI codec properties and non-DRM state. + */ + struct drm_connector_hdmi_codec hdmi_codec; }; =20 #define obj_to_connector(x) container_of(x, struct drm_connector, base) @@ -2151,6 +2228,9 @@ void drm_connector_unregister(struct drm_connector *c= onnector); int drm_connector_attach_encoder(struct drm_connector *connector, struct drm_encoder *encoder); =20 +void drm_connector_hdmi_codec_plugged_notify(struct drm_connector *connect= or, + bool plugged); + void drm_connector_cleanup(struct drm_connector *connector); =20 static inline unsigned int drm_connector_index(const struct drm_connector = *connector) --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 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 3C9F41917C2 for ; Sat, 9 Nov 2024 12:48:45 +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=1731156528; cv=none; b=msh8kUd5ayqJVxU/ltBYpou9ht/A8dvS4r7ZJdccMRw2sQ2vAnipVtic8lgOhCrCvTW8s/yD7E1FwoRMP5O+IME0TNZd/Aro12J9IezWTOiOMX3wPbaylhR071/HVP019DhqkXlhnGBoBgYfIX6fRM3wX/ijZOMI46oDI3wKz20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156528; c=relaxed/simple; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nori2RO9wl4FvzVMu99qWt/H3JoosO/UAm+EDGOC7FfOvRM/NMqLt5gEuUAL9wti7j5SIZr65xXnd4i7KA+RrIZVu/sVBXAfQ64xqtEfxBrHejWPEXmiaUHXDZDuX87Tx3UsfEZkxLQI98IO9at4/t7l2JUr26eljwUoHqtvsxI= 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=XND1iwjQ; 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="XND1iwjQ" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53a0c160b94so3820950e87.2 for ; Sat, 09 Nov 2024 04:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156523; x=1731761323; 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=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=XND1iwjQlZ8IcWu3A0A37if5I1s3WizYeV2VyS7hWeNjhpPly7J/g5D6DQQrsUemZL puChlSaSonjGPMoFbBacqy9FtXQvbHBiArHSb90bJXusuhrUROLenRkwZrCQCrgzKPgI Q8jFxFmL+HCksKh/TlVG1EudcbhJ7KSxMw5qjbwbBvvslgLI1GoQ01OTwfs83CH7lTXB A3Zk2SuFIGqOG1vzaKSHOdiGx2VVtbtNTgJaX7uOpxNaAjvY37gfjNuIPEazm98P1ZE5 v36bz9oYZlwqvyvkSPHrN7ald9YKyDGLVYZf3IqnircuXkBYnBqnGTqoGrzHva8wXAuN Kz6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156523; x=1731761323; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=tbfobgBW7nWRTtalo2gmx1R63dlOptDHSi3OcqQ6Vbm2+Pq0uFnEAvfiHCCiWeWBgG ZIHcDUYsYpV7eiaD6int3KsXWTX/b6UukHker+S+RlKGyh5fUpKVmttxGIv41Ai3oKrl fh9B6m0RQsoHBIVBWd6xQidZjiHzbYxdADabMB6Hp6B5BRz758KBWKS/0Hbn+oLD8HQ9 FMYFuieE5eZxu9UHsbxekdGRMWKHvo+cm55KTOJU4K/AhRoWNsWhFAtskKE8jU7bKHVi 08Oj13QfbXNpxR0+x1cKZopgUZBP2FxC0e3pFfnDs5/rgkKF+TM5PUqaMLzcbaort6p9 0Hcw== X-Forwarded-Encrypted: i=1; AJvYcCUk6XM1JFBKQhSNOZ988kYMh+X2gor9rWUfZNGhrYX+lLykrJrLLssU6r4S7omW7deT4XrWwSiFa9o9AfU=@vger.kernel.org X-Gm-Message-State: AOJu0YyHUPkky2BKk9bR+7xTaiZq2DFvYa41E208ktSdslirE7r728Cj puGcEs7S6S57b15hi2VoXQpi8b4IeRI9ry3p513UcgMmzyidetwLtjFc/T7mqFg= X-Google-Smtp-Source: AGHT+IE6kTLTu/veurmVOodgPhU+7P7sFJTvQhZmfzzsua+fQiIV+PK+Bv9UdgdlQKwp2JiCvYUHrw== X-Received: by 2002:a05:6512:2389:b0:53c:7526:e18a with SMTP id 2adb3069b0e04-53d862c5757mr3016794e87.30.1731156523224; Sat, 09 Nov 2024 04:48:43 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:41 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:30 +0200 Subject: [PATCH v3 4/7] drm/bridge: connector: add support for HDMI codec framework Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-4-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6723; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1odOLzMUKfl5eHI5bjyKcUtRMaLgeTACflZr 5w28n5DOk+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHQAKCRCLPIo+Aiko 1WEZB/9fOdqsvsC/JajVKhnkYPMFOMEQu8c4Cozx0O+GeTqyy2c0Gfu7wERPC0GYSi80tTgshdW VLOFMhn45/5pnsvTa2aW0mMpxACjTJp1nflhG3jkc+lz0k5OPxWDI1IGn7diveUOCMnaBVyMuTu iSRV9T5NSdyLprmttaov27fUnHhwTN2QpfNJ8a1Lxo15V2mzD839FuWr5Je4H1/5oPJin9jAQjr GjkcFHMifZiCNscZlNleciqSY+0zP19knISWe+SfdQQzWl7Fw7NRW6Ak0eBjfDwtBLjha7UrE/V qBgi+7KEmS9N/HoC0P8hNElSpNYYr59cs7i5Zxdl8kgDdgzk 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 --- drivers/gpu/drm/display/drm_bridge_connector.c | 95 ++++++++++++++++++++++= +++- include/drm/drm_bridge.h | 23 +++++++ 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/d= rm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..12ab9f14cc8a8672478ae2804c9= a68d766d88ea5 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -20,6 +20,8 @@ #include #include =20 +#include + /** * DOC: overview * @@ -354,10 +356,80 @@ static int drm_bridge_connector_write_infoframe(struc= t drm_connector *connector, return bridge->funcs->hdmi_write_infoframe(bridge, type, buffer, len); } =20 +static int drm_bridge_connector_audio_startup(struct drm_connector *connec= tor) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge =3D 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 =3D + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge =3D 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 *conn= ector) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge =3D 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 *connecto= r, + bool enable, int direction) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge =3D 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_hd= mi_codec_funcs =3D { + .audio_startup =3D drm_bridge_connector_audio_startup, + .prepare =3D drm_bridge_connector_prepare, + .audio_shutdown =3D drm_bridge_connector_audio_shutdown, + .mute_stream =3D drm_bridge_connector_mute_stream, +}; + static const struct drm_connector_hdmi_funcs drm_bridge_connector_hdmi_fun= cs =3D { .tmds_char_rate_valid =3D drm_bridge_connector_tmds_char_rate_valid, .clear_infoframe =3D drm_bridge_connector_clear_infoframe, .write_infoframe =3D drm_bridge_connector_write_infoframe, + .codec_funcs =3D &drm_bridge_connector_hdmi_codec_funcs, }; =20 /* -----------------------------------------------------------------------= ------ @@ -459,7 +531,25 @@ struct drm_connector *drm_bridge_connector_init(struct= drm_device *drm, if (connector_type =3D=3D DRM_MODE_CONNECTOR_Unknown) return ERR_PTR(-EINVAL); =20 - if (bridge_connector->bridge_hdmi) + if (bridge_connector->bridge_hdmi) { + bridge =3D bridge_connector->bridge_hdmi; + + if (bridge->hdmi_codec_i2s || + bridge->hdmi_codec_spdif) { + if (!bridge->funcs->hdmi_codec_prepare || + !bridge->funcs->hdmi_codec_audio_shutdown) + return ERR_PTR(-EINVAL); + + bridge_connector->bridge_hdmi =3D bridge; + + connector->hdmi_codec.dev =3D bridge->hdmi_codec_dev; + connector->hdmi_codec.i2s =3D bridge->hdmi_codec_i2s; + connector->hdmi_codec.spdif =3D bridge->hdmi_codec_spdif; + connector->hdmi_codec.max_i2s_channels =3D + bridge->hdmi_codec_max_i2s_channels; + connector->hdmi_codec.sound_dai_port =3D bridge->hdmi_codec_dai_port; + } + ret =3D drmm_connector_hdmi_init(drm, connector, bridge_connector->bridge_hdmi->vendor, bridge_connector->bridge_hdmi->product, @@ -468,10 +558,11 @@ struct drm_connector *drm_bridge_connector_init(struc= t drm_device *drm, connector_type, ddc, supported_formats, max_bpc); - else + } else { ret =3D drmm_connector_init(drm, connector, &drm_bridge_connector_funcs, connector_type, ddc); + } if (ret) return ERR_PTR(ret); =20 diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index e8d735b7f6a480468c88287e2517b387ceec0f22..0ef9580ef6669f84327bdcb85a2= 4fc83f76541bb 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; =20 /** @@ -676,6 +678,21 @@ struct drm_bridge_funcs { enum hdmi_infoframe_type type, const u8 *buffer, size_t len); =20 + int (*hdmi_codec_audio_startup)(struct drm_connector *connector, + struct drm_bridge *bridge); + + int (*hdmi_codec_prepare)(struct drm_connector *connector, + struct drm_bridge *bridge, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms); + + void (*hdmi_codec_audio_shutdown)(struct drm_connector *connector, + struct drm_bridge *bridge); + + int (*hdmi_codec_mute_stream)(struct drm_connector *connector, + struct drm_bridge *bridge, + bool enable, int direction); + /** * @debugfs_init: * @@ -859,6 +876,12 @@ struct drm_bridge { * @DRM_BRIDGE_OP_HDMI is set. */ unsigned int max_bpc; + + struct device *hdmi_codec_dev; + int hdmi_codec_max_i2s_channels; + unsigned int hdmi_codec_i2s : 1; + unsigned int hdmi_codec_spdif : 1; + int hdmi_codec_dai_port; }; =20 static inline struct drm_bridge * --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 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 DFA791990C8 for ; Sat, 9 Nov 2024 12:48:46 +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=1731156528; cv=none; b=VbW7dgmqE98LTbQMx1SfdnVTNiHextkjFXEs3GntCaIxpjRsyGnPih1iSW0latvryNJ8BH1BRGQ5Jufe/jV7OjVi0PzAKbUeW5Za+566DhDxs9qr1GlH5BB9YF6hvG8oye39m8kq7RktoAFQNUa5k9Te3prHHZWt6t0m6CFOSog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156528; c=relaxed/simple; bh=b9CjlXHFjClXWt0twlUk/5oI0wepnqrV5DObVEdOLnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TdYcEgwsIC3b4tHHxPNHml5WcaNm1CzfJZNneNVFaPopvAnisGx8ABeMoF1Zz6o6N/jB64PQcYZtH7BNJMh3FUPCwuylA5WtRyYWzQuo0b7mkMX+fSizjzFlSNnTBaRV3Vr9W8iZIiChCHOax3feA2FAqLjlDCdpwvcWrkueRqU= 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=yy10n4Ri; 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="yy10n4Ri" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-539fe02c386so4004950e87.0 for ; Sat, 09 Nov 2024 04:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156525; x=1731761325; 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=n+9MtGcN2xrmwOXfB2jupKXdcgjG7Kpy3ckztHv28T8=; b=yy10n4RiD8SMLJhXmgt5NUxRkDizjAOdUEn4qcidV2FEcJcwX7AcYKUUJT5RxnOM8w J7N53DSR7cvWCNF+p81myGhPblKPGP+A3DwCcDU56Jbs6M62dG7dT5XDGCcMA1qsIvfH baTW2+MgZgJJqw8/HANEttyngpDST2lq3S+WTlbv9gvxqLgMjbpoGaV0LKiLKlko1/xW 8V1LJ+CVhLKD+PlrJJdtXSNOxLwWCLsyjxaWBkrCoaLR9Y81/NSp8zQn0rnFKOP4vpcj egDoZ7XQknh7Et7LkymTEEDaZv+lnPEDuTByC1UFOuqPBGSgl7vTCzDeoVUZ2BR7b66p ADBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156525; x=1731761325; 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=n+9MtGcN2xrmwOXfB2jupKXdcgjG7Kpy3ckztHv28T8=; b=oWNWRKGktjSw0aoLt16sThElSvtzmJNuyPuYWfOkIc763sICAABomFjkZ1K+knGXx3 tsJibEesQ2uoV8ohFCTHnZdDJFlYeLRKC1rqu454Xc26ObhWdl0TaoFV4yTxkr82CyOs kRpViwR/hfmIunRig8BdagrPsnGAyLGOMIczg0kqzc3L1jj+pKBToG9IKgY2ynsChnnW 9Ll0zQArnsMM96oKa4zpRQN2wM8WgrnXngGRaxxF5nwdjjhYEpfKuf393GXzbOcICd6B B/54NapK3c+uOkJxr3g1WC7gfbiT4pHfd0PNplv9Wpx5FqqAON3ycMKcFyD7Etkb6iCX s8Mw== X-Forwarded-Encrypted: i=1; AJvYcCWllkJaPutkI2cjn06DnvJyZphdIWb8e6Mau86PVpsKmLP21BSZDhRh+IYHVvLL2g3qhNPoZ/Pk+Jnmfp4=@vger.kernel.org X-Gm-Message-State: AOJu0YzDDZG9o4QOPT9XQsOAYXpY0C6nGm6FtO9BYAS8uxMg9RjbvSUH YVTTAxFZJdrsrLxGWUbypilTcDXCJ2Wi6hpbWD79Gv4Oq/KmwT7rzcdmSsjXFaI= X-Google-Smtp-Source: AGHT+IFf9n5NHldBuP/OGgykvud8gSj4Ywm7YufDUFdN4oApHLJmSdvzGKFj7k90+L50woPgRHJDUQ== X-Received: by 2002:a05:6512:75:b0:53d:8c94:4ef7 with SMTP id 2adb3069b0e04-53d8c94500amr452687e87.6.1731156524965; Sat, 09 Nov 2024 04:48:44 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:43 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:31 +0200 Subject: [PATCH v3 5/7] drm/bridge: lt9611: switch to using the DRM HDMI codec framework Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-5-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7869; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=b9CjlXHFjClXWt0twlUk/5oI0wepnqrV5DObVEdOLnI=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1odlOiS14Z5iLPHFTRt4jAyTTrxmp6tTh38m vHDx02wi+2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHQAKCRCLPIo+Aiko 1crTB/9RFFeSwX9N+nc0tM960m3RkR9N6tZfMa3Hu4Eb3r65Fibw+Vn5eHv7kyxWeR6jpcw9fCQ a2V2wP2MdBE01Dur5ZKMqM/JFqrYCiVmCdfz5kaZzsqcbEeULinZXFhdrjzMjZLzYCfYe9hYQfY 1zQYuvzWIMbWHtUmRE0M4GR6MPla+cUgHsReRNaPLYEIaO68o3gTknJ8g06rLgGeRpUFj8RYKl0 kjAlOKtWyRZLs+2sGg8syUS2na5dDwuSZpKYUennRS/M62JqJL0hPwcdfLo37gZHkPpmIfBOfJb 0WzhgI7CVYohTt/XI2cx56CyMQBipxldahtdkbhapTN4NjuQ 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 --- drivers/gpu/drm/bridge/lontium-lt9611.c | 171 +++++++++++++---------------= ---- 1 file changed, 69 insertions(+), 102 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/brid= ge/lontium-lt9611.c index 4fa0dfc5539a5786278221f7c13b6473ab320a9a..9d8b1c8d533c79bd91ae956aa4c= b74f3bab6de78 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; =20 bool ac_mode; =20 @@ -866,6 +865,10 @@ static int lt9611_hdmi_clear_infoframe(struct drm_brid= ge *bridge, unsigned int mask; =20 switch (type) { + case HDMI_INFOFRAME_TYPE_AUDIO: + mask =3D LT9611_INFOFRAME_AUDIO; + break; + case HDMI_INFOFRAME_TYPE_AVI: mask =3D LT9611_INFOFRAME_AVI; break; @@ -899,6 +902,11 @@ static int lt9611_hdmi_write_infoframe(struct drm_brid= ge *bridge, int i; =20 switch (type) { + case HDMI_INFOFRAME_TYPE_AUDIO: + mask =3D LT9611_INFOFRAME_AUDIO; + addr =3D 0x84b2; + break; + case HDMI_INFOFRAME_TYPE_AVI: mask =3D LT9611_INFOFRAME_AVI; addr =3D 0x8440; @@ -942,6 +950,55 @@ lt9611_hdmi_tmds_char_rate_valid(const struct drm_brid= ge *bridge, return MODE_OK; } =20 +static int lt9611_hdmi_codec_audio_startup(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + struct lt9611 *lt9611 =3D 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 =3D bridge_to_lt9611(bridge); + + if (hparms->sample_rate =3D=3D 48000) + regmap_write(lt9611->regmap, 0x840f, 0x2b); + else if (hparms->sample_rate =3D=3D 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 *connect= or, + struct drm_bridge *bridge) +{ + struct lt9611 *lt9611 =3D 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 =3D { .attach =3D lt9611_bridge_attach, .mode_valid =3D lt9611_bridge_mode_valid, @@ -962,6 +1019,10 @@ static const struct drm_bridge_funcs lt9611_bridge_fu= ncs =3D { .hdmi_tmds_char_rate_valid =3D lt9611_hdmi_tmds_char_rate_valid, .hdmi_write_infoframe =3D lt9611_hdmi_write_infoframe, .hdmi_clear_infoframe =3D lt9611_hdmi_clear_infoframe, + + .hdmi_codec_audio_startup =3D lt9611_hdmi_codec_audio_startup, + .hdmi_codec_prepare =3D lt9611_hdmi_codec_prepare, + .hdmi_codec_audio_shutdown =3D lt9611_hdmi_codec_audio_shutdown, }; =20 static int lt9611_parse_dt(struct device *dev, @@ -1015,102 +1076,6 @@ static int lt9611_read_device_rev(struct lt9611 *lt= 9611) return ret; } =20 -static int lt9611_hdmi_hw_params(struct device *dev, void *data, - struct hdmi_codec_daifmt *fmt, - struct hdmi_codec_params *hparms) -{ - struct lt9611 *lt9611 =3D data; - - if (hparms->sample_rate =3D=3D 48000) - regmap_write(lt9611->regmap, 0x840f, 0x2b); - else if (hparms->sample_rate =3D=3D 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 =3D 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 =3D 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 =3D of_graph_parse_endpoint(endpoint, &of_ep); - if (ret < 0) - return ret; - - /* - * HDMI sound should be located as reg =3D <2> - * Then, it is sound port 0 - */ - if (of_ep.port =3D=3D 2) - return 0; - - return -EINVAL; -} - -static const struct hdmi_codec_ops lt9611_codec_ops =3D { - .hw_params =3D lt9611_hdmi_hw_params, - .audio_shutdown =3D lt9611_audio_shutdown, - .audio_startup =3D lt9611_audio_startup, - .get_dai_id =3D lt9611_hdmi_i2s_get_dai_id, -}; - -static struct hdmi_codec_pdata codec_data =3D { - .ops =3D <9611_codec_ops, - .max_i2s_channels =3D 8, - .i2s =3D 1, -}; - -static int lt9611_audio_init(struct device *dev, struct lt9611 *lt9611) -{ - codec_data.data =3D lt9611; - lt9611->audio_pdev =3D - 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 =3D NULL; - } -} - static int lt9611_probe(struct i2c_client *client) { struct lt9611 *lt9611; @@ -1174,6 +1139,9 @@ static int lt9611_probe(struct i2c_client *client) =20 i2c_set_clientdata(client, lt9611); =20 + /* Disable Audio InfoFrame, enabled by default */ + regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AUDIO, 0); + lt9611->bridge.funcs =3D <9611_bridge_funcs; lt9611->bridge.of_node =3D client->dev.of_node; lt9611->bridge.ops =3D DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | @@ -1182,6 +1150,10 @@ static int lt9611_probe(struct i2c_client *client) lt9611->bridge.type =3D DRM_MODE_CONNECTOR_HDMIA; lt9611->bridge.vendor =3D "Lontium"; lt9611->bridge.product =3D "LT9611"; + lt9611->bridge.hdmi_codec_max_i2s_channels =3D 8; + lt9611->bridge.hdmi_codec_i2s =3D 1; + lt9611->bridge.hdmi_codec_dev =3D dev; + lt9611->bridge.hdmi_codec_dai_port =3D 2; =20 drm_bridge_add(<9611->bridge); =20 @@ -1203,10 +1175,6 @@ static int lt9611_probe(struct i2c_client *client) =20 lt9611_enable_hpd_interrupts(lt9611); =20 - ret =3D lt9611_audio_init(dev, lt9611); - if (ret) - goto err_remove_bridge; - return 0; =20 err_remove_bridge: @@ -1227,7 +1195,6 @@ static void lt9611_remove(struct i2c_client *client) struct lt9611 *lt9611 =3D i2c_get_clientdata(client); =20 disable_irq(client->irq); - lt9611_audio_exit(lt9611); drm_bridge_remove(<9611->bridge); =20 regulator_bulk_disable(ARRAY_SIZE(lt9611->supplies), lt9611->supplies); --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 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 9A356198E8C for ; Sat, 9 Nov 2024 12:48:47 +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=1731156529; cv=none; b=uvnWq5ONXkOhyQYiHlkJw3fARCmOo0p2jqEWqr8VOwQ3OoS1LTSmKo2Yfw/vXX2h8VTzWyY56SnKucC6S4YdGOfZovBVXcjWDVxrsGEoN+LrgrZVjGBqXKFOwe0uvd3AV3jIt+fvR7ZSSkPeI/P2uWarYmNwWgHEPg9nJfAiWfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156529; c=relaxed/simple; bh=0rIRHIOV78l4xOlDNT90+qbvGFV0Mz2FHXQAMpwi9s8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YPSTuNyOF3GsG9F6YY4wboKbqUfxOGJ9F0uO7GZM0PwV0dsqOO2UBcOJH7Li33bqmc5+KC2fSnY+eZoAev3fRJgFENabOTsIdewVKsXLnFJYjfF8oXcHbw7m80hcu5jHGiP1BM4oyyEgneuRGyARDyA2PjhQJieLx+cqnbrSVks= 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=w2fE2cCV; 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="w2fE2cCV" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53b34ed38easo3071827e87.0 for ; Sat, 09 Nov 2024 04:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156526; x=1731761326; 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=I0No8ap6yrBgF/zpJhH8LFZGYsC9p4wbKlDOOUj0WtE=; b=w2fE2cCV/La+WlQ+nT58aV+gOlt9/dnEZYSb4Ia962ZqXS3Lm9LHggoI53IGz4BhUI NAHMWbW39tj5iIPYwXVVG/W1/thS/OgitR7VqFUIVcl+24y7lUT8gYZChPChgFDJbU+5 j9QqIC2hbYUjKvisuQUyanSDriOhwgFK8xaQ9yr6LUpCGlyJrfZaVhVrryRsNonhqYF1 OZ9k1PfSDHYkkwApKiztjI3RnIi0Vcz7rafydQHoy7jOHuSzINk+IFmGhgKz4K1203D3 3YDu/GBHEXdWpgOA8SBZkJoBWyognSJ2Xjbx4jQsAF9akDpacqcbB9h21/jUHWmgr3a8 WemQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156526; x=1731761326; 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=I0No8ap6yrBgF/zpJhH8LFZGYsC9p4wbKlDOOUj0WtE=; b=kUsJ7dT8jppLszBwwCoVrnmR2eEdobej/q2VVadnZvtx9of954ueoBU8vZz0pEOoh6 FmKeJpqI9qeHIEwKB9Ld+bZ5VtQn804yu0z21Co6Nq3rqvBRGPJEtCo7TJQf9/+KHAbD hrh7Iz4PPTNeGBXf9xvVlUIeWK/1UD23pEcfBedT72s7H/i0CAWdJWXQhRMmN8mU5kX9 Pl2kK1LLaat+dZFJBTl1hTu2NJzBHsyM8vrFEKByxGIUgyW1BTFCItFxthoTy66snKeB dF2gRxUGXH1fP+ACQqg6zkA65kmU3MFGSJbnXQSKVlyXlPwdnnoB9/h30WJB6u3z61PZ 4N+Q== X-Forwarded-Encrypted: i=1; AJvYcCUuzKvvOEbhCbgxXPlJNagcn9FZysySuPpCJG7zpjwkOHvd4QrI+aiuctSF5085JcyV5NMHP/4ig/snMCo=@vger.kernel.org X-Gm-Message-State: AOJu0YwBd65DIAVsCLnSMQIzQcAIwMN5fFRwSC9tc0i1JjKDS6DYIP7E CXvhoyMwIvPs4x2XTX2GoiqffmEXRML9DbWwM+HmxX+9ncWz3xO1d1MDkNA/w9I= X-Google-Smtp-Source: AGHT+IF1snp8hmbIprhuLbAaPklMzRONrEfLzKFk3MHXaYlX7Kfdq5ocDentIlF/eo4E/8CWA9vtDg== X-Received: by 2002:a05:6512:3c97:b0:539:e776:71f2 with SMTP id 2adb3069b0e04-53d862eb5bamr3254572e87.52.1731156525731; Sat, 09 Nov 2024 04:48:45 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:45 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:32 +0200 Subject: [PATCH v3 6/7] drm/display/hdmi: implement connector update functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-6-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 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=3860; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=0rIRHIOV78l4xOlDNT90+qbvGFV0Mz2FHXQAMpwi9s8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1oeIblR/unQZIwmnM6WdC96PZBguzu1woQcD SVQdlnYBieJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9aHgAKCRCLPIo+Aiko 1ZOyB/9p6aVrjmHtzLjrNly9np+bYEQfuJ0QIYM/EXaWea+FP44i4iA6sf8TWgd/MRGZSJNjwWn pOuP30YciUdt6CB0jFvYmqKXQSFfDKvHj4qsgQl5dlC4J/1NXp/H+ndbMA6LtyFbnPcotAEad+1 405gfgt8h8uIOTegJXrH2jon/Tz5gLToAX/76eQEDXYRAArBK6m3jfQpLW0Dt6eb7iQ1r7wOFGF ZMt5zjfqbobPGkXshJrL3DysSuhsEbVuY66N0oCjBlexOXcdIL7p3QRNBseAQIGqcZ1W4NAxpB4 tKJ5Xpn2k6sPIaiV85FgyP1bO84YR/aNqxQdf2VVWprNjybJ 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 driver utilizing HDMI Connector framework. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 59 +++++++++++++++++++++= ++++ include/drm/display/drm_hdmi_state_helper.h | 4 ++ 2 files changed, 63 insertions(+) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..91073456cadb4a48caacf661cbc= 8236c7857de9d 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -748,3 +748,62 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe= (struct drm_connector *con return ret; } EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_clear_audio_infoframe); + +/** + * __drm_atomic_helper_connector_hdmi_update_edid - Update the HDMI Connec= tor basing on passed EDID + * @connector: A pointer to the HDMI connector + * @drm_edid: EDID to process + * + * This function should be called as a part of the .detect() / .detect_ctx= () + * and .force() callbacks, updating the HDMI-specific connector's data. Mo= st of + * the drivers should be able to use @drm_atomic_helper_connector_hdmi_upd= ate() + * instead. + * + * Returns: + * Zero on success, error code on failure. + */ +int +drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *connect= or, + const struct drm_edid *drm_edid) +{ + drm_edid_connector_update(connector, drm_edid); + + if (!drm_edid) { + drm_connector_hdmi_codec_plugged_notify(connector, false); + + // TODO: also handle CEC and scramber, HDMI sink disconnected. + + return 0; + } + + drm_connector_hdmi_codec_plugged_notify(connector, true); + + // TODO: also handle CEC and scramber, HDMI sink is now connected. + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update_edid); + +/** + * drm_atomic_helper_connector_hdmi_update - Update the HDMI Connector aft= er reading the EDID + * @connector: A pointer to the HDMI connector + * + * This function should be called as a part of the .detect() / .detect_ctx= () + * and .force() callbacks, updating the HDMI-specific connector's data. + * + * Returns: + * Zero on success, error code on failure. + */ +int +drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector) +{ + const struct drm_edid *drm_edid; + int ret; + + drm_edid =3D drm_edid_read(connector); + ret =3D drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edid); + drm_edid_free(drm_edid); + + return ret; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/disp= lay/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..9698351307eb3d3dd69bafdff8e= 321a90a15495f 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -20,4 +20,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infofram= e(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connecto= r *connector, struct drm_atomic_state *state); =20 +int drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *con= nector, + const struct drm_edid *drm_edid); +int drm_atomic_helper_connector_hdmi_update(struct drm_connector *connecto= r); + #endif // DRM_HDMI_STATE_HELPER_H_ --=20 2.39.5 From nobody Sat Nov 23 22:48:40 2024 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 576151993AF for ; Sat, 9 Nov 2024 12:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156532; cv=none; b=o91PXD4hd99mhkABKlo0sYzMC2DB8ERTuahw36GBhEUevAfHwN1y0bNajGatkh+K+78lElhj14Q6MSFojQ2szSVidCzLiF1Zf8zJALStKBcQDA9ZzZ5eluTgm1wQvlmQOVlFc/F9ZweK7imBQKxeLCi/zPhbFESrTrR4IlrB5nY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731156532; c=relaxed/simple; bh=yRmYAaGG5FuJnzbiAwK+r8Wa4ofx1aRyHEGe3Ks/gxw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ct2gh/HA/17XAaDmxvChSsgfNJctyekhR/k9JD7V5gmCv6dezEogBcG+BBUJVTm6tmHxPWwVBBlNHGFTn2uGDFAnVIjdb7MYzR114+Dk1u3AB2XUAPqdu7Rt2GOAY1PDeaah48+RFDxEMHm/yeQNTcpH2berzThUOYEi8YJsgXE= 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=ECYh3ZWp; arc=none smtp.client-ip=209.85.167.51 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="ECYh3ZWp" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-539d9fffea1so3099851e87.2 for ; Sat, 09 Nov 2024 04:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731156528; x=1731761328; 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=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=ECYh3ZWpKCqa0b9ffTRhQslWBWRaWnBVWv4wBwsW2pE62mFz11OXPeNIC3p4KHiBS9 dbpgOzep6RP2XmKBe9Nr1NdR83fRLYKazgZDVnuzFVz4Gd40zvBsOfEPLQhWdf8TRfrl WUMepLxQZxLp0yHVg2+PcQcTAxkpkKO6XDos0hod9vnGz9nwiQ9ahX9WXwI2Xn4MQmrW KlqIwtJ5CWMkl2x5mVvVv4A06WFxVEYLSXr47MyRHMIi0I1t2MeJJRWYgj5xfrDCDRi1 VKwXlvMo4ShqjO+KjhtTdqzpihod/vrC1zl3K/8r1dUjt4OAok1L4GqD6af555ruiEdv m+8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731156528; x=1731761328; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=E+NShXrXCx45DCZRdi2tMHKbBv1NguCjEoxc0g/uT2atgWRR1Xxy8EUOdPSpsIIgIf K2vQ4Ck8yX4/XZt4HAWRKPGJZinjjLntGLs/MHho1bbqk3SyCHv7760e9NVJZE6SsT45 dHb0MuF6oK7vB5SS9hfKxJ2ftkPXdzFmfLLfTA7D9U5batJE3/JcoOOblqBVyxdYo5LZ 4Ol/enEn+ilvy9A655TxuSrsNoNU6H+LubKmQ8H5/NFBLxSXmINrLx4tV2sVmi305lWr 3RXL6/SRVPTQHpY9Uhus8Mh5WfvFmOj10KCjMQJYeE/UdyPO3OTldmmfvhfpCViiuyz5 Zc6A== X-Forwarded-Encrypted: i=1; AJvYcCWAE14roHzhKp4f9OqbwYiC/maOVdUuJucBC8Vsi4YHFQOUmqGdTfQUritz3kfq9qqRwcF2EuF3sccxK+o=@vger.kernel.org X-Gm-Message-State: AOJu0Yymrl1u63wPxfy0JHp0zljF9eKwOfod32E+QZOfWL+6OkRL6TuW BQjEmixJu4r1t9in6fxBCCZMm1Dmvtf04RgNQ4NidNybwhaBgwWbA0APdVbf8Oc= X-Google-Smtp-Source: AGHT+IHTXV5Cz5pjd5Ce3JQaNt839BiITtgrMF3UnvNUaVEgnkA8D0ncy/dtINK9kj+DtzeoWo9CeA== X-Received: by 2002:a05:6512:2254:b0:539:e776:71f7 with SMTP id 2adb3069b0e04-53d862ebe11mr3204121e87.37.1731156528375; Sat, 09 Nov 2024 04:48:48 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826a9b76sm929967e87.172.2024.11.09.04.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:48:47 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:48:33 +0200 Subject: [PATCH v3 7/7] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_update_edid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-drm-bridge-hdmi-connector-v3-7-c15afdca5884@linaro.org> References: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@linaro.org> In-Reply-To: <20241109-drm-bridge-hdmi-connector-v3-0-c15afdca5884@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 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4107; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yRmYAaGG5FuJnzbiAwK+r8Wa4ofx1aRyHEGe3Ks/gxw=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7p+lFxRuV8WF0di+7PrL76Ihi3eyqsmfkm3TtdLbPHfu Kv8e1o6GY1ZGBi5GGTFFFl8ClqmxmxKDvuwY2o9zCBWJpApDFycAjCR5AIOhoaNT+94f9VgurjW 63et8pWUF1u7C14yvWF1yLnWKWVrq5RnYdFxJvjIztNnN+cGJ5ZUF3E+WFWh8tP/xY+tPcoVGWs kdS+e688Szr0xvfpM6ob/a6791d7Z37ef8dXtPTG/hL9GbG6oftp7X/Omcre2U7DNu1tTz+yb/e ZnNafE9mo2Tr/wzjfaIWqvF5oELDBtWn/7/cxjNZJ1S5dJ62SacfxzlKmynMBtITLV1PnEcgkxl 2q3/TNdA9cIb3gkm9X8yCfJgvPclJ83tYq2LXreWfTycrXvDaXIZyer3WO6HteXZlycK5KVnTH7 kbZP2QY92btBCVe5rItu/uB/IV9UJGS8bUqp2suFBlpiAA== 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 | 67 ++++++++++++++++++++--= ---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/d= rm/display/drm_bridge_connector.c index 12ab9f14cc8a8672478ae2804c9a68d766d88ea5..71ae3b2c9049016d1cc0d39a787= f6461633efd53 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 =20 @@ -175,17 +176,55 @@ static void drm_bridge_connector_disable_hpd(struct d= rm_connector *connector) * Bridge Connector Functions */ =20 +static const struct drm_edid * +drm_bridge_connector_read_edid(struct drm_connector *connector, + enum drm_connector_status status) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + const struct drm_edid *drm_edid; + struct drm_bridge *bridge; + + bridge =3D bridge_connector->bridge_edid; + if (!bridge) + return NULL; + + if (status !=3D connector_status_connected) + return NULL; + + drm_edid =3D drm_bridge_edid_read(bridge, connector); + if (!drm_edid_valid(drm_edid)) { + drm_edid_free(drm_edid); + return NULL; + } + + return drm_edid; +} + static enum drm_connector_status drm_bridge_connector_detect(struct drm_connector *connector, bool force) { struct drm_bridge_connector *bridge_connector =3D to_drm_bridge_connector(connector); struct drm_bridge *detect =3D bridge_connector->bridge_detect; + struct drm_bridge *hdmi =3D bridge_connector->bridge_hdmi; enum drm_connector_status status; =20 if (detect) { status =3D detect->funcs->detect(detect); =20 + if (hdmi) { + const struct drm_edid *drm_edid; + int ret; + + drm_edid =3D drm_bridge_connector_read_edid(connector, status); + ret =3D drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edi= d); + if (ret) + drm_warn(connector->dev, "updating EDID failed with %d\n", ret); + + drm_edid_free(drm_edid); + } + drm_bridge_connector_hpd_notify(connector, status); } else { switch (connector->connector_type) { @@ -246,29 +285,29 @@ static const struct drm_connector_funcs drm_bridge_co= nnector_funcs =3D { static int drm_bridge_connector_get_modes_edid(struct drm_connector *conne= ctor, struct drm_bridge *bridge) { + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + struct drm_bridge *hdmi =3D bridge_connector->bridge_hdmi; enum drm_connector_status status; const struct drm_edid *drm_edid; - int n; =20 status =3D drm_bridge_connector_detect(connector, false); if (status !=3D connector_status_connected) - goto no_edid; + return 0; =20 - drm_edid =3D drm_bridge_edid_read(bridge, connector); - if (!drm_edid_valid(drm_edid)) { + /* In HDMI setup the EDID has been read and handled as a part of .detect(= ) */ + if (!hdmi) { + drm_edid =3D drm_bridge_connector_read_edid(connector, status); + if (!drm_edid) { + drm_edid_connector_update(connector, NULL); + return 0; + } + + drm_edid_connector_update(connector, drm_edid); drm_edid_free(drm_edid); - goto no_edid; } =20 - drm_edid_connector_update(connector, drm_edid); - n =3D drm_edid_connector_add_modes(connector); - - drm_edid_free(drm_edid); - return n; - -no_edid: - drm_edid_connector_update(connector, NULL); - return 0; + return drm_edid_connector_add_modes(connector); } =20 static int drm_bridge_connector_get_modes(struct drm_connector *connector) --=20 2.39.5