Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/audio/dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Copy link
Member

@plbossart plbossart Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkokoszx can you clarify for me the commit message and comment above "DAI component is able to convert stream with different frame_fmt's"?
It was my understanding that the DAI operates with a fixed format, and conversions are e.g. handled in a volume component. What am I missing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart
For some time the DAI component has been able to make frame_fmt conversion. We do not need volume component to do that. This capability has been added in PR #2029.

Copy link
Member

@lgirdwood lgirdwood Feb 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkokoszx best to add more context to this comment. This is about back propagating the DAI format back through the pipeline so that any converter component can convert from format X -> Y if needed.
I would also make this a static inline since it will be used as part of runtime by multi-DAI support.

return 0;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down