diff --git a/include/sound/sof/topology.h b/include/sound/sof/topology.h index 8e76178fedf08a..a21bfceeb3a24a 100644 --- a/include/sound/sof/topology.h +++ b/include/sound/sof/topology.h @@ -174,6 +174,22 @@ struct sof_ipc_comp_asrc { uint32_t reserved[4]; } __attribute__((packed)); +struct mux_stream_data { + uint32_t data_id; + uint32_t pipeline_id; + uint8_t num_channels; + uint8_t mask[8]; + uint8_t reserved[3]; /* padding */ +} __packed; + +struct sof_mux_config { + uint16_t frame_format; + uint16_t num_channels; + uint16_t num_streams; + uint16_t reserved; /* padding to ensure proper alignment */ + struct mux_stream_data streams[]; +} __packed; + /* generic MUX component */ struct sof_ipc_comp_mux { struct sof_ipc_comp comp; diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index 2a25cd8da5033e..068397447018bb 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -126,4 +126,9 @@ #define SOF_TKN_MUTE_LED_USE 1300 #define SOF_TKN_MUTE_LED_DIRECTION 1301 +#define SOF_TKN_MUX_NUM_STREAMS 1400 +#define SOF_TKN_MUX_NUM_CHANNELS 1401 +#define SOF_TKN_MUX_STREAM_PIPELINE_ID 1402 +#define SOF_TKN_MUX_STREAM_CHANNELS 1403 + #endif diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 9f4f8868b3860b..ba4d13b305a859 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -486,6 +486,15 @@ static int get_token_u16(void *elem, void *object, u32 offset, u32 size) return 0; } +static int get_token_u8(void *elem, void *object, u32 offset, u32 size) +{ + struct snd_soc_tplg_vendor_value_elem *velem = elem; + u8 *val = (u8 *)object + offset; + + *val = (u8)velem->value; + return 0; +} + static int get_token_comp_format(void *elem, void *object, u32 offset, u32 size) { struct snd_soc_tplg_vendor_string_elem *velem = elem; @@ -614,6 +623,22 @@ static const struct sof_topology_token stream_tokens[] = { offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible), 0}, }; +/* Mux data */ +static const struct sof_topology_token mux_tokens[] = { + {SOF_TKN_MUX_NUM_CHANNELS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_mux_config, num_channels), 0}, + {SOF_TKN_MUX_NUM_STREAMS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_mux_config, num_streams), 0}, +}; + +/* Mux stream data */ +static const struct sof_topology_token mux_stream_tokens[] = { + {SOF_TKN_MUX_STREAM_PIPELINE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct mux_stream_data, pipeline_id), 0}, + {SOF_TKN_MUX_STREAM_CHANNELS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u8, + offsetof(struct mux_stream_data, num_channels), 0}, +}; + /* Generic components */ static const struct sof_topology_token comp_tokens[] = { {SOF_TKN_COMP_PERIOD_SINK_COUNT, @@ -751,14 +776,15 @@ static const struct sof_topology_token led_tokens[] = { get_token_u32, offsetof(struct snd_sof_led_control, direction), 0}, }; -static void sof_parse_uuid_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array) +static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, + void *object, + const struct sof_topology_token *tokens, + int count, + struct snd_soc_tplg_vendor_array *array) { struct snd_soc_tplg_vendor_uuid_elem *elem; int i, j; + int found = 0; /* parse element by element */ for (i = 0; i < le32_to_cpu(array->num_elems); i++) { @@ -777,18 +803,22 @@ static void sof_parse_uuid_tokens(struct snd_soc_component *scomp, /* matched - now load token */ tokens[j].get_token(elem, object, tokens[j].offset, tokens[j].size); + found++; } } + + return found; } -static void sof_parse_string_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array) +static int sof_parse_string_tokens(struct snd_soc_component *scomp, + void *object, + const struct sof_topology_token *tokens, + int count, + struct snd_soc_tplg_vendor_array *array) { struct snd_soc_tplg_vendor_string_elem *elem; int i, j; + int found = 0; /* parse element by element */ for (i = 0; i < le32_to_cpu(array->num_elems); i++) { @@ -807,15 +837,18 @@ static void sof_parse_string_tokens(struct snd_soc_component *scomp, /* matched - now load token */ tokens[j].get_token(elem, object, tokens[j].offset, tokens[j].size); + found++; } } + + return found; } -static void sof_parse_word_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array) +static int sof_parse_word_tokens(struct snd_soc_component *scomp, + void *object, + const struct sof_topology_token *tokens, + int count, + struct snd_soc_tplg_vendor_array *array) { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_vendor_value_elem *elem; @@ -823,6 +856,7 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp, int i, j; u32 offset; u32 *index = NULL; + int found = 0; /* parse element by element */ for (i = 0; i < le32_to_cpu(array->num_elems); i++) { @@ -879,8 +913,11 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp, tokens[j].get_token(elem, object, offset + tokens[j].offset, tokens[j].size); + found++; } } + + return found; } static int sof_parse_tokens(struct snd_soc_component *scomp, @@ -888,10 +925,14 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, const struct sof_topology_token *tokens, int count, struct snd_soc_tplg_vendor_array *array, - int priv_size) + int priv_size, + int *read_bytes) { + int found = 0; int asize; + *read_bytes = 0; + while (priv_size > 0) { asize = le32_to_cpu(array->size); @@ -913,19 +954,19 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, /* call correct parser depending on type */ switch (le32_to_cpu(array->type)) { case SND_SOC_TPLG_TUPLE_TYPE_UUID: - sof_parse_uuid_tokens(scomp, object, tokens, count, - array); + found += sof_parse_uuid_tokens(scomp, object, tokens, + count, array); break; case SND_SOC_TPLG_TUPLE_TYPE_STRING: - sof_parse_string_tokens(scomp, object, tokens, count, - array); + found += sof_parse_string_tokens(scomp, object, tokens, + count, array); break; case SND_SOC_TPLG_TUPLE_TYPE_BOOL: case SND_SOC_TPLG_TUPLE_TYPE_BYTE: case SND_SOC_TPLG_TUPLE_TYPE_WORD: case SND_SOC_TPLG_TUPLE_TYPE_SHORT: - sof_parse_word_tokens(scomp, object, tokens, count, - array); + found += sof_parse_word_tokens(scomp, object, tokens, + count, array); break; default: dev_err(scomp->dev, "error: unknown token type %d\n", @@ -936,6 +977,13 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, /* next array */ array = (struct snd_soc_tplg_vendor_array *)((u8 *)array + asize); + + /* update parse position */ + *read_bytes += asize; + + /* return when all tokens have been found */ + if (found == count) + return 0; } return 0; } @@ -962,6 +1010,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, container_of(hdr, struct snd_soc_tplg_mixer_control, hdr); struct sof_ipc_ctrl_data *cdata; int tlv[TLV_ITEMS]; + int read_bytes; unsigned int i; int ret = 0; @@ -1018,7 +1067,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, /* set up possible led control from mixer private data */ ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, ARRAY_SIZE(led_tokens), mc->priv.array, - le32_to_cpu(mc->priv.size)); + le32_to_cpu(mc->priv.size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse led tokens failed %d\n", le32_to_cpu(mc->priv.size)); @@ -1289,6 +1338,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_dai comp_dai; + int read_bytes; int ret; /* configure dai IPC message */ @@ -1302,7 +1352,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &comp_dai, dai_tokens, ARRAY_SIZE(dai_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse dai tokens failed %d\n", le32_to_cpu(private->size)); @@ -1311,7 +1361,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &comp_dai.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse dai.cfg tokens failed %d\n", private->size); @@ -1345,6 +1395,7 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_buffer *buffer; + int read_bytes; int ret; buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); @@ -1360,7 +1411,7 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, buffer, buffer_tokens, ARRAY_SIZE(buffer_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse buffer tokens failed %d\n", private->size); @@ -1416,6 +1467,7 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_host *host; + int read_bytes; int ret; host = kzalloc(sizeof(*host), GFP_KERNEL); @@ -1433,7 +1485,7 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, host, pcm_tokens, ARRAY_SIZE(pcm_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse host tokens failed %d\n", private->size); @@ -1442,7 +1494,7 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &host->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse host.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -1521,6 +1573,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_pipe_new *pipeline; struct snd_sof_widget *comp_swidget; + int read_bytes; int ret; pipeline = kzalloc(sizeof(*pipeline), GFP_KERNEL); @@ -1549,7 +1602,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, ret = sof_parse_tokens(scomp, pipeline, sched_tokens, ARRAY_SIZE(sched_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse pipeline tokens failed %d\n", private->size); @@ -1583,6 +1636,7 @@ static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_mixer *mixer; + int read_bytes; int ret; mixer = kzalloc(sizeof(*mixer), GFP_KERNEL); @@ -1599,7 +1653,7 @@ static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &mixer->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse mixer.cfg tokens failed %d\n", private->size); @@ -1630,6 +1684,7 @@ static int sof_widget_load_mux(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_mux *mux; + int read_bytes; int ret; mux = kzalloc(sizeof(*mux), GFP_KERNEL); @@ -1646,7 +1701,7 @@ static int sof_widget_load_mux(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &mux->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse mux.cfg tokens failed %d\n", private->size); @@ -1679,6 +1734,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_volume *volume; struct snd_sof_control *scontrol; + int read_bytes; int min_step; int max_step; int ret; @@ -1704,7 +1760,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, volume, volume_tokens, ARRAY_SIZE(volume_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse volume tokens failed %d\n", private->size); @@ -1712,7 +1768,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, } ret = sof_parse_tokens(scomp, &volume->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse volume.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -1756,6 +1812,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_src *src; + int read_bytes; int ret; src = kzalloc(sizeof(*src), GFP_KERNEL); @@ -1772,7 +1829,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, src, src_tokens, ARRAY_SIZE(src_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse src tokens failed %d\n", private->size); @@ -1781,7 +1838,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &src->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse src.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -1815,6 +1872,7 @@ static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_asrc *asrc; + int read_bytes; int ret; asrc = kzalloc(sizeof(*asrc), GFP_KERNEL); @@ -1831,7 +1889,7 @@ static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, asrc, asrc_tokens, ARRAY_SIZE(asrc_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse asrc tokens failed %d\n", private->size); @@ -1840,7 +1898,7 @@ static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &asrc->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse asrc.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -1876,6 +1934,7 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index, struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_tone *tone; + int read_bytes; int ret; tone = kzalloc(sizeof(*tone), GFP_KERNEL); @@ -1892,7 +1951,7 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, tone, tone_tokens, ARRAY_SIZE(tone_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse tone tokens failed %d\n", le32_to_cpu(private->size)); @@ -1901,7 +1960,7 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &tone->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse tone.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -1995,6 +2054,61 @@ static int sof_get_control_data(struct snd_soc_component *scomp, return 0; } +/* + * Sof mux/demux component + */ +static int sof_process_load_mux(struct snd_soc_component *scomp, + struct sof_ipc_comp_process *process, + struct snd_soc_tplg_private *private, + int *bytes_written) +{ + struct sof_mux_config *mc = (struct sof_mux_config *)&process->data; + struct mux_stream_data *msd = (struct mux_stream_data *) + ((u8 *)process->data + sizeof(struct sof_mux_config)); + struct snd_soc_tplg_vendor_array *varray; + int read_bytes = 0; + int pos = 0; + int ret; + int i; + + /* parse mux config array */ + ret = sof_parse_tokens(scomp, mc, mux_tokens, + ARRAY_SIZE(mux_tokens), private->array, + le32_to_cpu(private->size), &read_bytes); + if (ret != 0) { + dev_err(scomp->dev, "error: parse mux tokens failed %d\n", + private->size); + return ret; + } + + /* parse mux stream config arrays */ + for (i = 0; i < mc->num_streams; i++, msd++) { + varray = (struct snd_soc_tplg_vendor_array *) + ((u8 *)private->array + pos); + ret = sof_parse_tokens(scomp, msd, mux_stream_tokens, + ARRAY_SIZE(mux_stream_tokens), + varray, + le32_to_cpu(private->size) - pos, + &read_bytes); + if (ret != 0) { + dev_err(scomp->dev, "error: mux stream tokens %d\n", + private->size); + return ret; + } + pos += read_bytes; + } + + /* get the channel byte masks after stream arrays */ + msd -= mc->num_streams; + for (i = 0; i < mc->num_streams; i++, msd++, pos += 8) + memcpy(&msd->mask[0], (u8 *)private->array + pos, 8); + + *bytes_written = sizeof(struct sof_mux_config) + + mc->num_streams * sizeof(struct mux_stream_data); + + return ret; +} + static int sof_process_load(struct snd_soc_component *scomp, int index, struct snd_sof_widget *swidget, struct snd_soc_tplg_dapm_widget *tw, @@ -2007,6 +2121,7 @@ static int sof_process_load(struct snd_soc_component *scomp, int index, struct sof_ipc_comp_process *process = NULL; struct sof_widget_data *wdata = NULL; size_t ipc_data_size = 0; + int read_bytes; size_t ipc_size; int offset = 0; int ret = 0; @@ -2061,7 +2176,7 @@ static int sof_process_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &process->config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse process.cfg tokens failed %d\n", le32_to_cpu(private->size)); @@ -2070,6 +2185,18 @@ static int sof_process_load(struct snd_soc_component *scomp, int index, sof_dbg_comp_config(scomp, &process->config); + /* possible tuplet parsing for process components */ + switch (type) { + case SOF_COMP_MUX: + case SOF_COMP_DEMUX: + ret = sof_process_load_mux(scomp, process, private, &offset); + if (ret < 0) { + dev_err(scomp->dev, "error: parse mux tokens failed %d\n", + le32_to_cpu(private->size)); + goto err; + } + } + /* * found private data in control, so copy it. * get possible component controls - get size of all pdata, @@ -2133,6 +2260,7 @@ static int sof_widget_load_process(struct snd_soc_component *scomp, int index, { struct snd_soc_tplg_private *private = &tw->priv; struct sof_ipc_comp_process config; + int read_bytes; int ret; /* check we have some tokens - we need at least process type */ @@ -2146,7 +2274,7 @@ static int sof_widget_load_process(struct snd_soc_component *scomp, int index, /* get the process token */ ret = sof_parse_tokens(scomp, &config, process_tokens, ARRAY_SIZE(process_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse process tokens failed %d\n", le32_to_cpu(private->size)); @@ -2445,6 +2573,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &pcm->priv; struct snd_sof_pcm *spcm; int stream = SNDRV_PCM_STREAM_PLAYBACK; + int read_bytes; int ret = 0; /* nothing to do for BEs atm */ @@ -2467,8 +2596,8 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, spcm, stream_tokens, ARRAY_SIZE(stream_tokens), private->array, - le32_to_cpu(private->size)); - if (ret) { + le32_to_cpu(private->size), &read_bytes); + if (ret != 0) { dev_err(scomp->dev, "error: parse stream tokens failed %d\n", le32_to_cpu(private->size)); return ret; @@ -2638,6 +2767,7 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &cfg->priv; struct sof_ipc_reply reply; u32 size = sizeof(*config); + int read_bytes; int ret; /* handle master/slave and inverted clocks */ @@ -2649,7 +2779,7 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &config->ssp, ssp_tokens, ARRAY_SIZE(ssp_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse ssp tokens failed %d\n", le32_to_cpu(private->size)); @@ -2715,6 +2845,7 @@ static int sof_link_sai_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &cfg->priv; struct sof_ipc_reply reply; u32 size = sizeof(*config); + int read_bytes; int ret; /* handle master/slave and inverted clocks */ @@ -2726,7 +2857,7 @@ static int sof_link_sai_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &config->sai, sai_tokens, ARRAY_SIZE(sai_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse sai tokens failed %d\n", le32_to_cpu(private->size)); @@ -2783,6 +2914,7 @@ static int sof_link_esai_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &cfg->priv; struct sof_ipc_reply reply; u32 size = sizeof(*config); + int read_bytes; int ret; /* handle master/slave and inverted clocks */ @@ -2794,7 +2926,7 @@ static int sof_link_esai_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &config->esai, esai_tokens, ARRAY_SIZE(esai_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse esai tokens failed %d\n", le32_to_cpu(private->size)); @@ -2853,6 +2985,7 @@ static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, struct sof_ipc_reply reply; struct sof_ipc_fw_ready *ready = &sdev->fw_ready; struct sof_ipc_fw_version *v = &ready->version; + int read_bytes; u32 size; int ret, j; @@ -2866,7 +2999,7 @@ static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, /* get DMIC tokens */ ret = sof_parse_tokens(scomp, &config->dmic, dmic_tokens, ARRAY_SIZE(dmic_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse dmic tokens failed %d\n", le32_to_cpu(private->size)); @@ -2901,7 +3034,7 @@ static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, /* get DMIC PDM tokens */ ret = sof_parse_tokens(scomp, &ipc_config->dmic.pdm[0], dmic_pdm_tokens, ARRAY_SIZE(dmic_pdm_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse dmic pdm tokens failed %d\n", le32_to_cpu(private->size)); @@ -3038,6 +3171,7 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_private *private = &cfg->priv; struct snd_soc_dai *dai; u32 size = sizeof(*config); + int read_bytes; int ret; /* init IPC */ @@ -3047,7 +3181,7 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, /* get any bespoke DAI tokens */ ret = sof_parse_tokens(scomp, config, hda_tokens, ARRAY_SIZE(hda_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse hda tokens failed %d\n", le32_to_cpu(private->size)); @@ -3112,6 +3246,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct sof_ipc_dai_config config; struct snd_soc_tplg_hw_config *hw_config; int num_hw_configs; + int read_bytes; int ret; int i = 0; @@ -3148,7 +3283,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, /* get any common DAI tokens */ ret = sof_parse_tokens(scomp, &config, dai_link_tokens, ARRAY_SIZE(dai_link_tokens), private->array, - le32_to_cpu(private->size)); + le32_to_cpu(private->size), &read_bytes); if (ret != 0) { dev_err(scomp->dev, "error: parse link tokens failed %d\n", le32_to_cpu(private->size));