Commit 80f454e2 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: revert soc_pcm_apply_symmetry()

commit a39748d0 ("ASoC: soc-pcm: cleanup soc_pcm_apply_symmetry()")
was applied by miscommunication.
To more cleanup code, and to be easy review, this patch reverts it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2guoljm.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 879a67e3
...@@ -349,26 +349,53 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, ...@@ -349,26 +349,53 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
int ret; int ret;
#define __soc_pcm_apply_symmetry(name, sname, NAME) \ if (soc_dai->rate && (soc_dai->driver->symmetric_rates ||
if (soc_dai->name && (soc_dai->driver->symmetric_##sname || \ rtd->dai_link->symmetric_rates)) {
rtd->dai_link->symmetric_##sname)) { \ dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n",
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\ soc_dai->rate);
#name, soc_dai->name); \
\ ret = snd_pcm_hw_constraint_single(substream->runtime,
ret = snd_pcm_hw_constraint_single(substream->runtime, \ SNDRV_PCM_HW_PARAM_RATE,
SNDRV_PCM_HW_PARAM_##NAME,\ soc_dai->rate);
soc_dai->name); \ if (ret < 0) {
if (ret < 0) { \ dev_err(soc_dai->dev,
dev_err(soc_dai->dev, \ "ASoC: Unable to apply rate constraint: %d\n",
"ASoC: Unable to apply %s constraint: %d\n",\ ret);
#name, ret); \ return ret;
return ret; \ }
} \ }
}
if (soc_dai->channels && (soc_dai->driver->symmetric_channels ||
__soc_pcm_apply_symmetry(rate, rates, RATE); rtd->dai_link->symmetric_channels)) {
__soc_pcm_apply_symmetry(channels, channels, CHANNELS); dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d channel(s)\n",
__soc_pcm_apply_symmetry(sample_bits, samplebits, SAMPLE_BITS); soc_dai->channels);
ret = snd_pcm_hw_constraint_single(substream->runtime,
SNDRV_PCM_HW_PARAM_CHANNELS,
soc_dai->channels);
if (ret < 0) {
dev_err(soc_dai->dev,
"ASoC: Unable to apply channel symmetry constraint: %d\n",
ret);
return ret;
}
}
if (soc_dai->sample_bits && (soc_dai->driver->symmetric_samplebits ||
rtd->dai_link->symmetric_samplebits)) {
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n",
soc_dai->sample_bits);
ret = snd_pcm_hw_constraint_single(substream->runtime,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
soc_dai->sample_bits);
if (ret < 0) {
dev_err(soc_dai->dev,
"ASoC: Unable to apply sample bits symmetry constraint: %d\n",
ret);
return ret;
}
}
return 0; return 0;
} }
......
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