dai: overwrite hardware frame_fmt parameter with private frame_fmt

Overwrite frame_fmt hardware parameters with DAI private frame_fmt
in dai_comp_get_hw_params() function as DAI component is able to
convert stream with different frame_fmt's

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
This commit is contained in:
Bartosz Kokoszko 2020-02-21 10:22:36 +01:00 committed by Liam Girdwood
parent 3609fa6fc6
commit 01b41286fd
1 changed files with 14 additions and 5 deletions

View File

@ -171,6 +171,7 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,
}
dma_sg_init(&dd->config.elem_array);
dd->frame_fmt = ipc_dai->config.frame_fmt;
dd->dai_pos = NULL;
dd->dai_pos_blks = 0;
dd->xrun = 0;
@ -202,8 +203,9 @@ static void dai_free(struct comp_dev *dev)
rfree(dev);
}
static int dai_comp_get_hw_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params, int dir)
static inline int dai_comp_get_hw_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params,
int dir)
{
struct dai_data *dd = comp_get_drvdata(dev);
int ret = 0;
@ -217,6 +219,15 @@ static int dai_comp_get_hw_params(struct comp_dev *dev,
return ret;
}
/* dai_comp_get_hw_params() function fetches hardware dai parameters,
* which then are propagating back through the pipeline, so that any
* component can convert specific stream parameter. Here, we overwrite
* frame_fmt hardware parameter as DAI component is able to convert
* stream with different frame_fmt's (using pcm converter)
*/
if (dd->frame_fmt)
params->frame_fmt = dd->frame_fmt;
return 0;
}
@ -362,7 +373,6 @@ static int dai_capture_params(struct comp_dev *dev, uint32_t period_bytes,
static int dai_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
{
struct sof_ipc_comp_config *dconfig = dev_comp_config(dev);
struct dai_data *dd = comp_get_drvdata(dev);
uint32_t frame_size;
uint32_t period_count;
@ -424,8 +434,6 @@ static int dai_params(struct comp_dev *dev,
return -EINVAL;
}
dd->frame_fmt = dconfig->frame_fmt;
/* calculate frame size */
frame_size = frame_bytes(dd->frame_fmt,
dd->local_buffer->stream.channels);
@ -757,6 +765,7 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
* all formats, such as 8/16/24/32 bits.
*/
dconfig->frame_fmt = SOF_IPC_FRAME_S32_LE;
dd->frame_fmt = dconfig->frame_fmt;
dd->config.burst_elems =
dd->dai->plat_data.fifo[dai->direction].depth;