codec_adapter: update .params() method

This patch updates the .params() method with verification of runtime
parameters and stores them in component data for future use.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2020-11-23 17:25:18 +01:00 committed by Liam Girdwood
parent 9d1ebecb8f
commit e79893ee02
2 changed files with 16 additions and 1 deletions

View File

@ -225,8 +225,21 @@ static int codec_adapter_prepare(struct comp_dev *dev)
static int codec_adapter_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
{
comp_dbg(dev, "codec_adapter_params(): codec_adapter doesn't support .params() method.");
int ret;
struct comp_data *cd = comp_get_drvdata(dev);
ret = comp_verify_params(dev, 0, params);
if (ret < 0) {
comp_err(dev, "codec_adapter_params(): comp_verify_params() failed.");
return ret;
}
ret = memcpy_s(&cd->stream_params, sizeof(struct sof_ipc_stream_params),
params, sizeof(struct sof_ipc_stream_params));
assert(!ret);
cd->period_bytes = params->sample_container_bytes *
params->channels * params->rate / 1000;
return 0;
}

View File

@ -183,6 +183,8 @@ struct comp_data {
struct comp_buffer *ca_sink;
struct comp_buffer *ca_source;
void *runtime_params;
struct sof_ipc_stream_params stream_params;
uint32_t period_bytes; /** pipeline period bytes */
};
/*****************************************************************************/