From nobody Sat Nov 23 22:51:24 2024 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 2A7ED4430 for ; Fri, 22 Nov 2024 00:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236466; cv=none; b=NtUe5WuZq0gFCTPvMwj1/XICvp2DqnurHiwwd3wqogWVAqhoG+mqzMUD+IehWha44tdxxBrdXM8z4L5N3/BZE11yhsUATgb/0cR4m0oLUvE0Rnxuyff55zYsLKjxzRBWK09+PZ4DDQBgUYfgpYaaxKojSp/9Q7OClruk0wDjxmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236466; c=relaxed/simple; bh=eQ8kIXg5Uwc5J/4F/1E4S0ElrF44S0HR7t35Q9p34ko=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tVkRDgu88+DmdcIG36AZPLyODOyN1BXKibscnL415JcHNEolibuBU7Q8qsfodTXoLl399TjDhn0qTYMWkJifYtqng+fVF6R+O0bok1GUHBsCqoFSbmY2cG7rv3KMDmXyHO62C30YNwhuqxow9n8UiZTMsBBz/RPSPYPKBIMIy5Y= 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=WquRQzus; arc=none smtp.client-ip=209.85.167.53 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="WquRQzus" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-539f53973fdso1424175e87.1 for ; Thu, 21 Nov 2024 16:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236462; x=1732841262; darn=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=bJnQ0tRphnuqXv8JlNdv1AMzWLMUZZkvEPXzsxnLu/s=; b=WquRQzusUvOmRBU9uo3YeuuTCx0l8Q6aVMBFct/+OrVHXmeJqNiRwJRXn3iLW0pGZq 9UnUDd1aQatOGfBceOQXWM/L/selGFiLchhj6g+Z4RsVxAjdDs4lwaBbjvMAZwzyF8vI 43KFPl1NJtSqsziFkpZszKCC1Kk890rN3A1Pw0LZdR5UeiiJf+13M10WRjwLZI6tmhV8 dMDJBSS4Vneg0ugrNcLCvGbRp5X7R7E2mOb1V6OdFcxrFjxAHpTLFi/O9yGF99a7KcgM PD+agy+B0H8RSA2TnatTdlDtePnjIFqGjfuZ07e0opKhafKBgSoEfrvqTGK7aPy2CSWS aD4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236462; x=1732841262; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bJnQ0tRphnuqXv8JlNdv1AMzWLMUZZkvEPXzsxnLu/s=; b=wCMEmUNxlvKUgHXQmDy2q6B2/O8hI30EVzTPdKTUAGZpYJOIDvIerr9jZ5Z2/lsFV9 JUGUPUdvgcH0DIVqO9xweN89mXowvQJKhptmwcBy/4wJ0jQ6HHWRDMT9OrTLgW3zcKqz RNszMzs6b3lbBsUeH4UO73Er5ipgb5SXkenDww4o7EZ5v1DLxg6m8uWWFBc591F8R6Qs 8TIVK5gSVAXeMbGmr38n7XtRlqPYmxKERJTEQYSfzI5WSasuKtxmbCuhjJFyj2o3XGSd 0yZajaTgWTvaEr5coCkojRxo/XcgHrYsSuqUHitHVCvGgL0PmxKa62cIYHOgemCSfns/ lRFw== X-Forwarded-Encrypted: i=1; AJvYcCWywafjbf617Mr/FFhVAkHYzM1WT/rpLEzzWpXjxHoAhb4H/zp/QD1unMDL2fGWrkCYVEpf3LvROB/AIuQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwfuD1lynUGs1midsCHMezoZwtuaDMKDZxaImhCp92Iy4qTTg6y jKKuI82UKNEnKX4XYaxpB/y6ZmFm8t4HsBTylzGI9YmewzxV6qeSA3BVrYfWk24= X-Gm-Gg: ASbGncsQyJTgid+vb/daHv/KojtuVEqjVXzpGiU0RAC+vHlpNbaXWQjWipq/IZBVlJX H1bMTuisHdTQH/RDQA6ck/C0AtvSrN4oxRuVYCpvoLXC8PNT831IXS4BKlhuvlGJF8j9NARnqqL WvM46gRUhjDEh+pHGSCUw26KDrgCPF2x75opsYv2BcF9F79LaYMQpDDkaqtAwD9543NPsh62k4a 0wKw9CP6FjOMX+2Gqi1xX+FzoPFAdjTPci5l3ix60SoKPXtBca6oQdAww== X-Google-Smtp-Source: AGHT+IG/8gcw9tO0mI/52yh8VIeaAAyZzDyqsI74Djucy9hy39QFmFazcqdbIrJ2pfZcz+Sl5JhPdQ== X-Received: by 2002:a05:6512:31d1:b0:53d:d0a1:f544 with SMTP id 2adb3069b0e04-53dd0a1f58bmr945032e87.14.1732236462208; Thu, 21 Nov 2024 16:47:42 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:40 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:31 +0200 Subject: [PATCH v4 1/7] ASoC: hdmi-codec: pass data to get_dai_id too 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: <20241122-drm-bridge-hdmi-connector-v4-1-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5692; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=eQ8kIXg5Uwc5J/4F/1E4S0ElrF44S0HR7t35Q9p34ko=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7r9lRWHOeJj0xJXqGlEODEX7BI65easv2vPzJOHn93e0 R+762pTJ6MxCwMjF4OsmCKLT0HL1JhNyWEfdkythxnEygQyhYGLUwAmkrmW/b/Lz59n5s88JK4R XSpdkiO50je7/9HHN3vZGFPuP/n2bv+3qJZFGuqr3y6q3M60Run8/b8vpNhuNYaH5a6/7lAXyD/ b6taTL8VOLLGxm0q/nencxtdp9jDSq+da2zG+wr9aWxW7nCIkoqTann3btIm9eU9DaKTEzq//ej SEPbQynCrl95g8eH43acLd9P9yBrFWSt+93fUsTdpPMdyfyu+952XFHjv19uSi+MU5edc0MtgsY qaev2TE5q5Q9Uz8sYCya6579MK7/fafZtaFPbLw6l2movxpI6vBzPqkWLsoFSmP1/4npmfXbz/3 XFAmNe18maG84EWOzSVa3963MrmnVxRIiJfuWpcqWhkJAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 8f25b338a8d8f95dc0691735ac6343675098f7f7..6bc1b2476847c3bccbbf9874bb3= 84c1f60674da6 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 f89af8203c9d67cb05b629b27f66cf996baedd16..77bc09b875323d88f7346db9d24= ea89a355c99b1 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:51:24 2024 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 C904F18AEA for ; Fri, 22 Nov 2024 00:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236470; cv=none; b=MEoU0nzMJ0LRLUPt006r3MLNEVa9HgGq6DvkhxpQfxpERtg0gI9NQ9wBXISd1x1TLFV3+4mXaFk3kGgMU2UuGuB+jVQDI0kp46gxyD4ttRXi9afNvv/xojnBGMyDzwtHBbOnTRDmghdtkN712icnHDxUqATQRPuepx9jpOSF4M8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236470; c=relaxed/simple; bh=QgvPV95aCKZk0jjfModEdw/2ZuJp4AQ4+MiWPaLAiFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aCVkeCueF2f12Po4VoYpRNuTxHN2eYSexDn3+txVagImSLHOwvE7lQc04OjI/VHXkzivhBjGl0i9y4Im0PvuPy+DBIZ4xcaPbkxDbOCVFYrC02rOPcuKZJeNvuPeDKfOaMe5Apx5xvra5gd0X9EdEv8tdZC2gtCsTbzPGKewbuI= 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=mMCtDb0+; arc=none smtp.client-ip=209.85.208.173 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="mMCtDb0+" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2feeb1e8edfso26893071fa.1 for ; Thu, 21 Nov 2024 16:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236465; x=1732841265; darn=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=Ak8gRHgoBR7wXxN3OTsHJhxEAFWfUvaDSuz/ZDqmUPU=; b=mMCtDb0+41D4T94av+DouhcTVfbLkfcEqPmb8VlGlx3w80d6MURHgN3Rv95Gfrc9ot K1XVOfdl/zO5DWL3Ov9MkaNpc6yd7FfeyAfUnI7lRaxRcY8BU7Z2uM29dZClfQwQaS4E ybZlW/RBUWOnEcqndyNEDpkg95VYfLVxjWyIqLu1CR3nygyOQYw3/KiNuwJvI2LeEb49 mPdqUIihK7xYadJ3CprDnpjoFJJgg8Gi3TcKb1zIyDG1aoR6OptTckRDeUPzakxaHW81 5Pyr24S5s05lid3kxGK2x+8KoOa/1mLxqqn0DiD4uiNW9P6fP0A5+RC3/+7X3JfZwLkI 8JQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236465; x=1732841265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ak8gRHgoBR7wXxN3OTsHJhxEAFWfUvaDSuz/ZDqmUPU=; b=s/dgpDgQnZGTIdB0euCVnHDtHpaZSTk2ffxVcDllmUUwMbqkKskkhG1IYeVlgjPWc0 tmwtPhAxhnAg6hAqXtQ+JlWbxJKU8HZAOcU/ZRscXCYMkTgGUWqosDAoQoWCBGOCGFOE IL5ZtktYm8zXaGhJXNJkVA11pUN8Ibgsa44BeBtF+SpuHkB0gGF+qQ6IDbBXV/UuBYi/ L8RqNtAE5I30ifoYY1Q1/NtP4LH4qSU/oXmRcnnXd7W9RqmClMBJPmWgMlBo00nsDn03 KTsYBQ1g8IQd40+ozD0PAP8h2ezpicD1lOCMYCFMjO+KpIjH5c5rpeBjVSBaOisMNcTK po2Q== X-Forwarded-Encrypted: i=1; AJvYcCX2o+SpxGvJUucV2jyXNLiSDYjwAQmxT0cssHsRJH7cT8edNAALrGS86ugf3pubWfpOan1zqzhOZrz0mns=@vger.kernel.org X-Gm-Message-State: AOJu0Yz12+AS3eTuMINcIbvUKbCkowjJid/6KYtGt47ZIOC0jomeS8Tz Bp5GtjERwDvPaAA/KFrbOkN5bWI1OjDcnwL5WxjjRdTbLJkXkC47GRn+Z+EOEFE= X-Gm-Gg: ASbGncuWG/bQz4WIbaS1alsZolcTq+5uxZdATJhi7xbnL4ITd5c4ugzQHKfOpiZ0RCY LaFrrux6AivxZFQxGl4FTDOIbKHFYXGy/EF92Z6Bv1h6Hc2gJycsE5LLKV7iLdoq/J1rb7kO0LZ VLFoRm0CWPI8qNrSV8A/jLvXXyAga3JggljUjYYn1rvWdOURA+9HP9xtb+ySoNTi4FJ4JFBMkdI hj1UIwsBO9Cy3MwMbIeQc10ak3q483Rni3d+vOye8YROEGW9b3a5CsZ3Q== X-Google-Smtp-Source: AGHT+IGmZbXKNzuaVctS0Pej9crIvWrOV7VdQgJgHI3Iy10PqIaNo/7gHPJCX3fH8j0NUWfmoyf6NA== X-Received: by 2002:a05:651c:985:b0:2ff:95d7:9ed2 with SMTP id 38308e7fff4ca-2ffa716ed4fmr6047761fa.32.1732236464826; Thu, 21 Nov 2024 16:47:44 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:43 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:32 +0200 Subject: [PATCH v4 2/7] ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata 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: <20241122-drm-bridge-hdmi-connector-v4-2-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8709; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=QgvPV95aCKZk0jjfModEdw/2ZuJp4AQ4+MiWPaLAiFs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoX/WmdVL8hw73RcqrNT84gccFs0OOWDEXZ w3h4HUZ23+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1QMmB/0dJ0r46o68jwO2QWL6u3ieZBudls3bPrbQFSj3kdlVf4OzvJiHRbz3uIg+R6fVdURhqax 40uuRhOaV/URnc2TQK1U/JprQosppitU8ihj6YuNOIe2Z9OUE4afZhKnTeWFAROF/nPrWAQuupM Z8ZwVvXukodqTzRDxbLTrGa0bZ5gILu71rza7D4pXqkg/wZErRmQ/ewRVaaXMk+phLcwGB5Q0Wp 9wcLj4k2+2xuYvYFkB4DZstDx0s+cbvFRt3gpodNiEpHRaeY0/oMhKcvgXL/kpOl6P9XX9qGSJV qrX/rlQv98PaJj4uN8xLqNNFKmSTFTNR4RX6rby8CFsrYTpL X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 f576b1aa86d1434d75b3770e08d91537aca4f5c4..5c2c124a7a38fbadaec554f0879= 7020260e29045 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:51:24 2024 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 6DFBB2BAEC for ; Fri, 22 Nov 2024 00:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236471; cv=none; b=MJrsRne5jugbsjJcSUSWTOzQ7NFwmEbgDbKjP1GT6mVp8aA2FF5Cnf2whJFU3lcqPk0u6Cp1jFWRp9c1dURCqW5+mbz7JZ2ZlrB2FcG0VxGLdHBrLI0XVIf2+/xgFmpNJVGbe305HZamaQhPye71fbsU/GMj6OGggryqw20yRR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236471; c=relaxed/simple; bh=m9zfJO4BshYapRasGcJd4L8a7HQu0P+fqRupSDJ+fRk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gz6/u5T4g3QFu/cxdrTxHfNApg+8WZ283Z1BNI41IN8JRJmJ/5Xq/XVEynUmAsPPqJpO76/Z52HieOWbSYNYiLTJLcSadVsGqdxhz2sIjRQyn/AzLEHuT6aAPWEpHSFg4X6u4zvZTwgyHvUBZAljwfYwj3RM5RybtRlz9ih287Y= 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=yULq64Z2; arc=none smtp.client-ip=209.85.208.176 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="yULq64Z2" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2fb49510250so18714931fa.0 for ; Thu, 21 Nov 2024 16:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236468; x=1732841268; darn=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=kUsRn0052tIDeO/cBuLCGWRoGXp1tAzW+Qpn79ZJEc0=; b=yULq64Z2QEkI5HqGt2OyocLKVrzpVY/jDn7V7Y4YWPFj1eNgr+QtBbawiyLcgL/8DU yZozEWPlpvTWcpaVzZ911AgNfzTm2nJ9yQCfFt48m0RbR2EbTgFfPC5vfgk4/qCcfR+F /ZCVL0PdhY02HHPRw4IpB11AciZZq1+WDI/RrYGmC4lqQgaLwALDX+2stMw0LMqVFax/ Z7U47vKajlFXRfnuXlUwWRvwO0ZkYJcGRXiZWtPNRgd1CPH6qrHuUL2JH7PzcGPc/RBk rBAaGklO8ARhp3F+6O194mWxdk+EbqeGcRBZ3KX6st7k0HP2fXM7qzly8CoMOpiMrAqR u2rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236468; x=1732841268; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kUsRn0052tIDeO/cBuLCGWRoGXp1tAzW+Qpn79ZJEc0=; b=KpPYIHqzouWCKtpuNdN/JqnMqHmHjUI6nE9goNV/vMS7i4N32ODGkKQmsuLQeWDOcM fsTK7cHEpaQjd9gSL+IrIAhwI+wI08EZ9cDviBk3F4/HHtb7cRg/JyxRtPimwrsyGuX2 REaG1RwwZ3lOt9gvBuUPNaafiqqWUkComJZrOOVeyNxv0s963HVxhQRHZBy+UZkXOH5F TAMLeYrtfTCDCmpoJ/dMlux1B7Nigos5AsBEHTTUxjpLjuZuLNbMsfjQAwSksPY4h5sS htAe4Q9vYmXpFumphRiyDc/4RqvbKeafv1u430iE3vh5EB7qCqZVydknsXidTA3uzyUp EdGQ== X-Forwarded-Encrypted: i=1; AJvYcCU2oa2XQZCL/CdnKkjfODlQSjF5e+/CT7wtRd2YQjy8Q9kxCuSPCgXutxf0M+sNdZ3IiEtGWdePlJINxxQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyfkwV9rBxQiUvSMKDnql+Kkms3f9Jpw7jP9VjjvhFhN/xWPoND 80/GUX4Cbfr/31/GwQOE4roUdzoQM4E1+t57RWQqe/CGdT4Ysrf/OUGy8mojREY= X-Gm-Gg: ASbGncvRHwDdLAmP1+w8ALELd/vD9WBI/i+HLqgOiGtif4EV5J5p+B+vokBwLI4d6MD 13PHDT+MD3TkEFHVv5JfG/4NdAkis53ONMUPKqrG5OYFb7YfMuS2joE77GT1SVIH5ePX+nloAam qCHxt598EgWa940/PvdndfrS/0wYVHUftIHBCRL/0dcjoHrj5Kz17NFru/188ANwps/XpJPO/gP loLMQ+W9O4ZUoeOeh53myaBF1sosorkb+i08GCNH8TiRHuHduOYSAhCqw== X-Google-Smtp-Source: AGHT+IH0ngFsUmrHxVFXRYZ8IQTN2xYiOvGwCUNgKSsisACK/yWk3bJkWF/S2L9Vmlglv32JfDmhqg== X-Received: by 2002:a2e:8809:0:b0:2ff:a7cd:ef7c with SMTP id 38308e7fff4ca-2ffa7cdf066mr1168911fa.17.1732236467533; Thu, 21 Nov 2024 16:47:47 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:46 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:33 +0200 Subject: [PATCH v4 3/7] drm/connector: implement generic HDMI codec helpers 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: <20241122-drm-bridge-hdmi-connector-v4-3-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=12999; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=m9zfJO4BshYapRasGcJd4L8a7HQu0P+fqRupSDJ+fRk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoviORIVo7TBWsSstKi+38c7+SpUj8oiIQE 9oEECNhQViJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1XTwCACp0JnCB0kVzW01osJCn4CmwoLmqtPHBi6DbWqXGiRIsVW6mxsF3UGofNWR+ZG+U8ye+u+ TxyANB46vZR8DSG9DngHzY78xPC+zvLnnbkI78iRHQzKVdeA4jyVo4pZTO2QMO1m4JrVKHGq+5o OznpDfQTusMKV37P9UkX2sAa9vHDEFSnoSRzeLzd3pGc+DSO2MGDBlcPKf2ZCoQKTiXeTDa4yhz G1TnDvVp1dkUj7MrxxiLigrsmIQl18wfc5kcfJk/txmi9EAtU11aTrMg95Esi3Pt3TGP9dR1u4q AF+igFZD712+/RnQ/xsTAIo4kCRcDBnpztxJm2ZkyOPP4lXt X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Several DRM drivers implement HDMI codec support (despite its name it applies to both HDMI and DisplayPort drivers). Implement generic framework to be used by these drivers. This removes a requirement to implement get_eld() callback and provides default implementation for codec's plug handling. The framework is integrated with the DRM HDMI Connector framework, but can be used by DisplayPort drivers. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_connector.c | 10 ++ drivers/gpu/drm/drm_connector_hdmi_codec.c | 186 +++++++++++++++++++++++++= ++++ drivers/gpu/drm/drm_internal.h | 5 + include/drm/drm_connector.h | 80 +++++++++++++ 5 files changed, 282 insertions(+) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1677c1f335fbb0c6114bdb4cc0b12eb407d84564..afdd9268ca23ac7602e73bbe45f= 3f9cd090a3afd 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:51:24 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 0EF8B2D057 for ; Fri, 22 Nov 2024 00:47:51 +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=1732236474; cv=none; b=Y0DL8ek6Tjn467IglitdZPkm7QDBIh2R10rIH+Dn83+kz2+n2NyXBnJv6O4NDnMvPHo3DLOsXZHUYymktgQ4qej/L+uv0i3kg6IgpwMP/jIvMF1hSTF+k5a9OhPsJe1QdOq5NrRwRXitKy605qy8hRLRnKbLyT8GmskwowNs77c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236474; c=relaxed/simple; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rMrnkIPBDQ0evmeCSSIxb/HFLtn1e2lkh70pNYdIJBQOkhXBAO398BHzoXboTfGcxz/nMjIobX2+wywE379cGB9qyz9KFA0hku3viJdU01re3t7FA5aG6aVm8r16j1nMs1jLGOzFIgfBaBYZ7jvGWHc1D8cYJoeO/B6HCMxdUXc= 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=Xlxe3qWq; 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="Xlxe3qWq" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2fb5743074bso13559811fa.1 for ; Thu, 21 Nov 2024 16:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236470; x=1732841270; darn=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=Xlxe3qWqjZOWlyXKbA97ZhlDhPK4dIutvAZfhCwjBoK/mLuDDv9HNVoEeutS4aFtmk gBXJYM8Mc+U0bSBTr429vgP8ZD6m9B8psqLkGtxqnQueSb7umRMg+RTeDGXgKZfUrth3 PEGiNcHr7XuYNMtOOFNaau3d9kg/nfFITd3fPk1diLZqrgGfNyREsQIhtmOgxBakYOgc DcJE9VmhcgKuJ0drlRuJEYueymO/tc8qnIYOe5rX4vwFW7FL9H6OQfy2g501lpqnJT3N UNJ3zXgnaOiL+mRQiRqz6Zhv6cbzWWRTk2saHI2o/Wp5AmIBUrjx3uWa3TFlx5+mEQN7 FHuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236470; x=1732841270; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UmsNhbcOu0CL1PS3KGzwEdaRMJlXKDzwHWxwdzXZd0g=; b=AnMOo4BI6E82CJHEbKyR3hKvBkfYwlMMm9mshEwLCvBN80HvNpuWEDx3jmn97SKYjM lQL1Kgw8iDO/1tUzHHT0CP8cGR+sMPsSek+WY5fqGxdW+gsx/CARXLjZzHoqXeZ4TBPZ VgAQGQwZjf1JJKOj/dTWFxwSHFA92o0FZ00k9nDRlcqcW1QpJ+4Ii2K5y9s2f/wU/aKr zGxOchSbWFppGn611eGWxX0RMEvgqKXjG/oaRTD0IIfVgHKvX91Xxui4SLHuEeCznh3D 3+XJ+/EOwhwu3IIZhwXUhXadOIKk6/muuSHxdr/LYq4u12qq3w8oRH1mqc8fQ7bvz0Bs z2Zg== X-Forwarded-Encrypted: i=1; AJvYcCVPyyoNxxEN+V8Dlf/GkyHC+6yl/jzw+sGV2KO5gKy74qoTNTi7+ui3l9MUyA8Jr2EZwUGbxkmywNYZwBs=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg2xHLghQLK0myr5mAsQNKmD2l+z0L2vtwT7oCYWyXFqDMtsJ3 maruBqR2w7jengr6WUKNtSGlOp0Zv/Z9Y3i95VfFUEBxZgUElM5KubtJwiXJo5U= X-Gm-Gg: ASbGncsvDQ+RPqvS6iVWqqS8woy/PC2NfywYLXiRg8wH6jB5OOF2ZbAA0GO/+JTiUDb 91nY1od905emdMAQesVrxtfra+xLDYeJep55nQgOo86ha0MRqFGdQU8l7SnfZbPqIWh77g5JxGq dQRKZeTeIs5j++MC6BpnboifwVsnF+t54gmrQnwXBYvsJ8emWfWNINeujELORmgjOMWke8M5I7z zLq5J/FHFI5jjIkpHDaOSy4ltMxu9nBv4ik2vC70HRiXUmVTz2o8dT3pw== X-Google-Smtp-Source: AGHT+IHMUBebaip5YS2333T99HLNYNQnqajAn6gIrSEoon9GZQlCjBJW4sy6ZaybDfZqPdwcSk1J5Q== X-Received: by 2002:a05:651c:2122:b0:2fb:510c:7203 with SMTP id 38308e7fff4ca-2ffa4d810ffmr3580851fa.3.1732236470136; Thu, 21 Nov 2024 16:47:50 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:48 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:34 +0200 Subject: [PATCH v4 4/7] drm/bridge: connector: add support for HDMI codec framework 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: <20241122-drm-bridge-hdmi-connector-v4-4-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6723; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VCAvQVMxBhx8BnYWztLsVnSCZi3RzfwM/RTfomnZ9hc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9So9qMT3ZtFSACzG1F69b6sWsU/NKcanhYPD U7fAUazNZuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1aswB/4o4XWFPj5i22aq4AhbTDk7K898EseN5rIUmg+inr5nuvgvyBw6gxjBEBD+i3qMV6QRQdN NXPyJA55z/eEGXBv018b2hA6dwtlEtYfUDyA8DQDSxffIrlNJRhADyNex8/J3VIJ+rL1MWRk2bs 6Gy8KMfrHyoUepjN5cD2Qq7NbNJWKL9hOXZS28PsQ9qleYId6mE9a7aGMEYAAEMnD31lazAJdcq Cd+2IzTdQoEdzzwFQ74JZgBeVPH8Ku4eT/unWo6xRSeE38v5B2+kF1/x4QK1ZrQf/KRQPvPgNkf XYdVNJCDdKAYFPPPUZL13q8AYThzeeiLsgJULnY3xFaQgLgw X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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:51:24 2024 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 0DE654C62E for ; Fri, 22 Nov 2024 00:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236476; cv=none; b=goobSNsrXOeaTp4Q8uq++9KB95kPA5FODLyp/7R1LrHYnOv4DDctrMYyI3D9f8arWszMNO4YaGoOvwSyTH8Otc8Ob2vMXv5g9ZNQSHGd6is2B6DoWpsf1+Nm30d2NOTiHGkues5OE03Edg/qF7aVK33YEtdF6s97kqfwMofzH+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236476; c=relaxed/simple; bh=bt7FTSnaJ4ZdPpnvHjWH+URnk6jSCm36E7PfRw7YH9s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZHh6ODK+nMaR8Vl/YydTsBKo2Lw024v086WsXlK34/nCgkbvh84fQwQwkIusyqwX2IxmvnN68B0Kqx1APSUQdmYnedBE+6YJVvBgWsf7gy+oAkyPyCIp2fkVW4SXhXudAIUcc0paLNoQJHV3e6kPixwvsrfl3L5XR41kG18NfHY= 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=xk42xgtH; arc=none smtp.client-ip=209.85.208.181 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="xk42xgtH" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2fb5be4381dso19298221fa.2 for ; Thu, 21 Nov 2024 16:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236473; x=1732841273; darn=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=O72gbUDbM7kl3JMP7ZBWI3LnDF87C5Sg9KKzLKy42H4=; b=xk42xgtHa6Mkl5qDUu1OcMRc0Rkx3H7/eehc1UnjxyVjn9QClmn5WQxdkNwVdkc5gR lvRCIBSV1CV5mB0p3RGPDJfPXayf9MbgiLQmrRdS/BNe8nwo20dNGj//OmdA6Vc3p1UI Q5+d/hTaX6Pa1ssy258dUombAivctU+W403kOPl3tZkZE2pxi4sgt++7qcHn+oXXeOWb 432e1P9wI5sWgZPpUW5ALa93tpbs9sJxnW/ZgH6ggs9oFwkqH1wZLykriUf3st1yQFyB 2a65TJPxe0uAub+UB0kAZCr18xJx+HjBk/TdDzNEvlrsSIwAwKpGoCrnBSeaw6sQYSMf 7qag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236473; x=1732841273; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O72gbUDbM7kl3JMP7ZBWI3LnDF87C5Sg9KKzLKy42H4=; b=r54JlLMClnY+07sQgBmA6nlH+8gfeHDA4rI/Ji8to5WSSh3Ub3Miq99C0yxOA4gNg7 6IRKocW3JWX6K7Vzk2AhYHNZ+prSuxgkID2OkZPGd+7IKf1Ywwhr8OH6iTthMzBp+rpS kqCr2lV0zAEkMpqRhQXq5SOTswuTkjaqGXAjO1LYoj8OJZgwqiz0gDvShLRXhHV23Jee TIREgcMhiGJAZ79FssRG3WqPn16SAHTDKnameIpmgLDFaVPpkb4wZNjol7dCY+lfiQJo YUv4oW64skZPIDdZbnnnPBaN1zA3FrTf8+XvW1mL8xr/o+ciUP5ApK4bXtrToAVNAEiU fUIg== X-Forwarded-Encrypted: i=1; AJvYcCVolZ09GkmB+ZHKtbI9RTIm4wvet8AG2zZUgm5I/l1pbZjj785pFLbanyAarcGK7BUwxEPDlyG5jynsBkI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyv8019jMzztLRPmm8zJ8DQciHfLioJPzgXLGq0tgMdcUJKMa7i hnbz9vP7aodyTCl3w7qQCjOltwjccTSuFJvA4dEkrDsITcZYnfWRJ+HiQvnBa7Y= X-Gm-Gg: ASbGnctkCWCsBGdlw9Or1r0uDEYTzAUm8aIkBTB7ULnVBEvEYJ48a/278wh4d7pvbLv +3ZH/1b1VolY3V6T6wgrx7ljfA9mCT57aaeC9wGDhlU6Qa2SZpKjw+PWT5AhOG6pcST1qjkY+dZ ApLkVrg1iaW9kuBtDEO6Vsvmozj3VfMv9+gjpp1PmLphSfSwMBBqyORYGtViOmejjM4IINVndVc JTR4J4tym4NjMRRHpSyGM25HoBHYnYjDFvfzWqHQe8lsJ9lxOb48G8H0A== X-Google-Smtp-Source: AGHT+IEw/tBhKCFnrD14V+38zGlfbN8e7LPKpMB+4Z8aXDW1EfcDZZTa3uwrT+gXFjqv/lAO6wbLqw== X-Received: by 2002:a2e:bea5:0:b0:2fb:2b5d:215d with SMTP id 38308e7fff4ca-2ffa70f6bf8mr2984791fa.7.1732236472809; Thu, 21 Nov 2024 16:47:52 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:51 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:35 +0200 Subject: [PATCH v4 5/7] drm/bridge: lt9611: switch to using the DRM HDMI codec framework 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: <20241122-drm-bridge-hdmi-connector-v4-5-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7869; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=bt7FTSnaJ4ZdPpnvHjWH+URnk6jSCm36E7PfRw7YH9s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9So7yNOTs3PU0tlh/78i+WzL4AXI6hFFscud eqjnzdTataJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1a+2CACDNgeJkOfQ15ZRYAG61L1nsbntHptkDVFNvgxnghsubCnD8Fjge8LoUNrhPQ7yzQPyDv6 hjAmdsvJtiRQeB42d6eGoAdtM1XrN5e91ZQwywq8qIv4bLly0EBycEehUneCuL4BPUMeF/GDHjw mcGVknPaIjdxXCcw4F2EmPaEdQHL55vOZDQZU/AoRDWRTaoYz+1VwNDlMIQr3nl5m1JIVRkCRZv KJlqXu7leU+ii/TlmrZn6njMhVV73rSKLZ0wTXspe39rtzxcUoewdI2kPb0Z3JryhM1uZR5SJsr 5diZwzxk14+/B4gDnhm7IPXRWwP+z9IkbC+6pJnwbR3hyAH8 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 6bc1b2476847c3bccbbf9874bb384c1f60674da6..f3ac67440a941327308ddf1fbb7= 7744c6a8fe42e 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:51:24 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 83FED7083C for ; Fri, 22 Nov 2024 00:47:57 +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=1732236479; cv=none; b=VjBIp6T7+R8JVgNv8MiQRshK73/MsGricIBj/EdfXimxWMsrbTGtBVH4NTy7lO2vRj52/6Y0iRYgadYUpHBN0dfBamtkmVjLKVm/4yC6uoA348ZxrusUts/pZRYpuzw3ikreMLbEtIFp6SJyEb3wB79hQsDqhgsw7eBqKXhMFIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236479; c=relaxed/simple; bh=h4SDlLdLeTf2M3phGYhMa3icgLWVQxFU2Yi+KA0yVFA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jEuexoxFPAXbIoAa0iH6r6zexLJ9e17qnHNBepKVe0B9QcnyHePA4u7sZY7/PPTB5Yd4j+AFsNBTgNwiBafoHiKwQBO/xqN2bHO6Ar+aeK7Kf97usX07yHUI9lxEWOB8ceL/XpqUiY9W6+OkkNJd2kJtLze84Ivpb5IfBdmhNGI= 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=llRlhV5D; 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="llRlhV5D" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2ff589728e4so29518151fa.1 for ; Thu, 21 Nov 2024 16:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236476; x=1732841276; darn=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=AekznUw/DJYmSVBNFKXzyv34fWwrWZN8k5LwtkQDlbE=; b=llRlhV5Dk8RL+hoB142rd4CtFbuC9i7PPsIDnHVJQn91+hFMDQ1C5vZPjLuWiFP9Da hiCoB2Iu9sykeLvDGZkdaK/K2T3FMX+rlc8SkxTivl1QtD8qDWeIZTeTf8p8wOQKeO6e A4GPFG7FJElu2utiuPDceIaDF1PvVpaTtRLNnxduyiTtiOj+0Ogtj+3Y28f1SCCTxCKx X1BkVXTKebmhSZIbtbPKg0OvnmT246NXv+spi7CeXf5qX0W2oJmoyMS496w8TSz8bdy1 57twFORKBNMAn/fbQFs0o9lYq+yf3ISUq6Dv50VA4Uqlhcs61K2ZW9EbKIX/fxOyFXba 7IIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236476; x=1732841276; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AekznUw/DJYmSVBNFKXzyv34fWwrWZN8k5LwtkQDlbE=; b=eKY38GrIjhi06CbyYkyaDGes/JO0d/d2uWlz493chkPSO0EdrciPNJDpd5hvFN4DHe lTQZs/iljw+GfuNuKAk6P1jAu6/LIZPAUCfGfX2pdY2e2ijGlSwQPtCk4yadTBgbe3LB fTmgdrUtzrGMSwsaa8lVqPpJGcBomRAH0nMMKfKWnz31DBbcoOqKiwEoJw1rSJgwI4bN w6Ee0whZRNWrJ0FaV+J2NYNtcaew7S7sBoDP2HDEGwCWPx7ILXdmKLwvG16dtvlmT2bU I8lwOZjw5CL95QfTZFvsQZnyVqNwMkHGE/S2ByDLYmk9R9/oqrUz/xdoffKZ9tOs5nxF Cfig== X-Forwarded-Encrypted: i=1; AJvYcCX+1VK4G4oyM9OaC1FjRBv7wfM3P2NcMKC/jT4+CiUB7R8foYCMzTmrQzTR/1rlPhHXassMSwnIUnRaYTc=@vger.kernel.org X-Gm-Message-State: AOJu0YyxXf3icnvIBL2NO5Rten5uidbUM+eDG5XYZItXQzLEQCu/3Yi8 KFGNauFw34tG9mj/uSc3kGofPWreEMP0ccQ1MmzznUdH01w1lpuvskZ7VKvU2Do= X-Gm-Gg: ASbGncv5/9vqc9dN61SThzoDwEgO+kU0al5aoqba87lZG7OD8Tr8hcewdW+hiG4g3oq yKAWAw4OdzB/8rPaclwQvvLITLJDJZgkSikgrR6AD7IMZn05gOuQ8dGLoF7obNpjUy7t4ChDgAC 4LEJOHx7GNp1lDBBscsD05F4FoubKl8ZVMSQ1TJERbiJaEkWPHC5BHN1vEZpgFiGJdzqoOTfYPD FgCWUHqi06LUDTSuzC93lCJsbJKStL636YynoG/NqDxOuBw1v9/c4TCuw== X-Google-Smtp-Source: AGHT+IHkN4nXkCVt6nZPpHcWzC2bWbGpwg4sMZCFQ0fvcq24XIw4gri2A5l4rqWLYlEyB/ESg+byOw== X-Received: by 2002:a2e:a593:0:b0:2fa:d086:bca0 with SMTP id 38308e7fff4ca-2ff969a16ddmr15367841fa.10.1732236475685; Thu, 21 Nov 2024 16:47:55 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:54 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:36 +0200 Subject: [PATCH v4 6/7] drm/display/hdmi: implement connector update functions 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: <20241122-drm-bridge-hdmi-connector-v4-6-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4091; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=h4SDlLdLeTf2M3phGYhMa3icgLWVQxFU2Yi+KA0yVFA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SoeZGpNl267MxKzahXC2JqO9fXLs+4r7B2b jseNQkh83WJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqAAKCRCLPIo+Aiko 1RYrCACo07vR5CSktkmxVEZbETbBqQjxDEeirXgkPjqknr/6Ldh0teXQADgZkx9HHdy58CDSdc+ ga4kgK0+ZJXjgpg7TnqA4pPgCDv7PJoOvu6y0R7OjtUAaSt01YNT2WdetJ/IKZIgYMz5us0+iaQ k0/tU7kVnXK5+fblJV+pE18lR12Yt+SV+MVUlmv/ftN7GvhZJEJ6Df6cHgmGNg/Sdy8rSrFHBFR w3uWFPjcHPScLXfZLrdBHstD1OaRB/6FKaVApC2rme2tOi4WXrmB2Itk78OwNOC/b64r9oLTmhO inwbgxXewxRuJicQQlp2xm2P+7/BdBVJMjpy58NyXHJAQ+3f X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The HDMI Connectors need to perform a variety of tasks when the HDMI connector state changes. Such tasks include setting or invalidating CEC address, notifying HDMI codec driver, updating scrambler data, etc. Implementing such tasks in a driver-specific callbacks is error prone. Start implementing the generic helper function (currently handling only the HDMI Codec framework) to be used by driver utilizing HDMI Connector framework. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 59 +++++++++++++++++++++= ++++ include/drm/display/drm_hdmi_state_helper.h | 5 +++ 2 files changed, 64 insertions(+) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..2230b7fc92cfee46a9cad2479ed= ce71822d30934 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 Connecto= r 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..61c43e744051886ba5f2024197f= cc90688670ebe 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -6,6 +6,7 @@ struct drm_atomic_state; struct drm_connector; struct drm_connector_state; +struct drm_edid; struct hdmi_audio_infoframe; =20 void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connec= tor, @@ -20,4 +21,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:51:24 2024 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 31E9281727 for ; Fri, 22 Nov 2024 00:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236482; cv=none; b=NRep39XlTJjY3YJQFnlfzLqc3ifSw8fk379eGm+TRwMvUrDbip035h9PTHJJiqhw0OoQRyVfwqx+pE+WMIeWA+lS+kdTUSpqdzbCK++Xb9BCpp0xXvR89TkTJZpVeCVJImppy2sdJREw3btSzaL5iKeTROuNlvq5wBfkEztQwAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732236482; c=relaxed/simple; bh=yRmYAaGG5FuJnzbiAwK+r8Wa4ofx1aRyHEGe3Ks/gxw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fMOS28nHk2wi4KfPLK7j9FRQGu9B2LIXGm2AEfV4TTK4BMI37HHexxXinV7OvuflyJyalC0L5JxGdYxQHFNYdTU6ujfmXeQtYR0yH1wvSBhxgmf0SQj6Y/Zx7lq/wsacfD4CyU543Iu8PcIOBtrTytEBejUGrHcSozrKXDw7sc0= 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=Z3lBJG1Q; arc=none smtp.client-ip=209.85.208.176 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="Z3lBJG1Q" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2fb388e64b0so18757721fa.0 for ; Thu, 21 Nov 2024 16:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732236478; x=1732841278; darn=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=Z3lBJG1QOo4IBc92lTxc12r3HuzHUURWXBSIWhVyCS2T4zeAJPSpGfPRIDWXx4+7yW DlhNyL1Um2r/qA8ROjcE98/YTlCCeKw/ik1MRlBSOfPJiQHjtTvIvYUHDbCGAKarVP6z WKIObBradW5dP+mb3AIT4dxjD9EElkXj5Jf4u2/7amz2Z7ESAHWaSYHiyMuHnEFd0HOo xkYZEgmXAB92NtgbfJB+Eadz7q4rKcuQcHQlotpBXI0jVigwSSDMwLRuonObtQIKbjn1 MDdTQhO3zExHYLgzfoF+/blMvY+tNRGG+OQCfMb/KjNbMEUidvQhC40QxkmB2KMARjOb ZW0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732236478; x=1732841278; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0+2GniAkdmp4BwJcsCVeiFyEwNMIk2x1tb1O8W07KrE=; b=QdL34FRMAK4+NUnYjYYYqgaapGNW5cYMJZ0YaDD8JpnGWGiLijUMM9R10uCI//FlCI bPPderqs4Kn9e6DFxOE7yqdcKYRd7TTELahHaL6AOd8LNstAF9+lPpjswb1tM+3f97mm zaAYhX3kMwSeUWiX0ehad6HvYi7n6/YuU0qgdbwG/tLHg2o6GLZsNqq/ydIQpc0jKyLC y/Dw3dN0QA2Tr38qCZnCDsnxPPJCO/TCvvm4wWFGyjUA9YAooz+4azePAIOQtIPdK+lU h22EeCOZEgTkfYSFlQTllcFsGsbBPhEHRmiGCMpos+ORrpAB1T93nSmlvEut/mUCQ2MO jz+g== X-Forwarded-Encrypted: i=1; AJvYcCW+qEADj6raImpPOPeUdQXJfcl8LmpXid6POA881SOg/S0UOYTVrIooEl6zaH588yehZon1k6mMhTkV/7c=@vger.kernel.org X-Gm-Message-State: AOJu0YwWhyZEPEhBLA/itMy4+tPbFS+MimaYJtoRUOsBBvxZP1kWmbKM AVpdUgZdpDnM8syOzShDWI0Z5VOYrgLcLX1r8IfE+Io/Bgi43QF9Xl1FXdMkAX8= X-Gm-Gg: ASbGncu2VraSQeg9+7gMkFR0K1SJsE/Zo8Mgt4QJfpLCXZIAcxDSUvZOKqPWFzSvCSI zSEAdzF9yFGayfM23hM+VUYhL1apDDGs/17EcsIc0GH4cTSzM0ddu5cgaQ4aNgm6cN8eIP1P6m2 0pfz2Rt5pk3g5GiCghR8iRQgSrwtCrYr3yUOyueE5w6HEnjxwF5OKf6rqg1tFOgeyZvRy9r1WF3 MC/XWxIyg7jGoj3Ee9yHxLk6oxu0ILI3P59afF5MNW/8zVWH94unjsLWQ== X-Google-Smtp-Source: AGHT+IHaHNlUP8086xz3tRzLnaul8Avo5PbX/8+kDiLnQ5OGtpX084LsUh/kakZmuNiZbNZCIacxWw== X-Received: by 2002:a2e:a58d:0:b0:2fa:d978:a6a2 with SMTP id 38308e7fff4ca-2ffa716cecamr3853321fa.27.1732236478310; Thu, 21 Nov 2024 16:47:58 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffa5375caesm1083071fa.85.2024.11.21.16.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 16:47:56 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 02:47:37 +0200 Subject: [PATCH v4 7/7] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_update_edid() 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: <20241122-drm-bridge-hdmi-connector-v4-7-b4d69d6e3bd9@linaro.org> References: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> In-Reply-To: <20241122-drm-bridge-hdmi-connector-v4-0-b4d69d6e3bd9@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4107; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yRmYAaGG5FuJnzbiAwK+r8Wa4ofx1aRyHEGe3Ks/gxw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnP9SpVDpn/N8z6K6hlLcRgonLl5v1k8kXcTVuO Og+AMEkfmSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZz/UqQAKCRCLPIo+Aiko 1dLPB/wLm/x1f8KlUeomrCfmp3UZ6g0DI5BUacJw80/8n2QLtYdBuGeBGuVq2z7lkL3AHGUhaHY gZn/7tubJGIZ3vjMeKLSgs49f7JxTUS6dJBGNbBYpupT5L25MoRX3pe9lCr+eDE/wpGoALXBcmE PYfPqUfPhHmNEOGYcD1oL742/t4WqmXtKa1ni1Hv+otodOq367Sfr44Xyqic+u1VV5eN4WWqpoU LtUDOu58YxNAOkrtyEGmrV/bbh6D4P9e6DioI4eij6CMhhiLhAp29UjK/+78DvZ3TgpR5uqrrOb ERZMg7fJCawdHkXiMo8nIfO8uK5pR0cgN6c6V904Ac5pSqFu X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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