From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0A6A22FDE6 for ; Sat, 18 Jul 2026 17:03:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784394184; cv=none; b=adganeXxRgdgAsHwgOKIINECGkyrM38gXBHhEl7er+l3cFNn+9bYNWXTD8TQyL1M5nwAqoqO5+6GnT11Sgb3WhQUasKgiDMndKU9tBV+b/wDz6R7bny3bdj/6xS6yEnIREeq3nJA5NJi1wARms/0suFCYjKbmCVY3JleUTMoPgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784394184; c=relaxed/simple; bh=AKZA2aNdCJcOxIY9zqqEaxzPDF0FuCV3Qcgv1co0AVc=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hZVgGI8U+UzglQo7CqI0/0hApijsEnOiGGyTbEyB3JjCor7dOttF7odMRH+M56CKceSpAUoz6Ojfl2YVZIX4bJa0ckWjxSUXD1vlhxfKsoUnRfGX3LnbNVDFhspYiEo1sTGURbkBA8HQV2UpjkeCFQ93MBB4sUaMkXl68p5fuAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wl8R9-000000007rd-27xI; Sat, 18 Jul 2026 17:02:51 +0000 Date: Sat, 18 Jul 2026 18:02:48 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Hermes Wu , Allen Chen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/2] drm/bridge: it6505: Add audio support Message-ID: <2cc7d3922a66de483200d75c9f98badb5391c85a.1784393979.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jiaxin Yu Add audio support for it6505 by bridging to the hdmi-codec, registering an "hdmi-audio-codec" platform device from probe. The it6505's audio setup/shutdown helpers were merged earlier as unused code; wire them up via hdmi_codec_ops so the DAI actually appears, which unblocks the mt8186-mt6366 sound card that references it6505 as the I2S3 codec. Some DP-to-HDMI dongles get into a bad state if InfoFrame is sent without audio data, so it6505's audio is only enabled once the stream is unmuted. [djg: respin of Jiaxin Yu's v3; rebased onto current tree; the driver gained it6505->dev so drop the &client->dev usages; hdmi_codec_ops no longer has .trigger, so enable/disable via .mute_stream instead; drop now-redundant __maybe_unused on the wired-up helpers] Signed-off-by: Jiaxin Yu Link: https://lore.kernel.org/all/20230730180803.22570-4-jiaxin.yu@mediatek= .com/ Signed-off-by: Daniel Golle --- drivers/gpu/drm/bridge/ite-it6505.c | 92 ++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 8ecb43611dba..698ae01b3a47 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2320,19 +2320,12 @@ static void it6505_stop_link_train(struct it6505 *i= t6505) =20 static void it6505_link_train_ok(struct it6505 *it6505) { - struct device *dev =3D it6505->dev; - it6505->link_state =3D LINK_OK; /* disalbe mute enable avi info frame */ it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_VID_MUTE, 0x00); it6505_set_bits(it6505, REG_INFOFRAME_CTRL, EN_VID_CTRL_PKT, EN_VID_CTRL_PKT); =20 - if (it6505_audio_input(it6505)) { - DRM_DEV_DEBUG_DRIVER(dev, "Enable audio!"); - it6505_enable_audio(it6505); - } - if (it6505->hdcp_desired) it6505_start_hdcp(it6505); } @@ -2960,7 +2953,7 @@ static void it6505_remove_notifier_module(struct it65= 05 *it6505) } } =20 -static void __maybe_unused it6505_delayed_audio(struct work_struct *work) +static void it6505_delayed_audio(struct work_struct *work) { struct it6505 *it6505 =3D container_of(work, struct it6505, delayed_audio.work); @@ -2974,9 +2967,9 @@ static void __maybe_unused it6505_delayed_audio(struc= t work_struct *work) it6505_enable_audio(it6505); } =20 -static int __maybe_unused it6505_audio_setup_hw_params(struct it6505 *it65= 05, - struct hdmi_codec_params - *params) +static int it6505_audio_setup_hw_params(struct it6505 *it6505, + struct hdmi_codec_params + *params) { struct device *dev =3D it6505->dev; int i =3D 0; @@ -3031,7 +3024,7 @@ static int __maybe_unused it6505_audio_setup_hw_param= s(struct it6505 *it6505, return 0; } =20 -static void __maybe_unused it6505_audio_shutdown(struct device *dev, void = *data) +static void it6505_audio_shutdown(struct device *dev, void *data) { struct it6505 *it6505 =3D dev_get_drvdata(dev); =20 @@ -3039,10 +3032,40 @@ static void __maybe_unused it6505_audio_shutdown(st= ruct device *dev, void *data) it6505_disable_audio(it6505); } =20 -static int __maybe_unused it6505_audio_hook_plugged_cb(struct device *dev, - void *data, - hdmi_codec_plugged_cb fn, - struct device *codec_dev) +static int it6505_audio_hw_params(struct device *dev, void *data, + struct hdmi_codec_daifmt *daifmt, + struct hdmi_codec_params *params) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + + return it6505_audio_setup_hw_params(it6505, params); +} + +static int it6505_audio_mute(struct device *dev, void *data, + bool enable, int direction) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + + DRM_DEV_DEBUG_DRIVER(dev, "mute: %d", enable); + + /* + * Some DP-to-HDMI dongles get into a bad state if the InfoFrame is + * sent without audio data, so only enable it6505's audio once the + * stream is unmuted (i.e. actually playing). + */ + if (enable) + cancel_delayed_work(&it6505->delayed_audio); + else + queue_delayed_work(system_wq, &it6505->delayed_audio, + msecs_to_jiffies(180)); + + return 0; +} + +static int it6505_audio_hook_plugged_cb(struct device *dev, + void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) { struct it6505 *it6505 =3D data; =20 @@ -3053,6 +3076,37 @@ static int __maybe_unused it6505_audio_hook_plugged_= cb(struct device *dev, return 0; } =20 +static const struct hdmi_codec_ops it6505_audio_codec_ops =3D { + .hw_params =3D it6505_audio_hw_params, + .mute_stream =3D it6505_audio_mute, + .audio_shutdown =3D it6505_audio_shutdown, + .hook_plugged_cb =3D it6505_audio_hook_plugged_cb, +}; + +static int it6505_register_audio_driver(struct device *dev) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + struct hdmi_codec_pdata codec_data =3D { + .ops =3D &it6505_audio_codec_ops, + .max_i2s_channels =3D 8, + .i2s =3D 1, + .no_capture_mute =3D 1, + .data =3D it6505, + }; + struct platform_device *pdev; + + pdev =3D platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_AUTO, &codec_data, + sizeof(codec_data)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio); + DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME); + + return 0; +} + static inline struct it6505 *bridge_to_it6505(struct drm_bridge *bridge) { return container_of(bridge, struct it6505, bridge); @@ -3612,6 +3666,12 @@ static int it6505_i2c_probe(struct i2c_client *clien= t) return err; } =20 + err =3D it6505_register_audio_driver(dev); + if (err < 0) { + dev_err(dev, "Failed to register audio driver: %d", err); + return err; + } + INIT_WORK(&it6505->link_works, it6505_link_training_work); INIT_WORK(&it6505->hdcp_wait_ksv_list, it6505_hdcp_wait_ksv_list); INIT_DELAYED_WORK(&it6505->hdcp_work, it6505_hdcp_work); --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D320928DB46 for ; Sat, 18 Jul 2026 17:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784394186; cv=none; b=qbSO37bF9YpoFI5XEDTiEfG0+waXQSMAW4rPSuzIMJwYSgRKzbS+hyANauWvLHFTQvEUjEN3bZT9GGxANbcF8ICFSeAuMggwyEqGArBLeOqkk8n+nmKUzRhf3YBKIobpfumh1Z2/iNhmpwX1X2V3rU0ggFwvvJgmmU/LDSo3mow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784394186; c=relaxed/simple; bh=fLUW//SElU78yaT7KOfgh6TjYE16+147quFifNgNYyY=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aDZZrssPQvOt9VMCQ9ykKzzYsn6ZVs5QMEcfelhY15XDcOSipuWuhTktvC6t8w7p6+uKMZ8HuOcBgqreIV0p3EuA6wLXz7mwTrxU+Yl/bmoz0DYpy0pSKf3LTg5a1ILv5R+TERVK2SIfTCbTjOlNSB8tf9kNLAtate83M3sDL60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wl8RG-000000007ru-3SD7; Sat, 18 Jul 2026 17:02:58 +0000 Date: Sat, 18 Jul 2026 18:02:55 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Hermes Wu , Allen Chen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/2] drm/bridge: it6505: Don't reject audio hw_params without an encoder Message-ID: <4efccd2179cadef2209ef6ecc0c898025276117d.1784393979.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_audio_setup_hw_params() returns -ENODEV when the bridge is not attached to a DRM encoder. Now that it6505 registers an hdmi-audio-codec, this callback runs whenever a stream is configured on the I2S DAI it is wired to, including when that DAI is shared with another codec. On mt8186-corsola the speaker amplifier (rt1019) and it6505 share I2S3, so when the it6505 DP output has no display attached (bridge.encoder is NULL) the -ENODEV propagates up through dpcm_be_dai_hw_params() and tears down the whole backend, breaking speaker playback. A codec must not fail hw_params on a shared DAI just because its own sink is absent; the actual output is already gated by it6505->powered. Return 0 so the shared link can be configured. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- drivers/gpu/drm/bridge/ite-it6505.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 698ae01b3a47..e88960c82a23 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2979,7 +2979,7 @@ static int it6505_audio_setup_hw_params(struct it6505= *it6505, params->cea.channels); =20 if (!it6505->bridge.encoder) - return -ENODEV; + return 0; =20 if (params->cea.channels <=3D 1 || params->cea.channels > 8) { DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support", --=20 2.55.0