Lines Matching defs:swidget
329 * @swidget: pointer to struct snd_sof_widget containing extended data
336 static void *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size,
341 size_t ext_size = sizeof(swidget->uuid);
344 if (!guid_is_null(&swidget->uuid))
354 comp->id = swidget->comp_id;
356 comp->core = swidget->core;
361 memcpy((u8 *)comp + *ipc_size, &swidget->uuid, ext_size);
377 static int sof_ipc3_widget_setup_comp_host(struct snd_sof_widget *swidget)
379 struct snd_soc_component *scomp = swidget->scomp;
384 host = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
387 swidget->private = host;
393 if (swidget->id == snd_soc_dapm_aif_out)
399 ret = sof_update_ipc_object(scomp, host, SOF_PCM_TOKENS, swidget->tuples,
400 swidget->num_tuples, sizeof(*host), 1);
405 ret = sof_update_ipc_object(scomp, &host->config, SOF_COMP_TOKENS, swidget->tuples,
406 swidget->num_tuples, sizeof(host->config), 1);
410 dev_dbg(scomp->dev, "loaded host %s\n", swidget->widget->name);
415 kfree(swidget->private);
416 swidget->private = NULL;
421 static void sof_ipc3_widget_free_comp(struct snd_sof_widget *swidget)
423 kfree(swidget->private);
426 static int sof_ipc3_widget_setup_comp_tone(struct snd_sof_widget *swidget)
428 struct snd_soc_component *scomp = swidget->scomp;
433 tone = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
437 swidget->private = tone;
444 ret = sof_update_ipc_object(scomp, &tone->config, SOF_COMP_TOKENS, swidget->tuples,
445 swidget->num_tuples, sizeof(tone->config), 1);
447 kfree(swidget->private);
448 swidget->private = NULL;
453 swidget->widget->name, tone->frequency, tone->amplitude);
459 static int sof_ipc3_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
461 struct snd_soc_component *scomp = swidget->scomp;
466 mixer = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
470 swidget->private = mixer;
478 swidget->tuples, swidget->num_tuples,
481 kfree(swidget->private);
482 swidget->private = NULL;
487 dev_dbg(scomp->dev, "loaded mixer %s\n", swidget->widget->name);
493 static int sof_ipc3_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
495 struct snd_soc_component *scomp = swidget->scomp;
496 struct snd_sof_pipeline *spipe = swidget->spipe;
508 pipeline->pipeline_id = swidget->pipeline_id;
509 pipeline->comp_id = swidget->comp_id;
511 swidget->private = pipeline;
514 comp_swidget = snd_sof_find_swidget(scomp, swidget->widget->sname);
517 swidget->widget->name, swidget->widget->sname);
525 ret = sof_update_ipc_object(scomp, pipeline, SOF_SCHED_TOKENS, swidget->tuples,
526 swidget->num_tuples, sizeof(*pipeline), 1);
531 ret = sof_update_ipc_object(scomp, swidget, SOF_PIPELINE_TOKENS, swidget->tuples,
532 swidget->num_tuples, sizeof(*swidget), 1);
540 swidget->dynamic_pipeline_widget =
544 swidget->widget->name, pipeline->period, pipeline->priority,
546 swidget->dynamic_pipeline_widget);
548 swidget->core = pipeline->core;
554 kfree(swidget->private);
555 swidget->private = NULL;
560 static int sof_ipc3_widget_setup_comp_buffer(struct snd_sof_widget *swidget)
562 struct snd_soc_component *scomp = swidget->scomp;
570 swidget->private = buffer;
575 buffer->comp.id = swidget->comp_id;
577 buffer->comp.pipeline_id = swidget->pipeline_id;
578 buffer->comp.core = swidget->core;
581 ret = sof_update_ipc_object(scomp, buffer, SOF_BUFFER_TOKENS, swidget->tuples,
582 swidget->num_tuples, sizeof(*buffer), 1);
584 kfree(swidget->private);
585 swidget->private = NULL;
590 swidget->widget->name, buffer->size, buffer->caps);
595 static int sof_ipc3_widget_setup_comp_src(struct snd_sof_widget *swidget)
597 struct snd_soc_component *scomp = swidget->scomp;
602 src = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
606 swidget->private = src;
613 ret = sof_update_ipc_object(scomp, src, SOF_SRC_TOKENS, swidget->tuples,
614 swidget->num_tuples, sizeof(*src), 1);
620 swidget->tuples, swidget->num_tuples, sizeof(src->config), 1);
625 swidget->widget->name, src->source_rate, src->sink_rate);
630 kfree(swidget->private);
631 swidget->private = NULL;
636 static int sof_ipc3_widget_setup_comp_asrc(struct snd_sof_widget *swidget)
638 struct snd_soc_component *scomp = swidget->scomp;
643 asrc = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
647 swidget->private = asrc;
654 ret = sof_update_ipc_object(scomp, asrc, SOF_ASRC_TOKENS, swidget->tuples,
655 swidget->num_tuples, sizeof(*asrc), 1);
661 swidget->tuples, swidget->num_tuples, sizeof(asrc->config), 1);
666 swidget->widget->name, asrc->source_rate, asrc->sink_rate,
673 kfree(swidget->private);
674 swidget->private = NULL;
682 static int sof_ipc3_widget_setup_comp_mux(struct snd_sof_widget *swidget)
684 struct snd_soc_component *scomp = swidget->scomp;
689 mux = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
693 swidget->private = mux;
701 swidget->tuples, swidget->num_tuples, sizeof(mux->config), 1);
703 kfree(swidget->private);
704 swidget->private = NULL;
708 dev_dbg(scomp->dev, "loaded mux %s\n", swidget->widget->name);
718 static int sof_ipc3_widget_setup_comp_pga(struct snd_sof_widget *swidget)
720 struct snd_soc_component *scomp = swidget->scomp;
728 volume = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
732 swidget->private = volume;
739 ret = sof_update_ipc_object(scomp, volume, SOF_VOLUME_TOKENS, swidget->tuples,
740 swidget->num_tuples, sizeof(*volume), 1);
746 swidget->tuples, swidget->num_tuples,
751 dev_dbg(scomp->dev, "loaded PGA %s\n", swidget->widget->name);
755 if (scontrol->comp_id == swidget->comp_id &&
768 kfree(swidget->private);
769 swidget->private = NULL;
857 struct snd_sof_widget *swidget, int type)
859 struct snd_soc_dapm_widget *widget = swidget->widget;
888 process = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
894 swidget->private = process;
902 swidget->tuples, swidget->num_tuples,
907 dev_dbg(scomp->dev, "loaded process %s\n", swidget->widget->name);
932 kfree(swidget->private);
933 swidget->private = NULL;
956 static int sof_widget_update_ipc_comp_process(struct snd_sof_widget *swidget)
958 struct snd_soc_component *scomp = swidget->scomp;
963 config.comp.core = swidget->core;
966 ret = sof_update_ipc_object(scomp, &config, SOF_PROCESS_TOKENS, swidget->tuples,
967 swidget->num_tuples, sizeof(config), 1);
972 return sof_process_load(scomp, swidget, find_process_comp_type(config.type));
1470 static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
1472 struct snd_soc_component *scomp = swidget->scomp;
1474 struct snd_sof_dai *dai = swidget->private;
1488 private->comp_dai = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
1500 ret = sof_update_ipc_object(scomp, comp_dai, SOF_DAI_TOKENS, swidget->tuples,
1501 swidget->num_tuples, sizeof(*comp_dai), 1);
1507 swidget->tuples, swidget->num_tuples,
1513 swidget->widget->name, comp_dai->type, comp_dai->dai_index);
1603 static void sof_ipc3_widget_free_comp_dai(struct snd_sof_widget *swidget)
1605 switch (swidget->id) {
1609 struct snd_sof_dai *dai = swidget->private;
1797 static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, int dir)
1799 struct snd_soc_component *scomp = swidget->scomp;
1807 spcm = snd_sof_find_spcm_name(scomp, swidget->widget->sname);
1809 dev_err(scomp->dev, "Cannot find PCM for %s\n", swidget->widget->name);
1819 pcm.comp_id = swidget->comp_id;
1847 swidget->widget->name);
1853 static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int cmd)
1855 struct snd_soc_component *scomp = swidget->scomp;
1863 stream.comp_id = swidget->comp_id;
1868 dev_err(scomp->dev, "%s: Failed to trigger %s\n", __func__, swidget->widget->name);
1876 struct snd_sof_widget *swidget = w->dobj.private;
1882 if (!swidget)
1885 scomp = swidget->scomp;
1891 spcm = snd_sof_find_spcm_name(scomp, swidget->widget->sname);
1894 swidget->widget->name);
1907 ret = sof_ipc3_keyword_detect_pcm_params(swidget, stream);
1910 __func__, swidget->widget->name);
1915 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_TRIG_START);
1918 swidget->widget->name);
1928 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_TRIG_STOP);
1931 swidget->widget->name);
1934 ret = sof_ipc3_keyword_detect_trigger(swidget, SOF_IPC_STREAM_PCM_FREE);
1937 swidget->widget->name);
1952 struct snd_sof_widget *swidget, u16 event_type)
1960 if (swidget->id != snd_soc_dapm_effect)
1963 ipc_comp = swidget->private;
1968 return snd_soc_tplg_widget_bind_event(swidget->widget, sof_kwd_events,
1975 swidget->widget->name);
1980 static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
1986 swidget->widget->name, swidget->comp_id);
1991 ready.comp_id = swidget->comp_id;
2000 static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
2007 .id = swidget->comp_id,
2011 if (!swidget->private)
2014 switch (swidget->id) {
2030 dev_err(sdev->dev, "failed to free widget %s\n", swidget->widget->name);
2035 static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
2039 struct snd_sof_dai *dai = swidget->private;
2045 dev_err(sdev->dev, "No private data for DAI %s\n", swidget->widget->name);
2117 if (swidget->use_count > 0) {
2129 static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
2133 if (!swidget->private)
2136 switch (swidget->id) {
2140 struct snd_sof_dai *dai = swidget->private;
2151 pipeline = swidget->private;
2159 hdr = swidget->private;
2160 ret = sof_ipc_tx_message_no_reply(sdev->ipc, swidget->private, hdr->size);
2165 dev_err(sdev->dev, "Failed to setup widget %s\n", swidget->widget->name);
2173 struct snd_sof_widget *swidget;
2178 list_for_each_entry(swidget, &sdev->widget_list, list) {
2180 if (!verify && swidget->dynamic_pipeline_widget)
2188 swidget->id == snd_soc_dapm_scheduler)
2192 if (WIDGET_IS_DAI(swidget->id)) {
2193 struct snd_sof_dai *dai = swidget->private;
2214 ret = sof_widget_setup(sdev, swidget);
2243 list_for_each_entry(swidget, &sdev->widget_list, list) {
2244 switch (swidget->id) {
2247 if (!verify && swidget->dynamic_pipeline_widget)
2251 ret = sof_widget_setup(sdev, swidget);
2256 swidget->spipe->complete = sof_ipc3_complete_pipeline(sdev, swidget);
2257 if (swidget->spipe->complete < 0)
2258 return swidget->spipe->complete;
2274 struct snd_sof_widget *swidget;
2302 list_for_each_entry(swidget, &sdev->widget_list, list)
2303 if (WIDGET_IS_DAI(swidget->id) && swidget->use_count == 1) {
2304 ret = sof_widget_free(sdev, swidget);
2316 struct snd_sof_widget *swidget;
2319 list_for_each_entry(swidget, &sdev->widget_list, list) {
2320 if (swidget->dynamic_pipeline_widget) {
2326 if (!verify && !swidget->dynamic_pipeline_widget &&
2328 mutex_lock(&swidget->setup_mutex);
2329 swidget->use_count = 0;
2330 mutex_unlock(&swidget->setup_mutex);
2331 if (swidget->spipe)
2332 swidget->spipe->complete = 0;
2336 if (include_scheduler && swidget->id != snd_soc_dapm_scheduler)
2339 if (!include_scheduler && swidget->id == snd_soc_dapm_scheduler)
2342 ret = sof_widget_free(sdev, swidget);
2357 struct snd_sof_widget *swidget;
2364 * first boot. In both cases, there is no need to protect swidget->use_count and
2402 list_for_each_entry(swidget, &sdev->widget_list, list) {
2403 if (swidget->use_count != 0) {
2405 __func__, swidget->widget->name, swidget->use_count);