From 9dfd80d45819cca970299c8e259cd19d235624a5 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 15 Jun 2018 21:34:33 -0700 Subject: [PATCH] tone: fix calculation for period_bytes period bytes depends on the frame_fmt and the number of channels set in topology. So fix calculation accordingly. Signed-off-by: Ranjani Sridharan --- 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 eb060bdb2..68a78f34c 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; }