* [PATCH V2] ASoC: fsl_asrc: add constraint for the asrc of older version
@ 2019-03-01 8:37 S.j. Wang
2019-03-01 18:27 ` Nicolin Chen
0 siblings, 1 reply; 3+ messages in thread
From: S.j. Wang @ 2019-03-01 8:37 UTC (permalink / raw)
To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com,
festevam@gmail.com, broonie@kernel.org,
alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
There is 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.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
changes in v2
- switch to add constraint in startup function
sound/soc/fsl/fsl_asrc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 528e8b108422..31494f225037 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -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);
+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);
+
+ /* channel_bits = 3 means older version on imx35*/
+ 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,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -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 = {
+ .startup = fsl_asrc_dai_startup,
.hw_params = fsl_asrc_dai_hw_params,
.hw_free = fsl_asrc_dai_hw_free,
.trigger = fsl_asrc_dai_trigger,
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] ASoC: fsl_asrc: add constraint for the asrc of older version
2019-03-01 8:37 [PATCH V2] ASoC: fsl_asrc: add constraint for the asrc of older version S.j. Wang
@ 2019-03-01 18:27 ` Nicolin Chen
2019-03-02 5:47 ` S.j. Wang
0 siblings, 1 reply; 3+ messages in thread
From: Nicolin Chen @ 2019-03-01 18:27 UTC (permalink / raw)
To: S.j. Wang
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org,
linuxppc-dev@lists.ozlabs.org
On Fri, Mar 01, 2019 at 08:37:08AM +0000, S.j. Wang wrote:
> There is constraint for the channel number setting on the
nit: "a constraint"
> asrc of older version (e.g. imx35), the channel number should
> be even, odd number isn't valid.
> +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);
> +
> + /* channel_bits = 3 means older version on imx35*/
Space between '5' and '*'. And better to make it clear:
/* 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);
For your next version,
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V2] ASoC: fsl_asrc: add constraint for the asrc of older version
2019-03-01 18:27 ` Nicolin Chen
@ 2019-03-02 5:47 ` S.j. Wang
0 siblings, 0 replies; 3+ messages in thread
From: S.j. Wang @ 2019-03-02 5:47 UTC (permalink / raw)
To: Nicolin Chen
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org,
linuxppc-dev@lists.ozlabs.org
Hi
> On Fri, Mar 01, 2019 at 08:37:08AM +0000, S.j. Wang wrote:
> > There is constraint for the channel number setting on the
>
> nit: "a constraint"
>
> > asrc of older version (e.g. imx35), the channel number should be even,
> > odd number isn't valid.
>
> > +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);
> > +
> > + /* channel_bits = 3 means older version on imx35*/
>
> Space between '5' and '*'. And better to make it clear:
>
> /* 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);
>
> For your next version,
>
> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Ok, thanks, will send v3.
>
> Cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-02 5:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-01 8:37 [PATCH V2] ASoC: fsl_asrc: add constraint for the asrc of older version S.j. Wang
2019-03-01 18:27 ` Nicolin Chen
2019-03-02 5:47 ` S.j. Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).