Skip to content

Commit e8733fb

Browse files
committed
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>
1 parent c3db256 commit e8733fb

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/audio/dai.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,
171171
}
172172

173173
dma_sg_init(&dd->config.elem_array);
174+
dd->frame_fmt = ipc_dai->config.frame_fmt;
174175
dd->dai_pos = NULL;
175176
dd->dai_pos_blks = 0;
176177
dd->xrun = 0;
@@ -202,8 +203,9 @@ static void dai_free(struct comp_dev *dev)
202203
rfree(dev);
203204
}
204205

205-
static int dai_comp_get_hw_params(struct comp_dev *dev,
206-
struct sof_ipc_stream_params *params, int dir)
206+
static inline int dai_comp_get_hw_params(struct comp_dev *dev,
207+
struct sof_ipc_stream_params *params,
208+
int dir)
207209
{
208210
struct dai_data *dd = comp_get_drvdata(dev);
209211
int ret = 0;
@@ -217,6 +219,15 @@ static int dai_comp_get_hw_params(struct comp_dev *dev,
217219
return ret;
218220
}
219221

222+
/* dai_comp_get_hw_params() function fetches hardware dai parameters,
223+
* which then are propagating back through the pipeline, so that any
224+
* component can convert specific stream parameter. Here, we overwrite
225+
* frame_fmt hardware parameter as DAI component is able to convert
226+
* stream with different frame_fmt's (using pcm converter)
227+
*/
228+
if (dd->frame_fmt)
229+
params->frame_fmt = dd->frame_fmt;
230+
220231
return 0;
221232
}
222233

@@ -362,7 +373,6 @@ static int dai_capture_params(struct comp_dev *dev, uint32_t period_bytes,
362373
static int dai_params(struct comp_dev *dev,
363374
struct sof_ipc_stream_params *params)
364375
{
365-
struct sof_ipc_comp_config *dconfig = dev_comp_config(dev);
366376
struct dai_data *dd = comp_get_drvdata(dev);
367377
uint32_t frame_size;
368378
uint32_t period_count;
@@ -424,8 +434,6 @@ static int dai_params(struct comp_dev *dev,
424434
return -EINVAL;
425435
}
426436

427-
dd->frame_fmt = dconfig->frame_fmt;
428-
429437
/* calculate frame size */
430438
frame_size = frame_bytes(dd->frame_fmt,
431439
dd->local_buffer->stream.channels);
@@ -757,6 +765,7 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
757765
* all formats, such as 8/16/24/32 bits.
758766
*/
759767
dconfig->frame_fmt = SOF_IPC_FRAME_S32_LE;
768+
dd->frame_fmt = dconfig->frame_fmt;
760769

761770
dd->config.burst_elems =
762771
dd->dai->plat_data.fifo[dai->direction].depth;

0 commit comments

Comments
 (0)