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

Message ID 6344b98f891fff3011257b21e1d8e39d7a123831.1450935357.git.zidan.wang@freescale.com
State New
Headers show

Commit Message

Zidan Wang Dec. 24, 2015, 5:37 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>
---
v1->v2:
1. add an extra else if for the new condition.

 sound/soc/fsl/fsl_asrc.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index be78dc9..16ff156 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -116,6 +116,10 @@  static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
 	} else if (asrc_priv->channel_avail < channels) {
 		dev_err(dev, "can't afford required channels: %d\n", channels);
 		ret = -EINVAL;
+	} else if (asrc_priv->channel_bits < 4 && channels % 2 != 0) {
+		dev_err(dev, "old version asrc can't support an odd \
+			      channel number\n");
+		ret = -EINVAL;
 	} else {
 		asrc_priv->channel_avail -= channels;
 		asrc_priv->pair[index] = pair;