Lines Matching full:entity

35 static bool exported_control(struct sdca_entity *entity, struct sdca_control *control)  in exported_control()  argument
37 switch (SDCA_CTL_TYPE(entity->type, control->sel)) { in exported_control()
84 struct sdca_entity *entity = &function->entities[i]; in sdca_asoc_count_component() local
87 switch (entity->type) { in sdca_asoc_count_component()
90 *num_routes += !!entity->iot.clock; in sdca_asoc_count_component()
91 *num_routes += !!entity->iot.is_dataport; in sdca_asoc_count_component()
92 *num_controls += !entity->iot.is_dataport; in sdca_asoc_count_component()
93 *num_dais += !!entity->iot.is_dataport; in sdca_asoc_count_component()
96 *num_routes += entity->pde.num_managed; in sdca_asoc_count_component()
102 if (entity->group) in sdca_asoc_count_component()
105 /* Add primary entity connections from DisCo */ in sdca_asoc_count_component()
106 *num_routes += entity->num_sources; in sdca_asoc_count_component()
108 for (j = 0; j < entity->num_controls; j++) { in sdca_asoc_count_component()
109 if (exported_control(entity, &entity->controls[j])) in sdca_asoc_count_component()
164 struct sdca_entity *entity) in entity_early_parse_ge() argument
175 control = sdca_selector_find_control(dev, entity, SDCA_CTL_GE_SELECTED_MODE); in entity_early_parse_ge()
181 entity->label, control->layers); in entity_early_parse_ge()
183 range = sdca_control_find_range(dev, entity, control, SDCA_SELECTED_MODE_NCOLS, 0); in entity_early_parse_ge()
188 entity->label, control->label); in entity_early_parse_ge()
223 entity->label, type); in entity_early_parse_ge()
228 soc_enum->reg = SDW_SDCA_CTL(function->desc->adr, entity->id, control->sel, 0); in entity_early_parse_ge()
241 entity->ge.kctl = kctl; in entity_early_parse_ge()
257 struct sdca_entity *entity, in entity_parse_simple() argument
267 for (i = 0; i < entity->num_sources; i++) in entity_parse_simple()
268 add_route(route, entity->label, NULL, entity->sources[i]->label); in entity_parse_simple()
275 struct sdca_entity *entity, in entity_parse_it() argument
281 if (entity->iot.is_dataport) { in entity_parse_it()
283 entity->label, "Playback"); in entity_parse_it()
289 add_route(route, entity->label, NULL, aif_name); in entity_parse_it()
294 if (entity->iot.clock) in entity_parse_it()
295 add_route(route, entity->label, NULL, entity->iot.clock->label); in entity_parse_it()
297 for (i = 0; i < entity->num_sources; i++) in entity_parse_it()
298 add_route(route, entity->label, NULL, entity->sources[i]->label); in entity_parse_it()
307 struct sdca_entity *entity, in entity_parse_ot() argument
313 if (entity->iot.is_dataport) { in entity_parse_ot()
315 entity->label, "Capture"); in entity_parse_ot()
321 add_route(route, aif_name, NULL, entity->label); in entity_parse_ot()
326 if (entity->iot.clock) in entity_parse_ot()
327 add_route(route, entity->label, NULL, entity->iot.clock->label); in entity_parse_ot()
329 for (i = 0; i < entity->num_sources; i++) in entity_parse_ot()
330 add_route(route, entity->label, NULL, entity->sources[i]->label); in entity_parse_ot()
341 struct sdca_entity *entity = widget->priv; in entity_pde_event() local
364 for (i = 0; i < entity->pde.num_max_delay; i++) { in entity_pde_event()
365 struct sdca_pde_delay *delay = &entity->pde.max_delay[i]; in entity_pde_event()
389 entity->label, val); in entity_pde_event()
395 struct sdca_entity *entity, in entity_parse_pde() argument
405 control = sdca_selector_find_control(dev, entity, SDCA_CTL_PDE_REQUESTED_PS); in entity_parse_pde()
412 entity->label, control->layers); in entity_parse_pde()
414 range = sdca_control_find_range(dev, entity, control, SDCA_REQUESTED_PS_NCOLS, 0); in entity_parse_pde()
422 dev_err(dev, "%s: power control missing states\n", entity->label); in entity_parse_pde()
427 (*widget)->reg = SDW_SDCA_CTL(function->desc->adr, entity->id, control->sel, 0); in entity_parse_pde()
433 (*widget)->priv = entity; in entity_parse_pde()
436 for (i = 0; i < entity->pde.num_managed; i++) in entity_parse_pde()
437 add_route(route, entity->pde.managed[i]->label, NULL, entity->label); in entity_parse_pde()
439 for (i = 0; i < entity->num_sources; i++) in entity_parse_pde()
440 add_route(route, entity->label, NULL, entity->sources[i]->label); in entity_parse_pde()
445 /* Device selector units are controlled through a group entity */
448 struct sdca_entity *entity, in entity_parse_su_device() argument
456 if (!entity->group) { in entity_parse_su_device()
457 dev_err(dev, "%s: device selector unit missing group\n", entity->label); in entity_parse_su_device()
461 range = sdca_selector_find_range(dev, entity->group, SDCA_CTL_GE_SELECTED_MODE, in entity_parse_su_device()
467 (*widget)->kcontrol_news = entity->group->ge.kctl; in entity_parse_su_device()
471 for (i = 0; i < entity->group->ge.num_modes; i++) { in entity_parse_su_device()
472 struct sdca_ge_mode *mode = &entity->group->ge.modes[i]; in entity_parse_su_device()
478 if (affected->id != entity->id || in entity_parse_su_device()
483 if (affected->val - 1 >= entity->num_sources) { in entity_parse_su_device()
485 entity->label, affected->val); in entity_parse_su_device()
489 if (++num_routes > entity->num_sources) { in entity_parse_su_device()
490 dev_err(dev, "%s: too many input routes\n", entity->label); in entity_parse_su_device()
498 entity->label, mode->val); in entity_parse_su_device()
502 add_route(route, entity->label, get_terminal_name(term), in entity_parse_su_device()
503 entity->sources[affected->val - 1]->label); in entity_parse_su_device()
513 struct sdca_entity *entity, in entity_parse_su_class() argument
531 texts = devm_kcalloc(dev, entity->num_sources + 1, sizeof(*texts), GFP_KERNEL); in entity_parse_su_class()
536 for (i = 0; i < entity->num_sources; i++) in entity_parse_su_class()
537 texts[i + 1] = entity->sources[i]->label; in entity_parse_su_class()
539 soc_enum->reg = SDW_SDCA_CTL(function->desc->adr, entity->id, control->sel, 0); in entity_parse_su_class()
540 soc_enum->items = entity->num_sources + 1; in entity_parse_su_class()
556 for (i = 0; i < entity->num_sources; i++) in entity_parse_su_class()
557 add_route(route, entity->label, texts[i + 1], entity->sources[i]->label); in entity_parse_su_class()
564 struct sdca_entity *entity, in entity_parse_su() argument
570 if (!entity->num_sources) { in entity_parse_su()
571 dev_err(dev, "%s: selector with no inputs\n", entity->label); in entity_parse_su()
575 control = sdca_selector_find_control(dev, entity, SDCA_CTL_SU_SELECTOR); in entity_parse_su()
580 return entity_parse_su_device(dev, function, entity, widget, route); in entity_parse_su()
584 entity->label, control->layers); in entity_parse_su()
586 return entity_parse_su_class(dev, function, entity, control, widget, route); in entity_parse_su()
591 struct sdca_entity *entity, in entity_parse_mu() argument
599 if (!entity->num_sources) { in entity_parse_mu()
600 dev_err(dev, "%s: selector 1 or more inputs\n", entity->label); in entity_parse_mu()
604 control = sdca_selector_find_control(dev, entity, SDCA_CTL_MU_MIXER); in entity_parse_mu()
611 entity->label, control->layers); in entity_parse_mu()
613 kctl = devm_kcalloc(dev, entity->num_sources, sizeof(*kctl), GFP_KERNEL); in entity_parse_mu()
617 for (i = 0; i < entity->num_sources; i++) { in entity_parse_mu()
646 (*widget)->num_kcontrols = entity->num_sources; in entity_parse_mu()
649 for (i = 0; i < entity->num_sources; i++) in entity_parse_mu()
650 add_route(route, entity->label, kctl[i].name, entity->sources[i]->label); in entity_parse_mu()
659 struct sdca_entity *entity = widget->priv; in entity_cs_event() local
664 if (entity->cs.max_delay) in entity_cs_event()
665 fsleep(entity->cs.max_delay); in entity_cs_event()
672 struct sdca_entity *entity, in entity_parse_cs() argument
682 (*widget)->priv = entity; in entity_parse_cs()
685 for (i = 0; i < entity->num_sources; i++) in entity_parse_cs()
686 add_route(route, entity->label, NULL, entity->sources[i]->label); in entity_parse_cs()
713 struct sdca_entity *entity = &function->entities[i]; in sdca_asoc_populate_dapm() local
719 switch (entity->type) { in sdca_asoc_populate_dapm()
721 ret = entity_early_parse_ge(dev, function, entity); in sdca_asoc_populate_dapm()
731 struct sdca_entity *entity = &function->entities[i]; in sdca_asoc_populate_dapm() local
733 widget->name = entity->label; in sdca_asoc_populate_dapm()
736 switch (entity->type) { in sdca_asoc_populate_dapm()
738 ret = entity_parse_it(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
741 ret = entity_parse_ot(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
744 ret = entity_parse_pde(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
747 ret = entity_parse_su(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
750 ret = entity_parse_mu(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
753 ret = entity_parse_cs(dev, function, entity, &widget, &route); in sdca_asoc_populate_dapm()
761 entity->label); in sdca_asoc_populate_dapm()
762 ret = entity_parse_simple(dev, function, entity, &widget, in sdca_asoc_populate_dapm()
766 ret = entity_parse_simple(dev, function, entity, &widget, in sdca_asoc_populate_dapm()
770 ret = entity_parse_simple(dev, function, entity, &widget, in sdca_asoc_populate_dapm()
774 ret = entity_parse_simple(dev, function, entity, &widget, in sdca_asoc_populate_dapm()
781 if (entity->group) in sdca_asoc_populate_dapm()
782 add_route(&route, entity->label, NULL, entity->group->label); in sdca_asoc_populate_dapm()
790 struct sdca_entity *entity, in control_limit_kctl() argument
806 range = sdca_control_find_range(dev, entity, control, SDCA_VOLUME_LINEAR_NCOLS, 1); in control_limit_kctl()
823 entity->label, control->label); in control_limit_kctl()
857 struct sdca_entity *entity, in populate_control() argument
868 if (!exported_control(entity, control)) in populate_control()
874 control_name = devm_kasprintf(dev, GFP_KERNEL, "%s %s%s", entity->label, in populate_control()
887 mc->reg = SDW_SDCA_CTL(function->desc->adr, entity->id, in populate_control()
892 mc->rreg = SDW_SDCA_CTL(function->desc->adr, entity->id, in populate_control()
897 entity->label, control->label); in populate_control()
917 ret = control_limit_kctl(dev, entity, control, *kctl); in populate_control()
927 struct sdca_entity *entity, in populate_pin_switch() argument
932 control_name = devm_kasprintf(dev, GFP_KERNEL, "%s Switch", entity->label); in populate_pin_switch()
937 (*kctl)->private_value = (unsigned long)entity->label; in populate_pin_switch()
968 struct sdca_entity *entity = &function->entities[i]; in sdca_asoc_populate_controls() local
970 switch (entity->type) { in sdca_asoc_populate_controls()
973 if (!entity->iot.is_dataport) { in sdca_asoc_populate_controls()
974 ret = populate_pin_switch(dev, entity, &kctl); in sdca_asoc_populate_controls()
983 for (j = 0; j < entity->num_controls; j++) { in sdca_asoc_populate_controls()
984 ret = populate_control(dev, function, entity, in sdca_asoc_populate_controls()
985 &entity->controls[j], &kctl); in sdca_asoc_populate_controls()
1069 struct sdca_entity *entity, in populate_rate_format() argument
1079 switch (entity->type) { in populate_rate_format()
1087 dev_err(dev, "%s: entity type has no usage control\n", in populate_rate_format()
1088 entity->label); in populate_rate_format()
1092 if (entity->iot.clock) { in populate_rate_format()
1093 range = sdca_selector_find_range(dev, entity->iot.clock, in populate_rate_format()
1107 range = sdca_selector_find_range(dev, entity, sel, SDCA_USAGE_NCOLS, 0); in populate_rate_format()
1151 struct sdca_entity *entity = &function->entities[i]; in sdca_asoc_populate_dais() local
1155 switch (entity->type) { in sdca_asoc_populate_dais()
1169 if (!entity->iot.is_dataport) in sdca_asoc_populate_dais()
1173 entity->label, stream_suffix); in sdca_asoc_populate_dais()
1180 ret = populate_rate_format(dev, function, entity, stream); in sdca_asoc_populate_dais()
1185 dais[j].name = entity->label; in sdca_asoc_populate_dais()
1291 struct sdca_entity *entity = &function->entities[dai->id]; in sdca_asoc_set_constraints() local
1301 if (entity->type != SDCA_ENTITY_TYPE_IT) in sdca_asoc_set_constraints()
1304 control = sdca_selector_find_control(dev, entity, SDCA_CTL_IT_CLUSTERINDEX); in sdca_asoc_set_constraints()
1308 range = sdca_control_find_range(dev, entity, control, SDCA_CLUSTER_NCOLS, 0); in sdca_asoc_set_constraints()
1324 entity->label, channel_mask); in sdca_asoc_set_constraints()
1338 dev_err(dev, "%s: failed to add constraint: %d\n", entity->label, ret); in sdca_asoc_set_constraints()
1381 struct sdca_entity *entity = &function->entities[dai->id]; in sdca_asoc_get_port() local
1387 switch (entity->type) { in sdca_asoc_get_port()
1398 if (sel < 0 || !entity->iot.is_dataport) { in sdca_asoc_get_port()
1400 entity->label); in sdca_asoc_get_port()
1404 range = sdca_selector_find_range(dev, entity, sel, SDCA_DATAPORT_SELECTOR_NCOLS, in sdca_asoc_get_port()
1409 reg = SDW_SDCA_CTL(function->desc->adr, entity->id, sel, 0); in sdca_asoc_get_port()
1414 entity->label, ret); in sdca_asoc_get_port()
1434 dev_err(dev, "%s: no dataport found\n", entity->label); in sdca_asoc_get_port()
1441 struct sdca_entity *entity, unsigned int channels) in set_cluster() argument
1447 range = sdca_selector_find_range(dev, entity, sel, SDCA_CLUSTER_NCOLS, 0); in set_cluster()
1462 entity->id, sel, 0); in set_cluster()
1467 entity->label, ret); in set_cluster()
1472 entity->label, index, channels); in set_cluster()
1478 dev_err(dev, "%s: no cluster for %d channels\n", entity->label, channels); in set_cluster()
1484 struct sdca_entity *entity, int target_rate) in set_clock() argument
1490 range = sdca_selector_find_range(dev, entity, sel, SDCA_SAMPLERATEINDEX_NCOLS, 0); in set_clock()
1502 entity->id, sel, 0); in set_clock()
1507 entity->label, ret); in set_clock()
1512 entity->label, index, rate); in set_clock()
1518 dev_err(dev, "%s: no clock rate for %dHz\n", entity->label, target_rate); in set_clock()
1524 struct sdca_entity *entity, int sel, in set_usage() argument
1530 range = sdca_selector_find_range(dev, entity, sel, SDCA_USAGE_NCOLS, 0); in set_usage()
1541 entity->id, sel, 0); in set_usage()
1546 entity->label, ret); in set_usage()
1551 entity->label, usage, target_rate, target_width); in set_usage()
1558 entity->label, target_rate, target_width); in set_usage()
1581 struct sdca_entity *entity = &function->entities[dai->id]; in sdca_asoc_hw_params() local
1588 switch (entity->type) { in sdca_asoc_hw_params()
1590 ret = set_cluster(dev, regmap, function, entity, channels); in sdca_asoc_hw_params()
1600 dev_err(dev, "%s: hw_params on non-terminal entity\n", entity->label); in sdca_asoc_hw_params()
1604 if (entity->iot.clock) { in sdca_asoc_hw_params()
1605 ret = set_clock(dev, regmap, function, entity->iot.clock, rate); in sdca_asoc_hw_params()
1610 ret = set_usage(dev, regmap, function, entity, usage_sel, rate, width); in sdca_asoc_hw_params()