Commit 53f67a78 authored by S.j. Wang's avatar S.j. Wang Committed by Mark Brown

ASoC: fsl_asrc: add constraint for the asrc of older version

There is a constraint for the channel number setting on the
asrc of older version (e.g. imx35), the channel number should
be even, odd number isn't valid.

So add this constraint when the asrc of older version is used.
Acked-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f0f2338a
...@@ -445,6 +445,19 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir) ...@@ -445,6 +445,19 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
} }
EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel); EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
/* Odd channel number is not valid for older ASRC (channel_bits==3) */
if (asrc_priv->channel_bits == 3)
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_CHANNELS, 2);
return 0;
}
static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
...@@ -539,6 +552,7 @@ static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -539,6 +552,7 @@ static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
} }
static const struct snd_soc_dai_ops fsl_asrc_dai_ops = { static const struct snd_soc_dai_ops fsl_asrc_dai_ops = {
.startup = fsl_asrc_dai_startup,
.hw_params = fsl_asrc_dai_hw_params, .hw_params = fsl_asrc_dai_hw_params,
.hw_free = fsl_asrc_dai_hw_free, .hw_free = fsl_asrc_dai_hw_free,
.trigger = fsl_asrc_dai_trigger, .trigger = fsl_asrc_dai_trigger,
......
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