[Sound-open-firmware] [PATCH v2 5/6] tone: fix calculation for period_bytes

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Sun Jun 24 09:59:27 CEST 2018


period bytes depends on the frame_fmt and the number of channels
set in topology. So fix calculation accordingly.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 src/audio/tone.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/audio/tone.c b/src/audio/tone.c
index eb060bd..68a78f3 100644
--- a/src/audio/tone.c
+++ b/src/audio/tone.c
@@ -450,17 +450,19 @@ static int tone_params(struct comp_dev *dev)
 
 	trace_tone("par");
 
+	/* Tone supports only S32_LE PCM format atm */
+	if (config->frame_fmt != SOF_IPC_FRAME_S32_LE)
+		return -EINVAL;
+
+	trace_value(config->frame_fmt);
+	dev->params.frame_fmt = config->frame_fmt;
+
 	/* Need to compute this in non-host endpoint */
-	dev->frame_bytes =
-		dev->params.sample_container_bytes * dev->params.channels;
+	dev->frame_bytes = comp_frame_bytes(dev);
 
 	/* calculate period size based on config */
 	cd->period_bytes = dev->frames * dev->frame_bytes;
 
-	/* EQ supports only S32_LE PCM format */
-	if (config->frame_fmt != SOF_IPC_FRAME_S32_LE)
-		return -EINVAL;
-
 	return 0;
 }
 
-- 
2.17.1



More information about the Sound-open-firmware mailing list