Lines Matching defs:swidget
355 * @swidget: pointer to struct snd_sof_widget containing extended data
362 static void *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size,
367 size_t ext_size = sizeof(swidget->uuid);
370 if (!guid_is_null(&swidget->uuid))
380 comp->id = swidget->comp_id;
382 comp->core = swidget->core;
387 memcpy((u8 *)comp + *ipc_size, &swidget->uuid, ext_size);
403 static int sof_ipc3_widget_setup_comp_host(struct snd_sof_widget *swidget)
405 struct snd_soc_component *scomp = swidget->scomp;
410 host = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
413 swidget->private = host;
419 if (swidget->id == snd_soc_dapm_aif_out)
425 ret = sof_update_ipc_object(scomp, host, SOF_PCM_TOKENS, swidget->tuples,
426 swidget->num_tuples, sizeof(*host), 1);
431 ret = sof_update_ipc_object(scomp, &host->config, SOF_COMP_TOKENS, swidget->tuples,
432 swidget->num_tuples, sizeof(host->config), 1);
436 dev_dbg(scomp->dev, "loaded host %s\n", swidget->widget->name);
441 kfree(swidget->private);
442 swidget->private = NULL;
447 static void sof_ipc3_widget_free_comp(struct snd_sof_widget *swidget)
449 kfree(swidget->private);
452 static int sof_ipc3_widget_setup_comp_tone(struct snd_sof_widget *swidget)
454 struct snd_soc_component *scomp = swidget->scomp;
459 tone = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
463 swidget->private = tone;
470 ret = sof_update_ipc_object(scomp, &tone->config, SOF_COMP_TOKENS, swidget->tuples,
471 swidget->num_tuples, sizeof(tone->config), 1);
473 kfree(swidget->private);
474 swidget->private = NULL;
479 swidget->widget->name, tone->frequency, tone->amplitude);
485 static int sof_ipc3_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
487 struct snd_soc_component *scomp = swidget->scomp;
492 mixer = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
496 swidget->private = mixer;
504 swidget->tuples, swidget->num_tuples,
507 kfree(swidget->private);
508 swidget->private = NULL;
513 dev_dbg(scomp->dev, "loaded mixer %s\n", swidget->widget->name);
519 static int sof_ipc3_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
521 struct snd_soc_component *scomp = swidget->scomp;
522 struct snd_sof_pipeline *spipe = swidget->spipe;
534 pipeline->pipeline_id = swidget->pipeline_id;
535 pipeline->comp_id = swidget->comp_id;
537 swidget->private = pipeline;
540 comp_swidget = snd_sof_find_swidget(scomp, swidget->widget->sname);
543 swidget->widget->name, swidget->widget->sname);
551 ret = sof_update_ipc_object(scomp, pipeline, SOF_SCHED_TOKENS, swidget->tuples,
552 swidget->num_tuples, sizeof(*pipeline), 1);
557 ret = sof_update_ipc_object(scomp, swidget, SOF_PIPELINE_TOKENS, swidget->tuples,
558 swidget->num_tuples, sizeof(*swidget), 1);
566 swidget->dynamic_pipeline_widget =
570 swidget->widget->name, pipeline->period, pipeline->priority,
572 swidget->dynamic_pipeline_widget);
574 swidget->core = pipeline->core;
580 kfree(swidget->private);
581 swidget->private = NULL;
586 static int sof_ipc3_widget_setup_comp_buffer(struct snd_sof_widget *swidget)
588 struct snd_soc_component *scomp = swidget->scomp;
596 swidget->private = buffer;
601 buffer->comp.id = swidget->comp_id;
603 buffer->comp.pipeline_id = swidget->pipeline_id;
604 buffer->comp.core = swidget->core;
607 ret = sof_update_ipc_object(scomp, buffer, SOF_BUFFER_TOKENS, swidget->tuples,
608 swidget->num_tuples, sizeof(*buffer), 1);
610 kfree(swidget->private);
611 swidget->private = NULL;
616 swidget->widget->name, buffer->size, buffer->caps);
621 static int sof_ipc3_widget_setup_comp_src(struct snd_sof_widget *swidget)
623 struct snd_soc_component *scomp = swidget->scomp;
628 src = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
632 swidget->private = src;
639 ret = sof_update_ipc_object(scomp, src, SOF_SRC_TOKENS, swidget->tuples,
640 swidget->num_tuples, sizeof(*src), 1);
646 swidget->tuples, swidget->num_tuples, sizeof(src->config), 1);
651 swidget->widget->name, src->source_rate, src->sink_rate);
656 kfree(swidget->private);
657 swidget->private = NULL;
662 static int sof_ipc3_widget_setup_comp_asrc(struct snd_sof_widget *swidget)
664 struct snd_soc_component *scomp = swidget->scomp;
669 asrc = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
673 swidget->private = asrc;
680 ret = sof_update_ipc_object(scomp, asrc, SOF_ASRC_TOKENS, swidget->tuples,
681 swidget->num_tuples, sizeof(*asrc), 1);
687 swidget->tuples, swidget->num_tuples, sizeof(asrc->config), 1);
692 swidget->widget->name, asrc->source_rate, asrc->sink_rate,
699 kfree(swidget->private);
700 swidget->private = NULL;
708 static int sof_ipc3_widget_setup_comp_mux(struct snd_sof_widget *swidget)
710 struct snd_soc_component *scomp = swidget->scomp;
715 mux = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
719 swidget->private = mux;
727 swidget->tuples, swidget->num_tuples, sizeof(mux->config), 1);
729 kfree(swidget->private);
730 swidget->private = NULL;
734 dev_dbg(scomp->dev, "loaded mux %s\n", swidget->widget->name);
744 static int sof_ipc3_widget_setup_comp_pga(struct snd_sof_widget *swidget)
746 struct snd_soc_component *scomp = swidget->scomp;
754 volume = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
758 swidget->private = volume;
765 ret = sof_update_ipc_object(scomp, volume, SOF_VOLUME_TOKENS, swidget->tuples,
766 swidget->num_tuples, sizeof(*volume), 1);
772 swidget->tuples, swidget->num_tuples,
777 dev_dbg(scomp->dev, "loaded PGA %s\n", swidget->widget->name);
781 if (scontrol->comp_id == swidget->comp_id &&
794 kfree(swidget->private);
795 swidget->private = NULL;
883 struct snd_sof_widget *swidget, int type)
885 struct snd_soc_dapm_widget *widget = swidget->widget;
914 process = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
920 swidget->private = process;
928 swidget->tuples, swidget->num_tuples,
933 dev_dbg(scomp->dev, "loaded process %s\n", swidget->widget->name);
958 kfree(swidget->private);
959 swidget->private = NULL;
982 static int sof_widget_update_ipc_comp_process(struct snd_sof_widget *swidget)
984 struct snd_soc_component *scomp = swidget->scomp;
989 config.comp.core = swidget->core;
992 ret = sof_update_ipc_object(scomp, &config, SOF_PROCESS_TOKENS, swidget->tuples,
993 swidget->num_tuples, sizeof(config), 1);
998 return sof_process_load(scomp, swidget, find_process_comp_type(config.type));
1558 static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
1560 struct snd_soc_component *scomp = swidget->scomp;
1562 struct snd_sof_dai *dai = swidget->private;
1576 private->comp_dai = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
1588 ret = sof_update_ipc_object(scomp, comp_dai, SOF_DAI_TOKENS, swidget->tuples,
1589 swidget->num_tuples, sizeof(*comp_dai), 1);
1595 swidget->tuples, swidget->num_tuples,
1613 swidget->widget->name, comp_dai->type, comp_dai->dai_index);
1709 static void sof_ipc3_widget_free_comp_dai(struct snd_sof_widget *swidget)
1711 switch (swidget->id) {
1715 struct snd_sof_dai *dai = swidget->private;
1903 static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, int dir)
1905 struct snd_soc_component *scomp = swidget->scomp;
1913 spcm = snd_sof_find_spcm_name(scomp, swidget->widget->sname);
1915 dev_err(scomp->dev, "Cannot find PCM for %s\n", swidget->widget->name);
1925 pcm.comp_id = swidget->comp_id;
1953 swidget->widget->name);
1959 static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int cmd)
1961 struct snd_soc_component *scomp = swidget->scomp;
1969 stream.comp_id = swidget->comp_id;
1974 dev_err(scomp->dev, "%s: Failed to trigger %s\n", __func__, swidget->widget->name);
1982 struct snd_sof_widget *swidget = w->dobj.private;
1988 if (!swidget)
1991 scomp = swidget->scomp;
1997 spcm = snd_sof_find_spcm_name(scomp, swidget->widget->sname);
2000 swidget->widget->name);
2013 ret = sof_ipc3_keyword_detect_pcm_params(swidget, stream);
2016 __func__, swidget->widget->name);
2021 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_TRIG_START);
2024 swidget->widget->name);
2034 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_TRIG_STOP);
2037 swidget->widget->name);
2040 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_PCM_FREE);
2043 swidget->widget->name);
2058 struct snd_sof_widget *swidget, u16 event_type)
2066 if (swidget->id != snd_soc_dapm_effect)
2069 ipc_comp = swidget->private;
2074 return snd_soc_tplg_widget_bind_event(swidget->widget, sof_kwd_events,
2081 swidget->widget->name);
2086 static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
2092 swidget->widget->name, swidget->comp_id);
2097 ready.comp_id = swidget->comp_id;
2106 static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
2113 .id = swidget->comp_id,
2117 if (!swidget->private)
2120 switch (swidget->id) {
2136 dev_err(sdev->dev, "failed to free widget %s\n", swidget->widget->name);
2141 static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
2145 struct snd_sof_dai *dai = swidget->private;
2151 dev_err(sdev->dev, "No private data for DAI %s\n", swidget->widget->name);
2231 if (swidget->use_count > 0) {
2243 static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
2247 if (!swidget->private)
2250 switch (swidget->id) {
2254 struct snd_sof_dai *dai = swidget->private;
2265 pipeline = swidget->private;
2273 hdr = swidget->private;
2274 ret = sof_ipc_tx_message_no_reply(sdev->ipc, swidget->private, hdr->size);
2279 dev_err(sdev->dev, "Failed to setup widget %s\n", swidget->widget->name);
2287 struct snd_sof_widget *swidget;
2292 list_for_each_entry(swidget, &sdev->widget_list, list) {
2294 if (!verify && swidget->dynamic_pipeline_widget)
2302 swidget->id == snd_soc_dapm_scheduler)
2306 if (WIDGET_IS_DAI(swidget->id)) {
2307 struct snd_sof_dai *dai = swidget->private;
2328 ret = sof_widget_setup(sdev, swidget);
2357 list_for_each_entry(swidget, &sdev->widget_list, list) {
2358 switch (swidget->id) {
2361 if (!verify && swidget->dynamic_pipeline_widget)
2365 ret = sof_widget_setup(sdev, swidget);
2370 swidget->spipe->complete = sof_ipc3_complete_pipeline(sdev, swidget);
2371 if (swidget->spipe->complete < 0)
2372 return swidget->spipe->complete;
2388 struct snd_sof_widget *swidget;
2404 list_for_each_entry(swidget, &sdev->widget_list, list)
2405 if (WIDGET_IS_DAI(swidget->id) && swidget->use_count == 1) {
2406 ret = sof_widget_free(sdev, swidget);
2418 struct snd_sof_widget *swidget;
2421 list_for_each_entry(swidget, &sdev->widget_list, list) {
2422 if (swidget->dynamic_pipeline_widget) {
2428 if (!verify && !swidget->dynamic_pipeline_widget &&
2430 mutex_lock(&swidget->setup_mutex);
2431 swidget->use_count = 0;
2432 mutex_unlock(&swidget->setup_mutex);
2433 if (swidget->spipe)
2434 swidget->spipe->complete = 0;
2438 if (include_scheduler && swidget->id != snd_soc_dapm_scheduler)
2441 if (!include_scheduler && swidget->id == snd_soc_dapm_scheduler)
2444 ret = sof_widget_free(sdev, swidget);
2459 struct snd_sof_widget *swidget;
2466 * first boot. In both cases, there is no need to protect swidget->use_count and
2504 list_for_each_entry(swidget, &sdev->widget_list, list) {
2505 if (swidget->use_count != 0) {
2507 __func__, swidget->widget->name, swidget->use_count);