Commit 7ab6b1e8 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown

ASoC: SOF: ipc4-topology: Modify the type of available input/output formats

Introduce a new struct sof_ipc4_pin_format which contains the pin index
and the buffer size. Replace the type of available input/output audio
formats in struct sof_ipc4_available_audio_format with this new struct
type and rename them to input_pin_fmts and output_pin_fmts.

Also, add a new token, SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX that will be
used to parse the pin index for the audio format from topology.
Currently we only set the audio format for Pin 0 in topology, so the
default value will be 0 for all audio formats.

Finally, parse the pin_index and the input/output buffer sizes
along with audio formats into the pin_format arrays in struct
sof_ipc4_available_audio_format. This makes the base_config array in struct
sof_ipc4_available_audio_format redundant. So remove it. This change
will allow the addition of audio formats for the non-zero pins in
topology transparent to the topology parser in the kernel.
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230313124856.8140-8-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8abc9ab9
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE 1906 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE 1906
#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG 1907 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG 1907
#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_SAMPLE_TYPE 1908 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_SAMPLE_TYPE 1908
#define SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX 1909
/* intentional token numbering discontinuity, reserved for future use */ /* intentional token numbering discontinuity, reserved for future use */
#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE 1930 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE 1930
#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH 1931 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH 1931
......
...@@ -389,7 +389,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -389,7 +389,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
snd_mask_none(fmt); snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE); snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
rate->min = ipc4_copier->available_fmt.input_audio_fmts->sampling_frequency; rate->min = ipc4_copier->available_fmt.input_pin_fmts->audio_fmt.sampling_frequency;
rate->max = rate->min; rate->max = rate->min;
switch (ipc4_copier->dai_type) { switch (ipc4_copier->dai_type) {
......
This diff is collapsed.
...@@ -145,19 +145,32 @@ struct ipc4_pipeline_set_state_data { ...@@ -145,19 +145,32 @@ struct ipc4_pipeline_set_state_data {
DECLARE_FLEX_ARRAY(u32, pipeline_ids); DECLARE_FLEX_ARRAY(u32, pipeline_ids);
} __packed; } __packed;
/**
* struct sof_ipc4_pin_format - Module pin format
* @pin_index: pin index
* @buffer_size: buffer size in bytes
* @audio_fmt: audio format for the pin
*
* This structure can be used for both output or input pins and the pin_index is relative to the
* pin type i.e output/input pin
*/
struct sof_ipc4_pin_format {
u32 pin_index;
u32 buffer_size;
struct sof_ipc4_audio_format audio_fmt;
};
/** /**
* struct sof_ipc4_available_audio_format - Available audio formats * struct sof_ipc4_available_audio_format - Available audio formats
* @base_config: Available base config * @output_pin_fmts: Available output pin formats
* @out_audio_fmt: Available output audio format * @input_pin_fmts: Available input pin formats
* @input_audio_fmts: Available input audio formats
* @ref_audio_fmt: Reference audio format to match runtime audio format * @ref_audio_fmt: Reference audio format to match runtime audio format
* @audio_fmt_num: Number of available audio formats * @audio_fmt_num: Number of available audio formats
*/ */
struct sof_ipc4_available_audio_format { struct sof_ipc4_available_audio_format {
struct sof_ipc4_base_module_cfg *base_config; struct sof_ipc4_pin_format *output_pin_fmts;
struct sof_ipc4_audio_format *out_audio_fmt; struct sof_ipc4_pin_format *input_pin_fmts;
struct sof_ipc4_audio_format *input_audio_fmts; struct sof_ipc4_pin_format *ref_audio_fmt;
struct sof_ipc4_audio_format *ref_audio_fmt;
int audio_fmt_num; int audio_fmt_num;
}; };
......
...@@ -256,7 +256,6 @@ enum sof_tokens { ...@@ -256,7 +256,6 @@ enum sof_tokens {
SOF_COMP_EXT_TOKENS, SOF_COMP_EXT_TOKENS,
SOF_IN_AUDIO_FORMAT_TOKENS, SOF_IN_AUDIO_FORMAT_TOKENS,
SOF_OUT_AUDIO_FORMAT_TOKENS, SOF_OUT_AUDIO_FORMAT_TOKENS,
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
SOF_COPIER_DEEP_BUFFER_TOKENS, SOF_COPIER_DEEP_BUFFER_TOKENS,
SOF_COPIER_TOKENS, SOF_COPIER_TOKENS,
SOF_AUDIO_FMT_NUM_TOKENS, SOF_AUDIO_FMT_NUM_TOKENS,
......
...@@ -1232,7 +1232,6 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s ...@@ -1232,7 +1232,6 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s
continue; continue;
case SOF_IN_AUDIO_FORMAT_TOKENS: case SOF_IN_AUDIO_FORMAT_TOKENS:
case SOF_OUT_AUDIO_FORMAT_TOKENS: case SOF_OUT_AUDIO_FORMAT_TOKENS:
case SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS:
num_sets = sof_get_token_value(SOF_TKN_COMP_NUM_AUDIO_FORMATS, num_sets = sof_get_token_value(SOF_TKN_COMP_NUM_AUDIO_FORMATS,
swidget->tuples, swidget->num_tuples); swidget->tuples, swidget->num_tuples);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment