Commit 6878ba91 authored by Jerome Brunet's avatar Jerome Brunet Committed by Mark Brown

ASoC: meson: axg-tdm-interface: fix link fmt setup

The .set_fmt() callback of the axg tdm interface incorrectly
test the content of SND_SOC_DAIFMT_MASTER_MASK as if it was a
bitfield, which it is not.

Implement the test correctly.

Fixes: d60e4f1e ("ASoC: meson: add tdm interface driver")
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20200729154456.1983396-2-jbrunet@baylibre.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent dc5fb6d2
...@@ -119,17 +119,24 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -119,17 +119,24 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
/* These modes are not supported */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) { case SND_SOC_DAIFMT_CBS_CFS:
dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); if (!iface->mclk) {
return -EINVAL;
}
/* If the TDM interface is the clock master, it requires mclk */
if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) {
dev_err(dai->dev, "cpu clock master: mclk missing\n"); dev_err(dai->dev, "cpu clock master: mclk missing\n");
return -ENODEV; return -ENODEV;
} }
break;
case SND_SOC_DAIFMT_CBM_CFM:
break;
case SND_SOC_DAIFMT_CBS_CFM:
case SND_SOC_DAIFMT_CBM_CFS:
dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
/* Fall-through */
default:
return -EINVAL;
}
iface->fmt = fmt; iface->fmt = fmt;
return 0; return 0;
...@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream, ...@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream,
if (ret) if (ret)
return ret; return ret;
if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) { if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
SND_SOC_DAIFMT_CBS_CFS) {
ret = axg_tdm_iface_set_sclk(dai, params); ret = axg_tdm_iface_set_sclk(dai, params);
if (ret) if (ret)
return ret; return ret;
......
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