Skip to content

Commit

Permalink
ASoC: SOF: ipc4-topology: Fix pipeline params at the output of copier
Browse files Browse the repository at this point in the history
Today, the prepare op for the copier only modifies the sample format in
the pipeline_params to match that of its output format. But consider the
case when a copier is connected to an SRC like below:

copier.SSP.1.1 -> src.1.1 -> copier.host.1.1

Let's say we want to capture 44.1K 32bit 2ch audio and that the sampling
frequency is fixed to 48KHz at the copier.SSP.1.1. pipeline_params starts
off being the same as that as the fe_params, so the rate will be
44.1KHz at the start. But since the copier.SSP.1.1 only captures at
48KHz, the pipeline_params must be changed to match this rate, so that
the SRC prepare op can use this as the reference for selecting the input
audio format.

Signed-off-by: Ranjani Sridharan <[email protected]>
  • Loading branch information
ranj063 committed May 9, 2023
1 parent bbde1f5 commit 90b02b1
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,25 +1344,6 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s
}
#endif

static int ipc4_set_fmt_mask(struct snd_mask *fmt, unsigned int bit_depth)
{
switch (bit_depth) {
case 16:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
break;
case 24:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
break;
case 32:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
break;
default:
return -EINVAL;
}

return 0;
}

static int
sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
struct snd_pcm_hw_params *fe_params,
Expand All @@ -1378,8 +1359,6 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
struct snd_sof_dai *dai;
u32 gtw_cfg_config_length;
u32 dma_config_tlv_size = 0;
struct snd_mask *fmt;
int out_sample_valid_bits;
void **ipc_config_data;
int *ipc_config_size;
u32 **data;
Expand Down Expand Up @@ -1659,11 +1638,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
}

/* modify the input params for the next widget */
fmt = hw_param_mask(pipeline_params, SNDRV_PCM_HW_PARAM_FORMAT);
out_sample_valid_bits =
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(copier_data->out_format.fmt_cfg);
snd_mask_none(fmt);
ret = ipc4_set_fmt_mask(fmt, out_sample_valid_bits);
ret = sof_ipc4_update_hw_params(sdev, pipeline_params, &copier_data->out_format);
if (ret)
return ret;

Expand Down

0 comments on commit 90b02b1

Please sign in to comment.