From nobody Sun Nov 24 21:26:15 2024 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 AA85019ABDC for ; Fri, 1 Nov 2024 10:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456355; cv=none; b=KZTyNm8R4psBUABOVQ/d0y7G+iuMDMW5cFnu0WbPd9KkXdRBU8+DH9+L0hGUg8v/Hdjt6e8wdXdv4QverRxtD17Zn9nMFlFSFlH6G5epeVHXULsfYm81J8dBU4EXKgBOs2gClL8sc/Gr9LtH3C8DqJbF/+hcDRhDvS2iBvUkc28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456355; c=relaxed/simple; bh=+Hp57m3QXnAn1W+61x8ZbDF7cVDM8XAonWljrtUU0rg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZSCJganGTx6MD4KIW5WfxQbBuA289nQgzdT9wdg+PrqneHH2pvfuMEhLVak1rQUr2T4hjlo8JrxhpdX2ghgjW5WgKbjlRsyWyu0cszOZMtx1QJsb42b22v1+ibwOnrpSuJwEoOgy9Dl8syQdjYCali9xpkYZgt0IXQmFpsu41zI= 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=OFCyKNXG; arc=none smtp.client-ip=209.85.167.50 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="OFCyKNXG" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539ebb5a20aso1915352e87.2 for ; Fri, 01 Nov 2024 03:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456351; x=1731061151; 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=OFCyKNXGYj6jme0doMs+bzxcWRktEgGl6eG+1Tn9nDE9zOJAKqQeIBDZK8+vwngA4D DPwTBcPhHATjxKLyNH9L0yZ5dzWN4h/PReXlBseeNjjeUGmP6D1Q6u3TyRpDREoHMTgO 327Dl3NUF+rcf/B1/4bnSjjTwgvnHJUdrr+0DO5N56pWZUpZiGYW/d/TRif2lfK3fug8 hqRYJzLFyzoj4i6/YGuAzMyibP8cJsKIhpVhNcHmlGfcJczJ95/j93K8Lep/g+U9bgcQ 5WTKvWg/Rd5aP1X2QsHa1GfNOsemjf5hPlPeEPo33LFHxfx1O0dpXxbyQ2Jb9dKlsfzt rUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456351; x=1731061151; 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=phn2trbZjc5j0jbZZWot57D1EWK+fTTatd90UTfi4C4VB3PCAmVLnv9A/frd+ANf7G 7baQymmR95IhOexPQIySpdulyYmHiII9QvFnMEulV+HP3yqSid6GgrDv1zLrx3r2KPw0 o4ZfHv54raUqusxFVk4S4OwRZM6ZsrpP625p/xDdJ+n6pReu7nIzzi6Em0PV312ydFIa uOlCuEH6SQhIzUSKLTmjN4ZmVzi5URA7VBle71IxNsGBcVkqQdUE9tTWSR75/ZyB4OsD ysbvUBGvJukxornOusBj4wpl3on0OUjXiyhOB3VcGMRytbLb6fuin/7a8Xl60/KlGf/e fHAA== X-Forwarded-Encrypted: i=1; AJvYcCU8t7ihWLdM7Kq4Sc2klxyQOI+cj1vExl7V9xPMw00zfNiVOvfjAau9HGvqRHbUPhJiDJH5vnI77/XoHUg=@vger.kernel.org X-Gm-Message-State: AOJu0YzVwYb6cTU6yDoZ/zADq9vHq0MWu4XiSLrPY78pzkbLXWHWoQkG kHZs8MTR/boQyEp2zQbGIGeUCBcoCGdMyfsxmqA0O9nOmoEUF+tS/TJqsZxRgjg= X-Google-Smtp-Source: AGHT+IHqy42HrMmfsAoD9Rv6pzGinIsSBQMCWOUdnXOEzuHFeER7Llx6M5+DAeAPb/oiSa0Hwraosw== X-Received: by 2002:a2e:be08:0:b0:2f7:4cf1:d6b1 with SMTP id 38308e7fff4ca-2fedb75732emr15286261fa.1.1730456350704; Fri, 01 Nov 2024 03:19:10 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:09 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:02 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-1-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsYXAj2mgrhv3yXCjx+Fl/iGYql1ibKHLUhn CRF/wuhKX6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGAAKCRCLPIo+Aiko 1WD4B/0ZOGZhKgVf+9tcVen34B2OCb9RNi3K6MkkJLmmn4+uYvDglIyaOT7d+Puied7BTs+e2dw 6dxCPRD5BjVBLOsd+b8i865IYpn0C8OCvPhmfmj7hoECadys0iuRwaPHcVJZ4PbBm73/2dH6x9e gSIc63LA2/KreNsjtsWX2yv39bJtL/wL/Nqh0JJ6ExMH1jQWOi6f177CBPWEpyGBRKunt5EUgOQ VHZeVTWouIKVTX6SkhOsjMgeqBmzPfyDcQ3yVsMl/0NRC1KcNHcwEvjXvjvBmSzJatxjQieZuB8 L99EW/RFmr7HZt0vNlJBh/YyN2QFGhoLBjWnpbU19Y7dz7QT 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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 7D07D19C54E for ; Fri, 1 Nov 2024 10:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456358; cv=none; b=o137hXO/eakyoO5eMvPWOfM5HAmsQHg63EyI010d1o5VpuyIVHLu7F9HC4r1q+hVDnuLfns70vZapjhzJ+M150Uye+hQDtgHol5QZ7pjBZf4druIi0S0B02bMDfAB+fpItNGNRum8Z/Li9TwpuLlDv7JX9FxxB4UFA2QYvtJCoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456358; c=relaxed/simple; bh=LbKRbCnwnF5IKOB5onIYhAVHCGAlhI6lq2NpjeQ4ORo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f10e76iXJPflosTjxWhPMYcXR5CqizOWW+0ECQtkCMvFgVZ8EeYsxzrY//Yn/Ga8qQjZQsk46vxzaHfRpAIgz2zhtAfrrbdNozAdTCCmDFiA6ERMmjGvsQ/JWagRpiYmuQSZvCb1mtW6FJA0AgbPK+WYotSTx0DmW5dXMF+F3K4= 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=yhEtU7SM; arc=none smtp.client-ip=209.85.208.177 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="yhEtU7SM" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2f75c56f16aso17151781fa.0 for ; Fri, 01 Nov 2024 03:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456353; x=1731061153; 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=8JdALKV+TTQQCkF+eGATvaOFoO5xKE9FdT+V5eMdj/s=; b=yhEtU7SMopsq6evlyjcfE0BZJ6gCg7sJJQ2hVGHuliOn5riSOteZ1AVZWaWLaMVpX0 0pvd8NpAs0oOwE0ruAOSJ1EEaCJOzqQI4jZEbjyy2lS+9lZwlu86ntULC2BSYMQ0Tk/Y KZb0WUr9iA4V1INmdBBXC4mzHEEzjkNldfRunMViByTkY3q6g8figKbIbwtss9dDn860 QqIX5HP5XbdpgzjtSfXJMYOEZbUZCh6DgOb1lTXvigDYpOSIQ/gEqsujn38YD7HzW48F D3AuL+loYvgH+EXfHTWD+L3kT8ZNKMbIl28I5n6upiAUxIc9ioahP2k4KeOUCsXnMftD SH/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456353; x=1731061153; 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=8JdALKV+TTQQCkF+eGATvaOFoO5xKE9FdT+V5eMdj/s=; b=nh7fLvDOpAuQw2SxscDIB64cnrxxzOr238P31zd79+ZlGbO7VUKXOfMr4lx5v7mtsy Dzir66UFsgQXVtTty0C9gHdbzpWQAW+BnsTdNt5p5VLKSCNTKqq0q9vvb29b9sZTKPKI cybwHYoupE5Bh1PEo0PC1TIQMmGyyXSnna5wqE9hjYIkToAFvp8bJhXIrKdiwbbZM2+J D8FT+GZQBEAbjyaOV7SEZeP/qHk9h1enb+hqwUZHKBwzWWSZfHunLt+LqnTzhVVsbStV kWkDW9qPeCuEmAPjxZHXwpoBp9Bqq8sEozhGBKuktxyesniGETOw8z6ZO3au9LgpX2Ke DuXw== X-Forwarded-Encrypted: i=1; AJvYcCWfRcApG5bWexNHxy5tOH4nyUMkwA7suBYICdvOB/Ybu8ZF05pVDYE7fmy3MhAWk5nlepguSODCw6GjuZ0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyo9NQikwr0PWFqLR38XhzXrmqA7Sz91g0gb8QRS87YnD1Fybxn Y52nUwvJKD6FMvOFrhSdvOHFtImY8SYTDRo1w3+LiHMiLMz8IWL6M2xyGPBu3kk= X-Google-Smtp-Source: AGHT+IFRqC+0Mrvx8xg+0chBuFdUJtVY5uIXTrlxzJ2VmDSEtjXrndxyR5Fy0J1ArK61fOv4LEpL+w== X-Received: by 2002:a05:651c:2106:b0:2fb:5b23:edba with SMTP id 38308e7fff4ca-2fdec728f4dmr32784441fa.23.1730456353360; Fri, 01 Nov 2024 03:19:13 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:12 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:03 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-2-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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=8666; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=LbKRbCnwnF5IKOB5onIYhAVHCGAlhI6lq2NpjeQ4ORo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsYfpdK13nAEegrtSPUX641KUljyBQFbrLld B58arMbC4OJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGAAKCRCLPIo+Aiko 1dgtB/0dm7l8qq21SJpE1oam/AouFpMxZgSfp5u+4vkjLyjHolVo4aRAJ13quCKL0D4850PFBon mWfXrTHzQwKnNI+0yMQm/A+80t5rwFE7SQRzIppvSS1DmBtr0y5CmAubtKtFu7zQWW5M5V5qkr5 z//OjQe7Vi/JYHNE9wqNdd/D/yIY6wAubjZYkhcXa+JgkylvZKFR/rF/+4aAjLcUk055N8YU8hR Ycs9cLwJ+idtWHgVm84sXEpeycS+ew9Z3KRtmA6jgnT4XQuyXJm5m+/KoNn6ej04cIcfhq0Wlke y0Iuc6ekM8SJkQGbz50eycNS1YwJgs8NjEqROXOnScamiaKI 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. Signed-off-by: Dmitry Baryshkov Acked-by: Mark Brown --- 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 f0f6f402994a7be7e3faee68d66bdb25888ab768..b401246b8f884b9885ece7aaac2= 3a4de2826fb0a 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2532,7 +2532,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) @@ -2543,6 +2542,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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 560EB19CC20 for ; Fri, 1 Nov 2024 10:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456362; cv=none; b=odK9H9Gf568OlcJgvkiaLL/b4UkwS8v9dWTUu+4FmPa94OlqzIDO9CabIetWfELjuZirjQQhSxwEC55G/Yo0q4bQpQ+34JM7Jdya3EOXE7k3hmf6NrcS8dLqqoua3Qvbjr0tAZOMQgz2Y5TSlm+o1AlXVpZfCWvhKgT7uNliNk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456362; c=relaxed/simple; bh=J73ORTWzhhODWeaq7deEswTDv9EGimfDnk75uuPwfvw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SUUbs5SXeTADo3eRfxWyWhRkSHra9C3Zh4GujtX1wLViyJOPYodKlScIyyH/d4hqissEPFds9u8Er2ogJmV9o3lLF4j0VxlYFTKo+x0+YY7K1JUtChCcqN8yTIENqOta2phyve0PMnbKruaAHvxYLBUL2rKwWs8/G98VvlUOsxs= 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=XRfMJ4Gi; arc=none smtp.client-ip=209.85.208.180 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="XRfMJ4Gi" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2fb5fa911aaso27852921fa.2 for ; Fri, 01 Nov 2024 03:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456356; x=1731061156; 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=h1/qiW+fnRl/FJlXPSiMeWJ1ccQQT9CkXDqCh4iuUkw=; b=XRfMJ4Gi//K4DfeMFu6qdRIiO4d2YO3JCAcd/AM5Dfb35OherOg6dLJCoGCEEoR9OG QwGqfsZECODYzIGIQ7RdpQDgk7W79XHjoz7hO6exN6aV/hmh7/I4lTCMb1HlirdYAuDy n5wjeHnEUCHaunGtPiC5m34GbQEWPNsa5EPr8I3+DaosnpJO2BB41rvbPXcCqKs1vR0e hdCPqQC6x9tS49+4UAD6lyslxQV3U5CZjoFXDefrSGOyX304LlNhHhz3DhdOWtC8zcp4 O1HfoVMhAuzLB/ksq2QEwCDwT7B3beVhw56uOR84VHbzDhWdEzVu7OhNY5jhi4j7EgtB 1m6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456356; x=1731061156; 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=h1/qiW+fnRl/FJlXPSiMeWJ1ccQQT9CkXDqCh4iuUkw=; b=pQsmK8d0Yt0roNnhMCJ3Kx/eZ7HxLHIe/ybQaK3WLA2HmvcqaJzMPSPAG3rK2F9qib 8cxW9/YHRiw0YXMf2sJxs1/MsLk980/GXW81Mbq3LgIcpTolXAdE938hPAVMoT0I2sPy umB3c6doB9HxslYnxB7EuTgMR1Q6K3uYT3/Emc4zKltDAtfhqdb/G4zQaBMCUALuNTQ9 k3n+p3+5NJhsNLKGSfZFSR8KTo1wpKTMCYmI4NC1U8XMvPM4bsgAlVlCbyxc5Yupzk+m Zzb5MRbifEhNgIa34qbZABjirmEmQ48s1xkLtdGJ8xfAMQBNPpFRKODyhmet4jeef5IE unTg== X-Forwarded-Encrypted: i=1; AJvYcCUychWb0uZ9P97ODnpWYUhzJlLXJHp0GlvHID8nV0W9Fy/6VqxoUePtmErs2G0phxaS6a2z6MD4G2MyOU0=@vger.kernel.org X-Gm-Message-State: AOJu0YzUPWLCq2i0XgWZZw484kB9lR0xTIxCZI1S+5sbRna3Suw91F0Z nCIHhUp4S2vqlYJwdQ5jgq5pLLwHo75Db8JTjoUY5tIThBKS3ebfH0r6yDdxriY= X-Google-Smtp-Source: AGHT+IGfOrAmvPqGnwkSe0ftz8Tmhn/NjuEb9mFY++/dM079TIBnXuB0aqnqlIdmYRkVJozLPc5G7Q== X-Received: by 2002:a2e:bc27:0:b0:2fb:5bd:8ff2 with SMTP id 38308e7fff4ca-2fedb7a2d4fmr25045471fa.16.1730456356390; Fri, 01 Nov 2024 03:19:16 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:14 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:04 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-3-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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=12993; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=J73ORTWzhhODWeaq7deEswTDv9EGimfDnk75uuPwfvw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsYvIjxTMttagkeB2+A7smBCSZdSiTLwEmCC iC1d9AOSPqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGAAKCRCLPIo+Aiko 1XznCACFHBGN2p5UoUoct++a+ZJxpE7/7drc9tW7VJwvZbQV/K2O7Le5BHpcnAWXHtQz4ZFgJA4 43kHY6Ma0+3qEqDSowKogCBTNFl7hX7zLxkPumHsGeLYBF9NwBAPKfX3MoSSc3da374ibYMbz0S CP8+B57H12e4rWyP1D3KKhWyKfDHQLDMOPjlW0iVAaewNAivxYB+smHWxxSeA7PPzDrXn7jUNQz 3Vx2mcqpoZ16RNS/0n5VYq5mNFVPVJv7WUuzn19z/FzFgUVPKlexlWLN7uwK/kX4dhRAUSYSWBT b1bPx50dDKoW8z9x1LZ/vjqwWAU67nJFRyO/tuHNjiWVqysN 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..cec727d3fc1493684e954195264= b1a5d85a7a2ff --- /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_init - Initialize HDMI Codec device for the DRM conn= ector + * @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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 0858D189B8E for ; Fri, 1 Nov 2024 10:19:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456363; cv=none; b=Gk8D2pmait4HGksw6R/zOuyNKLoN7DR/Eu4/uyG5jH4BAyd3KJXHLPZvLHGih9271V7xOZbfAFxMpkwsj5V51hDmMhsZu35HqrfCwpNVraBlbvNbFNUPQjDkJ3OJ24+6n2x5obBA9Q7q9n4myHEVx0rHbPXb3nS/bUOIiUEuupw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456363; c=relaxed/simple; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pdt9MI0JqdV6Q4lMeJI7N1LSye2/2rCbtwbXsqqFqYVpxt0IxnIOpZpO6KiIPI2U35ivd48MWq1q4CvWLSqhgt+gcZX3/aK9Db+iXOuO9btwxwY/KlhLr5QK8REOXILBW5kPEgENdvvBmLj6NJMGKf0ASoba2fKM07BY51qTB+Y= 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=KJfcXG56; arc=none smtp.client-ip=209.85.208.172 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="KJfcXG56" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2fc968b3545so18373881fa.2 for ; Fri, 01 Nov 2024 03:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456359; x=1731061159; 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=KJfcXG56xBZD50EcYiuKfn/56fxhE0n5iX/ssJIxOyyCARXFX2UeIXp5PevbkHMQ4I xB7e7KWX50V0yfBFKtSARF6+rN2S8quWy156GYrttxh7QrnbeGZVa1DDy0MRp7vAnzq6 KGXAC9ScU7CmSPJqtGpHXLSAmG00xkbIxnY7CbzaNR3xwwtAbMC/7brgsbFIZXVBlgxF Ax2c+/3f2JtXgsT/iXuegY7to3CK00wY8CAZ6X6JbpQyzckTm5QtcB3TxnyjdM1+zKpr /tvZzdOkxoC7G9+0fcGg1dCq2xIkePcRXTqtyfDDvMW216tl9YzpUQfAylaz5MDFzQE6 2Ngw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456359; x=1731061159; 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=ZAcsxBKr7JJIrKypcU2FeSfXrygXFIhjw4tFv4X39IdbSONmAg51+JosLf08aMJVl7 OunKyvWaYQdARRVq1zh032sHR0yd//mfFD7pHTa7uRRvTYilxvBg+Nj7tQx7MrLeTbG8 FBVOVqe5HrXZPGKnR9BsX6QJJvx7Vz5lg0u7qnPEUZePE8H4A5pPI+RWjFA1NsvPPGWK fjTTkgX2darPrnbYeOg9nn6V3S92QLGCqT2v2lhC9CkpLQZ824iiSv5dOQtbByPPdt5B Cw490AWjqhQT2n3Q18q+K/f6BIREn6CTeu/2RiDk9PQMjpTlfuXxoTYQvF2O8erY2crt xVTA== X-Forwarded-Encrypted: i=1; AJvYcCUF/7ZnYoMj9JFjWjyU78TMfayozV08mDpxUBOh2/fsL7hONo5oXxmz59TyyoPa/F7r74Syy63GMGT92Og=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6pDHzKZ1Rp08dOqQiYt4k6uQnWxBcWJ1y+Ic9RuBiouF4XMJP GxlECm00NRaLaXxqVBw1Nqr8sgkfnflgbKVZPMtwjgXn5mlAhDpYDf7m3NfTEkY= X-Google-Smtp-Source: AGHT+IE9qVtEb8hD2onX8ybuoo0wSFkN9p7iG6F8kIb0o7PuyhgLHcCk1r8J3Jw9UwSv1zFmy1Mfnw== X-Received: by 2002:a2e:a9a4:0:b0:2fb:5035:11da with SMTP id 38308e7fff4ca-2fdecbf0f16mr32352421fa.33.1730456359186; Fri, 01 Nov 2024 03:19:19 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:17 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:05 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-4-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsYO8+YDuFklEfu+skckO4ZOt5+W0xK+/+6Z 1rclxZqyrqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGAAKCRCLPIo+Aiko 1cmbB/9Yy/vFGsEApTBXMt+htavdpcCL/LupIRx3AwRlP1DVMaaeA//3GIrPkTHkVeRQC8f1wqv QVBZWKFk65TsruuRDxnqIcUGZ69N6RunSoerxpFkMkGhruRHstvbYpkchUWvkmRipptTDScgjUC sLxjOK3D36zBue0TPgNy0Hsfb2LKt0JIZDd7/gYE9Js17Yrfbk0UKRryL7Tf0r0ZbMjFbv93+Bo YqbmtPiPJh5/pzpQmXr2Y9ZrxEM3KsBtsOG7s7yKCv8+tsQzNpb8g2fB41bY7ozJq/wQAUu0RJz oof6u4qxGP0bdRLj3159+LtPxL9alfGvL5OKRihHwA1tqz3l 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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 BAB1019D8B7 for ; Fri, 1 Nov 2024 10:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456366; cv=none; b=dCILWeFdMl+vYZKJVU0BDZpG/eItukdAexiabFQlYfUURR8tiIIuSG9IaNe4qcb/Rv6YHoRN/+SYPPne2I1p1sH3TINIAFKsWmEvqODi85+ausoAzY1bi3mXdRHeLc+52d7AmKyT7o3eFcUMoelOfWrw4QHYMZt3IhCl1DMxzn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456366; c=relaxed/simple; bh=b9CjlXHFjClXWt0twlUk/5oI0wepnqrV5DObVEdOLnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C+F7/5JmEKIjT4nkJuiNYuRFKwjLGGA8p3NaWrLzpsqOjlr9MXz4FsRL3EhUsRVXR+zWaNvvp1t2bkdFDyGdW2Csc9R3sa+hwx9QDVHeZfHp/HBg3VNNFwOT+9hvXRv4otiduqOnjYlrMD9PdMCo1Hpq/kjgUXDQ+3KwyxVx1oE= 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=nMTZdTob; arc=none smtp.client-ip=209.85.208.175 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="nMTZdTob" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2fb518014b9so15291141fa.3 for ; Fri, 01 Nov 2024 03:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456362; x=1731061162; 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=nMTZdTobm+NGy+owGgv6S172Gzdvc9c7Fz9ca5j2NVe68WX51I0ObKxmkyzgpeJdF4 xgCTSRs4T/SM2kqVSHY4teE8iUermkwth5l/DjWvwGSLFGbW19ehNtZu0/fPBsceYOgk v5LC4+SYwSa54+d/vAKlMzJY9uiYeC0xPTkz9TSY+rfA1lu5uFwFPjoVdfJaJPcOsRwh 0qVBwc0QzDexb5hyGj4PRiFyeaFoU0IqAHkssoG2cRWcLphhGBVvhNbq/soBl4ghoY9d FNVs9jPc3wcje5OE+vUAt602IB0VIn0M1sv+nkJfJPsi3wZ/ldg8BMyUwyWmsWv5RKnP 6VQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456362; x=1731061162; 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=BkHZaClpgIIT0Sfah3X9UwSzZvD6AfBdRm/OXo3oqVcFt69WNbdzEljrhPvH4avfMr zPaHD2FMalZbcerCfk3jTBvcCkq/Yvh702GLzsVJM7j9QS26TWNo32Nj1a1IM5Gwv7ad pb6WIBlVVi+5IXYuBorFNVpVowqVcUGZb5Q2VC7r+n/LaehehQbRjaIINGGLez39VJ7A RxTFPiNwbFha2rTm3CpDApOv/CUU7qW/rZYrCWI/XsggoO9cWNo3D1T1xBs5CM6EkPV+ 1QRy9nF3GreN1Xl40fnk3QFK1InJh4XGtEWQ8NPERpt862ftvb3h1HJCtw7ALd/TLZVq 4Gww== X-Forwarded-Encrypted: i=1; AJvYcCXBr+CikQy7aHBZkXSvNDwMZIn6X3mn5sM7CxCDxOJHLSxT7ku1RJuXDrDtkuY2Tq6pHabnD7c0e5Yise4=@vger.kernel.org X-Gm-Message-State: AOJu0YwGCZmpvaxVPNgHkJ7UP4jMp862H0Q1SLw0HHG5LTRCqn8pmaW1 tx3PST6BMBL0Hxy0/daBNJsw5C3mI8JEEcrXJjckt0YeWkhdv9JXFBBLnl/IdI4= X-Google-Smtp-Source: AGHT+IHyA+CdBfomxIExGbO7aXkaZFF0poEJsxU0dhPD1rsn8uyC/pmfbOY6Stq6lph25Uew4kt0YQ== X-Received: by 2002:a05:651c:2123:b0:2fb:45cf:5eef with SMTP id 38308e7fff4ca-2fcbe04dc90mr116656431fa.30.1730456361878; Fri, 01 Nov 2024 03:19:21 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:20 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:06 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-5-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsYN1LGiSPgOIWjskJ8XtYxymYjffJCPxoST PC8lPTitNuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGAAKCRCLPIo+Aiko 1YyRB/sFNxzWLmdqbzWaCcuOmBGrE0CKhmcdCjqMfAF/TIXvghRUFbT4F4bYAVuS5yKeGEJ74Rq cp4TqLZ6cDLBp79MbvyT0zZqPuqiQuKnREjp3jppH+TPv8xrPKpMLUoyBKE7wYYkoxwztq1jOCt zBkXZWoypk8mUZnoa/wuWcb3BJubjsK5z895jIvpHC9UEUpxERMV83zPyT2zxX24fdQdqVdebt/ CybOVeWxV7ILVNW0swbgI4c8tbiQXFd3G7ZLhzkYIiaP3wi81TB/cvvBMe3Fy+gF3prOKH1mbgo WvA+VtJa/MfbJLulphgW/8tlMNvS6m0DOEM8xE3peeKIuiNJ 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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 8096219E806 for ; Fri, 1 Nov 2024 10:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456368; cv=none; b=aUqOsbd80kaY2T9dppmOn3DOKRKM3canT7r4Q63LG9Ylbbc0RWpr3nKRa26X8GicQymljtxfaNbIUKgiP1yPyM3WaACLTwMzYFHKsdtV8ibCHmJ6nXgC9UclpLNdT0S/cBxah3cV7qqMx2FraOcwsdKZtMeBFUi5EYEuzr7R4co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456368; c=relaxed/simple; bh=o8zF22Q3lPENAEm/ZYvkUJMiXNxulV8OozkqO4RXQvk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rnNQmIf28w1sUmrTK9YrWM4GhIlwyPckcScG25F35zmfgFix48rNGYFZdwVdCH62+QErXfiOFtBd/0L+RtCkzV1H3XcqUGumCJxqqpsfPFYcQILWWKJI0B/jVGV/qnY0g1Qh2+F+fED4HTr84VWaerlJtZ1Pq2MaQxvezGnjO5U= 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=a7ZiPqWc; arc=none smtp.client-ip=209.85.208.182 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="a7ZiPqWc" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2fb561f273eso15706831fa.2 for ; Fri, 01 Nov 2024 03:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456365; x=1731061165; 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=nGgjAKyLcDyP//XG7JzBSUmff5/dvBkAhC31JU8OV0g=; b=a7ZiPqWc+zdFthvpEz6+wy64DTkHrjj8fGZM90LIxtZh6gCZmdUYB9YA4sERZ4FDXC 7H34PAmcZVvXY07ERRTTSdaDccfbSfVzDRgcgN5DFvGBJ0Yt0I2ha2p3Q/5mFuAj6zwW 4K5Iw1xIIkHtlubAeH8iQ0A4GYC6gq0rEfNnH6cl0nvd/6D/+J0X35sv+9RhdCmXdh5g 2hlYH3af/kD0v8ae29HP6BPdG+YjTCGsAUxdQQOi/6eJR6Kqw2vjXMuf1J74bpf+hMGG KnKoVXm8X7nXMau9p8reo++kQTctJhFnZ35FIPWzFlUXSnLkPIUJxJxEU4j4yUkpWKeq Gixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456365; x=1731061165; 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=nGgjAKyLcDyP//XG7JzBSUmff5/dvBkAhC31JU8OV0g=; b=ve/e220s8QvqmHQ0v88mMlWcFXpOJZasgJFM2dDgFxgLoVqanOXTjfJV/DEhwQ51PT UI8iesJMcVQu7E/QClbGXDvqEAS86UP8sPwRTAtNKyNr4UbcjNaCrr1n0WCZxjw/9Ekn sxbSKjqw0fy1UrHnjOJROkgW5tx3+QGF5iMeREETldqb18Mnih+nDIQLEnsn5UCkIeLK UPDz1V0sapmA5hAK2ysAnTLXOf2TCSnYi8/sQC9TSgJLw9U8a/O9Bo8Q1WuIDFy8v0F0 9+2V6v7tZZoPZb58+VhMxAtwz1/7zztPXB2JtpYSHbMBmtWMaobERPh8yc4HpvqkwdrA EBbw== X-Forwarded-Encrypted: i=1; AJvYcCVk9XvLgyZeVzHOYLQ/qLHM1Kpa8DOR7WdvizU6ft5I2rct1zAAOKkptQ9O71Y66T1JVbMFoh4NeeENsPQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyZpqu5s7bkpbmuMcbHbtY1XvmnmA7lu97vaBfkJtEC9mMP+Fz2 CLXOeuzxtTSf8jLi0sHdwaHl+4it0hCV1/pmr5xKUEL0AEZUUVp4THoAy7FH3xY= X-Google-Smtp-Source: AGHT+IGrg+MWNfrCkOop6SzsPvLBRfWp/DqEaW2dXOspXiW0SLaKOKmN4JT+lZ8wzfmuDxerrXaXhA== X-Received: by 2002:a2e:bc0b:0:b0:2fb:403c:268b with SMTP id 38308e7fff4ca-2fd059d28c8mr58307211fa.34.1730456364657; Fri, 01 Nov 2024 03:19:24 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:23 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:07 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-6-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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=3910; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=o8zF22Q3lPENAEm/ZYvkUJMiXNxulV8OozkqO4RXQvk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsZVEQyQuPw+HstvVa+ywD0DzMiBOlZfnHVE KF1rHV9ULuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGQAKCRCLPIo+Aiko 1fMQCACgMN9amTdAcyKL+du1jF5SGu+FJ0bpmOX/kii6kS9fkFmW3LameFMLXWArrtscsYb0BjH aDoCZmihQEAP8h2xj6l8plf0wv8gfO6BMDn/iXRyNNPoDy+V6aFvFwpm5tVCGyHHghH0z4obR+V pE4Y5Osy7/1lliErcrZZgpCgoOTgIRlGiL1BafbuEgz+0qG5wFZfQO0mcz6c876TN9ml+Uo/ezl tVuxyHU4FxXr/WsNhnV2H5HimCa55xnzoLoHnAU8c1tX5S6FcvR9PR1OBbVO9RcyouOgv8Ky/Id fu2VYo2hsea/slZ4EpRbcAWw1S16Zcmcf4ZKPK+rJq80q2cX 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 | 56 +++++++++++++++++++++= ++++ include/drm/display/drm_hdmi_state_helper.h | 4 ++ 2 files changed, 60 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..dc9d0cc162b2197dcbadda26686= a9c5652e74107 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -748,3 +748,59 @@ 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. The + * function consumes passed EDID, there is no need to free it afterwards. = Most + * of the drivers should be able to use + * @drm_atomic_helper_connector_hdmi_update() instead. + * + * Returns: + * Zero on success, error code on failure. + */ +int +__drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *conne= ctor, + const struct drm_edid *drm_edid) +{ + drm_edid_connector_update(connector, drm_edid); + drm_edid_free(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 =3D drm_edid_read(connector); + + return __drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edid= ); +} +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..ea0980aa25cbbfdd36f44201888= c139b0ee943da 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 *c= onnector, + 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 Sun Nov 24 21:26:15 2024 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 5971B194ACC for ; Fri, 1 Nov 2024 10:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456371; cv=none; b=IWH597e5WIqRyE1aVxDdJtjn96gSAalNYsVLffjdzWexdIojfXQDHvXSWC3UrhErKO3KUWQvx/eZZqmWU8ka8ceh23m/yVC5grVcFR3TcQ20C9lMocnvNQst0Bd7zGWNyF4Jm4xkWQ0eVQ0fOoxWYOcqIgnC9vVFfdgpzFHGaDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730456371; c=relaxed/simple; bh=Pbf6ekV+i45DFn0vAhN81yq5JTl3TzjpRpOOR4scnrw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j0FOt3QnkzcEP65ZwgEkSgVnDr4QFQcfHL3kbPP9onfR6NTjN4jeL4pXYc13Evji4Q1j7TdDdCRk/FBMM81k5KPIzytT0NydN8C2dFQcamWMiBWOMYDfvjfNL6LUUNfFvwarlg1iGjb4DYOovhfg3oYWjbdJajfeXDYuuJkM6wY= 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=LPDq0nWU; arc=none smtp.client-ip=209.85.208.171 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="LPDq0nWU" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2fb3c3d5513so16626451fa.1 for ; Fri, 01 Nov 2024 03:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730456367; x=1731061167; 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=SSyJnhqtzNGB7l1kz5uHZfxocs7V67foS6FdivcD7DM=; b=LPDq0nWUy3/bWgb9gOAemPwNFv7ME4/jBhY5+xIMxjCg7sryILu6836hANayqdZUIu gs1u7LR0CM1GRbZ3uBKuNeooNh/Pw8lOzAl/7+Zqmkp8a/rgzAYmkmzt/rLhFiBWN4LC esF7VSCioNml39fZQqDEXdYaE+g2pNqVFUe5nwIK6dlssJ6MfHM/923WP4GxAx4TdTwN QK20If0rUdSD9q6nC3qPFwDn4Uut6syd6G+jUkwMWPnROkOV++jZcTVPsmQjqgxrc/JN 9dvDV3udKScbJ9yHyZ4fuRYhqFcaekkDSu15AsbnXbBvkFVqO53ByABHrA9XKSAMy+tE 2Dkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730456367; x=1731061167; 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=SSyJnhqtzNGB7l1kz5uHZfxocs7V67foS6FdivcD7DM=; b=Vd9tkiSXzLGn3CWrunxsZX2AOgPMlr0zm+fJpKeenNAN2iZYwNxGzK4SAMSYdi/wAa vUcgFlz/449Wk5Hp89kVcL3aRO0cDXpl6vyNg518A8l4UGCLLcT84MpuW3eiwP64rTHt piYsVBAJt3PHyIHD0kat8oQ8Ku7nQyAwFABxZI6FhUwoelX8fk22eakRUmIYsd+uxkTa bKZZQorwC64GHak24vP/9Ayx9ASdrgdB5FqpokQ7foOG2OKMt6hEh72R24tYOyQJauY6 dNv4jIzZJB1T0xQhdP6yqz/K75gAkZ4owHQW1GE8txNTDt4FkJSRscHQ5OqiPXqYN1j9 EVAQ== X-Forwarded-Encrypted: i=1; AJvYcCUO9gN8PmZHVDoc3PnZt1TcXrYxew/AvBZcI79HiZ42ZrFXUPIK9qhKJkSuK/XnaBwvegyE1aaJGmxNOsU=@vger.kernel.org X-Gm-Message-State: AOJu0YwqSkAmP9DPYHYhjxoZi72cpT1MVp1k5Db7VvoBJzcRsEXJ9uiy uz68YB3t9ULobSOqgF1gzn82DlaKQ93TSTjOYS1Y1KYVpPR1Vmh2RInNXwxYdIA= X-Google-Smtp-Source: AGHT+IGhSWfH6euhYW2znlkFK+r3govgY1LuFIe7fOuMV+C37e3QgH0MbPED7GtFqocAeau78Vvz7w== X-Received: by 2002:a2e:4c12:0:b0:2f6:6074:db71 with SMTP id 38308e7fff4ca-2fdec5f831amr26624951fa.17.1730456367449; Fri, 01 Nov 2024 03:19:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fdef5d6ef4sm5197031fa.48.2024.11.01.03.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 03:19:25 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 12:19:08 +0200 Subject: [PATCH RFC v2 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: <20241101-drm-bridge-hdmi-connector-v2-7-739ef9addf9e@linaro.org> References: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@linaro.org> In-Reply-To: <20241101-drm-bridge-hdmi-connector-v2-0-739ef9addf9e@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: 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=4075; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Pbf6ekV+i45DFn0vAhN81yq5JTl3TzjpRpOOR4scnrw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJKsZAyyzFUbIF1GNuLd1ZpLZ1B2KWEi1m5jD4 rBI+bHjpFKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZySrGQAKCRCLPIo+Aiko 1bv9B/9aAzBx6TyAdD0HiTY84ACPnO30AoIMqz4lY2qeZr1j/AXgrWjWY+hZqDi6N6X6s8F7ArV QOhiCSvJ/wBqX2oIw4oG6kn/StwLHzUzjvdq5q4vVKjwGKIh6cc8LzyoJi5L1/eI7L59vUDpn0U qHPk1TWzpjbuGNKpe/rT/Ds0c7458AmhADW48RgNU0NAjvbZYvcLT1IKTfs0ZTNtJlqnZnGSnA4 KD+5OOhfX5lF5o9KH9K9DnZFeaL7wehWOzHLWlqjaWakWwIgCQzluX4lK5NCstgZnkT9XyOHW0q YWrQ6YVSm+zTkO8F578PtuXJBzB9WY50mHLRzLH1cDQL1qdN 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 | 65 ++++++++++++++++++++--= ---- 1 file changed, 51 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..4069e0f972d5fcabf7e07238583= fc9ea89ab113f 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,53 @@ 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 =3D drm_bridge_connector_read_edid(conn= ector, + status); + int ret; + + ret =3D __drm_atomic_helper_connector_hdmi_update_edid(connector, drm_e= did); + if (ret) + drm_warn(connector->dev, "updating EDID failed with %d\n", ret); + } + drm_bridge_connector_hpd_notify(connector, status); } else { switch (connector->connector_type) { @@ -246,29 +283,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