From e22dfe2e094493c1f831fe35dc38f543519490f0 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Tue, 9 Jul 2024 17:29:15 +0800 Subject: [PATCH] ASoC: hdmi-codec: Add support for HDMI-TX DLP Support for HDMI-TX Audio Digital Loopback. e.g. &hdmi { audio,digital-loopback; }; Signed-off-by: Sugar Zhang Change-Id: Id5b4490b8bd96559b49fb8225cf93feac7c3d5c2 --- sound/soc/codecs/hdmi-codec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 5d44964caa4f..2849ea39efc8 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -272,6 +272,7 @@ struct hdmi_codec_priv { struct mutex lock; bool busy; bool eld_bypass; + bool tx_dlp; struct snd_soc_jack *jack; unsigned int jack_status; u8 iec_status[AES_IEC958_STATUS_SIZE]; @@ -460,6 +461,9 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; int ret = 0; + if (hcp->tx_dlp && substream->stream != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + mutex_lock(&hcp->lock); if (hcp->busy) { dev_err(dai->dev, "Only one simultaneous stream supported!\n"); @@ -500,6 +504,9 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + if (hcp->tx_dlp && substream->stream != SNDRV_PCM_STREAM_PLAYBACK) + return; + hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); @@ -561,6 +568,9 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, }; int ret; + if (hcp->tx_dlp && substream->stream != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if (!hcp->hcd.ops->hw_params) return 0; @@ -602,6 +612,9 @@ static int hdmi_codec_prepare(struct snd_pcm_substream *substream, struct hdmi_codec_params hp; int ret; + if (hcp->tx_dlp && substream->stream != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if (!hcp->hcd.ops->prepare) return 0; @@ -1083,6 +1096,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) hcp->hcd = *hcd; mutex_init(&hcp->lock); + hcp->tx_dlp = device_property_read_bool(dev->parent, "audio,digital-loopback"); + ret = snd_pcm_create_iec958_consumer_default(hcp->iec_status, sizeof(hcp->iec_status)); if (ret < 0)