From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"timur@kernel.org" <timur@kernel.org>,
"Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>,
"festevam@gmail.com" <festevam@gmail.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] ASoC: fsl_asrc: add protection for the asrc of older version
Date: Thu, 28 Feb 2019 18:53:57 -0800 [thread overview]
Message-ID: <20190301025356.GA1371@Asurada-Nvidia.nvidia.com> (raw)
In-Reply-To: <1551407560-29950-1-git-send-email-shengjiu.wang@nxp.com>
Hi Shengjiu,
On Fri, Mar 01, 2019 at 02:32:38AM +0000, S.j. Wang wrote:
> 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 protection when the asrc of older version is used.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> sound/soc/fsl/fsl_asrc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> index 528e8b108422..b3b3c5e15ef1 100644
> --- a/sound/soc/fsl/fsl_asrc.c
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -109,7 +109,8 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
> if (index == ASRC_INVALID_PAIR) {
> dev_err(dev, "all pairs are busy now\n");
> ret = -EBUSY;
> - } else if (asrc_priv->channel_avail < channels) {
> + } else if (asrc_priv->channel_avail < channels ||
> + (asrc_priv->channel_bits < 4 && channels % 2 != 0)) {
> dev_err(dev, "can't afford required channels: %d\n", channels);
I feel it'd be better to have another else-if, since the existing
error message is against something else.
+ } else if (asrc_priv->channel_bits < 4 && channels & 1) {
+ /* old version of ASRC has channel_bits = 3 */
+ dev_err(dev, "does not support odd channel number\n");
+ ret = -EINVAL;
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.
next prev parent reply other threads:[~2019-03-01 2:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 2:32 [PATCH] ASoC: fsl_asrc: add protection for the asrc of older version S.j. Wang
2019-03-01 2:53 ` Nicolin Chen [this message]
2019-03-01 6:55 ` S.j. Wang
2019-03-01 8:08 ` Nicolin Chen
2019-03-01 8:32 ` S.j. Wang
2019-03-01 12:38 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190301025356.GA1371@Asurada-Nvidia.nvidia.com \
--to=nicoleotsuka@gmail.com \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shengjiu.wang@nxp.com \
--cc=timur@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).