Skip to content

Commit 6878ba9

Browse files
jbrun3tbroonie
authored andcommitted
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: d60e4f1 ("ASoC: meson: add tdm interface driver") Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dc5fb6d commit 6878ba9

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

sound/soc/meson/axg-tdm-interface.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
119119
{
120120
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
121121

122-
/* These modes are not supported */
123-
if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) {
122+
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
123+
case SND_SOC_DAIFMT_CBS_CFS:
124+
if (!iface->mclk) {
125+
dev_err(dai->dev, "cpu clock master: mclk missing\n");
126+
return -ENODEV;
127+
}
128+
break;
129+
130+
case SND_SOC_DAIFMT_CBM_CFM:
131+
break;
132+
133+
case SND_SOC_DAIFMT_CBS_CFM:
134+
case SND_SOC_DAIFMT_CBM_CFS:
124135
dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
136+
/* Fall-through */
137+
default:
125138
return -EINVAL;
126139
}
127140

128-
/* If the TDM interface is the clock master, it requires mclk */
129-
if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) {
130-
dev_err(dai->dev, "cpu clock master: mclk missing\n");
131-
return -ENODEV;
132-
}
133-
134141
iface->fmt = fmt;
135142
return 0;
136143
}
@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream,
319326
if (ret)
320327
return ret;
321328

322-
if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) {
329+
if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
330+
SND_SOC_DAIFMT_CBS_CFS) {
323331
ret = axg_tdm_iface_set_sclk(dai, params);
324332
if (ret)
325333
return ret;

0 commit comments

Comments
 (0)