Commit 6544b496 authored by Russell King's avatar Russell King Committed by Greg Kroah-Hartman

ASoC: hdmi-codec: fix S/PDIF DAI

[ Upstream commit 2e95f984 ]

When using the S/PDIF DAI, there is no requirement to call
snd_soc_dai_set_fmt() as there is no DAI format definition that defines
S/PDIF.  In any case, S/PDIF does not have separate clocks, this is
embedded into the data stream.

Consequently, when attempting to use TDA998x in S/PDIF mode, the attempt
to configure TDA998x via the hw_params callback fails as the
hdmi_codec_daifmt is left initialised to zero.

Since the S/PDIF DAI will only be used by S/PDIF, prepare the
hdmi_codec_daifmt structure for this format.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarJyri Sarha <jsarha@ti.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 98a80393
...@@ -529,13 +529,12 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, ...@@ -529,13 +529,12 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai,
{ {
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
struct hdmi_codec_daifmt cf = { 0 }; struct hdmi_codec_daifmt cf = { 0 };
int ret = 0;
dev_dbg(dai->dev, "%s()\n", __func__); dev_dbg(dai->dev, "%s()\n", __func__);
if (dai->id == DAI_ID_SPDIF) { if (dai->id == DAI_ID_SPDIF)
cf.fmt = HDMI_SPDIF; return 0;
} else {
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
cf.bit_clk_master = 1; cf.bit_clk_master = 1;
...@@ -591,11 +590,10 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, ...@@ -591,11 +590,10 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai,
dev_err(dai->dev, "Invalid DAI interface format\n"); dev_err(dai->dev, "Invalid DAI interface format\n");
return -EINVAL; return -EINVAL;
} }
}
hcp->daifmt[dai->id] = cf; hcp->daifmt[dai->id] = cf;
return ret; return 0;
} }
static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)
...@@ -792,8 +790,10 @@ static int hdmi_codec_probe(struct platform_device *pdev) ...@@ -792,8 +790,10 @@ static int hdmi_codec_probe(struct platform_device *pdev)
i++; i++;
} }
if (hcd->spdif) if (hcd->spdif) {
hcp->daidrv[i] = hdmi_spdif_dai; hcp->daidrv[i] = hdmi_spdif_dai;
hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF;
}
dev_set_drvdata(dev, hcp); dev_set_drvdata(dev, hcp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment