ASoC: fsl_asrc: old version asrc only support even numbered channels
diff mbox

Message ID beec631c1838b4a0a2a43066e1e308ec1407715b.1450430846.git.zidan.wang@freescale.com
State New
Headers show

Commit Message

Zidan Wang Dec. 18, 2015, 9:29 a.m. UTC
The latest asrc's channel bits is 4 bit, the old asrc's channel
bits is 3. For the old version asrc, channel should be a even number.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/fsl/fsl_asrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Nicolin Chen Dec. 21, 2015, 7:31 a.m. UTC | #1
On Fri, Dec 18, 2015 at 05:29:13PM +0800, Zidan Wang wrote:
> The latest asrc's channel bits is 4 bit, the old asrc's channel
> bits is 3. For the old version asrc, channel should be a even number.
> 
> Signed-off-by: Zidan Wang <zidan.wang@freescale.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 be78dc9..484e46ca 100644
> --- a/sound/soc/fsl/fsl_asrc.c
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -113,7 +113,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);

It's actually not because of "cannot afford" but "not support an odd
channel number". So it should not be merged to the original condition.
Please add an extra else if for it.

Patch
diff mbox

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index be78dc9..484e46ca 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -113,7 +113,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);
 		ret = -EINVAL;
 	} else {