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 <sugar.zhang@rock-chips.com>
Change-Id: Id5b4490b8bd96559b49fb8225cf93feac7c3d5c2
This commit is contained in:
Sugar Zhang
2024-07-09 17:29:15 +08:00
committed by Tao Huang
parent e06eeb1d57
commit e22dfe2e09

View File

@@ -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)