@@ -212,6 +212,39 @@ static void sof_ipc3_widget_free_comp(struct snd_sof_widget *swidget)
kfree(swidget->private);
}
+static int sof_ipc3_widget_setup_comp_tone(struct snd_sof_widget *swidget)
+{
+ struct snd_soc_component *scomp = swidget->scomp;
+ struct sof_ipc_comp_tone *tone;
+ size_t ipc_size = sizeof(*tone);
+ int ret;
+
+ tone = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
+ if (!tone)
+ return -ENOMEM;
+
+ swidget->private = tone;
+
+ /* configure siggen IPC message */
+ tone->comp.type = SOF_COMP_TONE;
+ tone->config.hdr.size = sizeof(tone->config);
+
+ /* parse one set of comp tokens */
+ ret = sof_update_ipc_object(scomp, &tone->config, SOF_COMP_TOKENS, swidget->tuples,
+ swidget->num_tuples, sizeof(tone->config), 1);
+ if (ret < 0) {
+ kfree(swidget->private);
+ swidget->private = NULL;
+ return ret;
+ }
+
+ dev_dbg(scomp->dev, "tone %s: frequency %d amplitude %d\n",
+ swidget->widget->name, tone->frequency, tone->amplitude);
+ sof_dbg_comp_config(scomp, &tone->config);
+
+ return 0;
+}
+
static int sof_ipc3_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
{
struct snd_soc_component *scomp = swidget->scomp;
@@ -585,6 +618,9 @@ static const struct sof_ipc_tplg_widget_ops tplg_ipc3_widget_ops[SND_SOC_DAPM_TY
src_token_list, ARRAY_SIZE(src_token_list), NULL},
[snd_soc_dapm_asrc] = {sof_ipc3_widget_setup_comp_asrc, sof_ipc3_widget_free_comp,
asrc_token_list, ARRAY_SIZE(asrc_token_list), NULL},
+ [snd_soc_dapm_siggen] = {sof_ipc3_widget_setup_comp_tone, sof_ipc3_widget_free_comp,
+ comp_generic_token_list, ARRAY_SIZE(comp_generic_token_list),
+ NULL},
[snd_soc_dapm_scheduler] = {sof_ipc3_widget_setup_comp_pipeline, sof_ipc3_widget_free_comp,
pipeline_token_list, ARRAY_SIZE(pipeline_token_list), NULL},
[snd_soc_dapm_pga] = {sof_ipc3_widget_setup_comp_pga, sof_ipc3_widget_free_comp,
@@ -629,10 +629,6 @@ static const struct sof_topology_token dai_link_tokens[] = {
offsetof(struct sof_ipc_dai_config, dai_index)},
};
-/* Tone */
-static const struct sof_topology_token tone_tokens[] = {
-};
-
/* EFFECT */
static const struct sof_topology_token process_tokens[] = {
{SOF_TKN_PROCESS_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING,
@@ -1770,58 +1766,6 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s
return ret;
}
-/*
- * Signal Generator Topology
- */
-
-static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index,
- struct snd_sof_widget *swidget,
- struct snd_soc_tplg_dapm_widget *tw)
-{
- struct snd_soc_tplg_private *private = &tw->priv;
- struct sof_ipc_comp_tone *tone;
- size_t ipc_size = sizeof(*tone);
- int ret;
-
- tone = (struct sof_ipc_comp_tone *)
- sof_comp_alloc(swidget, &ipc_size, index);
- if (!tone)
- return -ENOMEM;
-
- /* configure siggen IPC message */
- tone->comp.type = SOF_COMP_TONE;
- tone->config.hdr.size = sizeof(tone->config);
-
- ret = sof_parse_tokens(scomp, tone, tone_tokens,
- ARRAY_SIZE(tone_tokens), private->array,
- le32_to_cpu(private->size));
- if (ret != 0) {
- dev_err(scomp->dev, "error: parse tone tokens failed %d\n",
- le32_to_cpu(private->size));
- goto err;
- }
-
- ret = sof_parse_tokens(scomp, &tone->config, comp_tokens,
- ARRAY_SIZE(comp_tokens), private->array,
- le32_to_cpu(private->size));
- if (ret != 0) {
- dev_err(scomp->dev, "error: parse tone.cfg tokens failed %d\n",
- le32_to_cpu(private->size));
- goto err;
- }
-
- dev_dbg(scomp->dev, "tone %s: frequency %d amplitude %d\n",
- swidget->widget->name, tone->frequency, tone->amplitude);
- sof_dbg_comp_config(scomp, &tone->config);
-
- swidget->private = tone;
-
- return 0;
-err:
- kfree(tone);
- return ret;
-}
-
static int sof_get_control_data(struct snd_soc_component *scomp,
struct snd_soc_dapm_widget *widget,
struct sof_widget_data *wdata,
@@ -2152,13 +2096,11 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
case snd_soc_dapm_aif_in:
case snd_soc_dapm_src:
case snd_soc_dapm_asrc:
+ case snd_soc_dapm_siggen:
case snd_soc_dapm_mux:
case snd_soc_dapm_demux:
ret = sof_widget_parse_tokens(scomp, swidget, tw, token_list, token_list_size);
break;
- case snd_soc_dapm_siggen:
- ret = sof_widget_load_siggen(scomp, index, swidget, tw);
- break;
case snd_soc_dapm_effect:
ret = sof_widget_load_process(scomp, index, swidget, tw);
break;