Skip to content

Commit

Permalink
Revert "dai-zephyr: Prioritize HW params channels over base config pa…
Browse files Browse the repository at this point in the history
…rams"

This reverts commit eda6029.
Third of the 3 commits, that need to be reverted.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Jul 19, 2024
1 parent d0dc3fb commit 8b32a11
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,7 @@ static int dai_set_dma_config(struct dai_data *dd, struct comp_dev *dev)
}

static int dai_set_dma_buffer(struct dai_data *dd, struct comp_dev *dev,
const struct sof_ipc_stream_params *params,
uint32_t *pb, uint32_t *pc)
struct sof_ipc_stream_params *params, uint32_t *pb, uint32_t *pc)
{
struct sof_ipc_stream_params hw_params = *params;
uint32_t frame_size;
Expand Down Expand Up @@ -917,10 +916,8 @@ static int dai_set_dma_buffer(struct dai_data *dd, struct comp_dev *dev,
}

int dai_common_params(struct dai_data *dd, struct comp_dev *dev,
struct sof_ipc_stream_params *base_cfg_params)
struct sof_ipc_stream_params *params)
{
struct sof_ipc_stream_params params = *base_cfg_params;
struct sof_ipc_stream_params hw_params;
struct dma_sg_config *config = &dd->config;
uint32_t period_bytes = 0;
uint32_t period_count = 0;
Expand All @@ -935,30 +932,13 @@ int dai_common_params(struct dai_data *dd, struct comp_dev *dev,
return err;
}

/* When the hardware is able to return a valid number of DMA buffer audio channels
* (e.g., extracted from a blob), give the returned number of channels higher precedence
* over the number supplied via the base config params.
*/
memset(&hw_params, 0, sizeof(hw_params));
err = dai_common_get_hw_params(dd, dev, &hw_params, params.direction);
if (err < 0) {
comp_err(dev, "dai_common_get_hw_params() failed: %d", err);
return err;
}

if (hw_params.channels != 0 && hw_params.channels != params.channels) {
params.channels = hw_params.channels;
comp_info(dev, "Replacing %d base config channels with %d hw params channels.",
base_cfg_params->channels, params.channels);
}

err = dai_verify_params(dd, dev, &params);
err = dai_verify_params(dd, dev, params);
if (err < 0) {
comp_err(dev, "dai_zephyr_params(): pcm params verification failed.");
return -EINVAL;
}

err = dai_set_dma_buffer(dd, dev, &params, &period_bytes, &period_count);
err = dai_set_dma_buffer(dd, dev, params, &period_bytes, &period_count);
if (err < 0) {
comp_err(dev, "dai_zephyr_params(): alloc dma buffer failed.");
goto out;
Expand Down

0 comments on commit 8b32a11

Please sign in to comment.