[alsa-devel] [PATCH] ASoC: fsl_asrc: add protection for the asrc of older version
Mark Brown
broonie at kernel.org
Fri Mar 1 13:38:08 CET 2019
On Fri, Mar 01, 2019 at 06:55:25AM +0000, S.j. Wang wrote:
> > Alternatively, I feel instead of error-out at here, should we add a HW
> > constraint or at least fence it off at the beginning of the hw_params()? This
> > is actually nothing specific to the pair-request function but a hardware
> > constraint.
> How about add constraint in startup?
> 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);
>
> if (asrc_priv->channel_bits == 3) {
> snd_pcm_hw_constraint_step(substream->runtime, 0,
> SNDRV_PCM_HW_PARAM_CHANNELS, 2);
> }
>
> return 0;
> }
Yes, that's definitely good - the general idea is that we should never
need to return an error from hw_params() as the constraints code will
have filtered out any invalid configurations before they get that far.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20190301/d111dfdf/attachment.sig>
More information about the Alsa-devel
mailing list