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 <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2018-06-15 21:34:33 -07:00
parent b5754f6e2a
commit 9dfd80d458
1 changed files with 8 additions and 6 deletions

View File

@ -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;
}