Lines Matching refs:mgr
61 snd_use_case_mgr_t *mgr; member
67 static inline const char *uc_verb(struct cras_use_case_mgr *mgr) in uc_verb() argument
69 return use_case_verbs[mgr->use_case]; in uc_verb()
72 static int device_enabled(struct cras_use_case_mgr *mgr, const char *dev) in device_enabled() argument
79 num_devs = snd_use_case_get_list(mgr->mgr, "_enadevs", &list); in device_enabled()
93 static int modifier_enabled(struct cras_use_case_mgr *mgr, const char *mod) in modifier_enabled() argument
99 num_mods = snd_use_case_get_list(mgr->mgr, "_enamods", &list); in modifier_enabled()
111 static int get_var(struct cras_use_case_mgr *mgr, const char *var, in get_var() argument
122 rc = snd_use_case_get(mgr->mgr, id, value); in get_var()
128 static int get_int(struct cras_use_case_mgr *mgr, const char *var, in get_int() argument
136 rc = get_var(mgr, var, dev, verb, &str_value); in get_int()
144 static int ucm_set_modifier_enabled(struct cras_use_case_mgr *mgr, in ucm_set_modifier_enabled() argument
147 return snd_use_case_set(mgr->mgr, enable ? "_enamod" : "_dismod", mod); in ucm_set_modifier_enabled()
161 static int ucm_section_exists_with_name(struct cras_use_case_mgr *mgr, in ucm_section_exists_with_name() argument
169 num_entries = snd_use_case_get_list(mgr->mgr, identifier, &list); in ucm_section_exists_with_name()
187 static int ucm_section_exists_with_suffix(struct cras_use_case_mgr *mgr, in ucm_section_exists_with_suffix() argument
195 num_entries = snd_use_case_get_list(mgr->mgr, identifier, &list); in ucm_section_exists_with_suffix()
213 static int ucm_mod_exists_with_suffix(struct cras_use_case_mgr *mgr, in ucm_mod_exists_with_suffix() argument
219 identifier = snd_use_case_identifier("_modifiers/%s", uc_verb(mgr)); in ucm_mod_exists_with_suffix()
220 rc = ucm_section_exists_with_suffix(mgr, suffix, identifier); in ucm_mod_exists_with_suffix()
225 static int ucm_mod_exists_with_name(struct cras_use_case_mgr *mgr, in ucm_mod_exists_with_name() argument
231 identifier = snd_use_case_identifier("_modifiers/%s", uc_verb(mgr)); in ucm_mod_exists_with_name()
232 rc = ucm_section_exists_with_name(mgr, name, identifier); in ucm_mod_exists_with_name()
239 struct cras_use_case_mgr *mgr, in ucm_get_sections_for_var() argument
250 num_entries = snd_use_case_get_list(mgr->mgr, identifier, &list); in ucm_get_sections_for_var()
262 rc = get_var(mgr, var, list[i], uc_verb(mgr), &this_value); in ucm_get_sections_for_var()
287 struct cras_use_case_mgr *mgr, in ucm_get_devices_for_var() argument
294 identifier = snd_use_case_identifier("_devices/%s", uc_verb(mgr)); in ucm_get_devices_for_var()
295 section_names = ucm_get_sections_for_var(mgr, var, value, identifier, in ucm_get_devices_for_var()
302 struct cras_use_case_mgr *mgr, const char *dev) in ucm_get_playback_device_name_for_dev() argument
307 rc = get_var(mgr, playback_device_name_var, dev, uc_verb(mgr), &name); in ucm_get_playback_device_name_for_dev()
315 struct cras_use_case_mgr *mgr, const char *dev) in ucm_get_capture_device_name_for_dev() argument
320 rc = get_var(mgr, capture_device_name_var, dev, uc_verb(mgr), &name); in ucm_get_capture_device_name_for_dev()
330 static struct mixer_name *ucm_get_mixer_names(struct cras_use_case_mgr *mgr, in ucm_get_mixer_names() argument
340 rc = get_var(mgr, var, dev, uc_verb(mgr), &names_in_string); in ucm_get_mixer_names()
359 struct cras_use_case_mgr *mgr; in ucm_create() local
367 mgr = (struct cras_use_case_mgr *)malloc(sizeof(*mgr)); in ucm_create()
368 if (!mgr) in ucm_create()
371 rc = snd_use_case_mgr_open(&mgr->mgr, name); in ucm_create()
378 mgr->name = name; in ucm_create()
379 mgr->avail_use_cases = 0; in ucm_create()
380 num_verbs = snd_use_case_get_list(mgr->mgr, "_verbs", &list); in ucm_create()
387 mgr->avail_use_cases |= (1 << j); in ucm_create()
392 rc = ucm_set_use_case(mgr, CRAS_STREAM_TYPE_DEFAULT); in ucm_create()
396 return mgr; in ucm_create()
399 snd_use_case_mgr_close(mgr->mgr); in ucm_create()
401 free(mgr); in ucm_create()
405 void ucm_destroy(struct cras_use_case_mgr *mgr) in ucm_destroy() argument
407 snd_use_case_mgr_close(mgr->mgr); in ucm_destroy()
408 free(mgr); in ucm_destroy()
411 int ucm_set_use_case(struct cras_use_case_mgr *mgr, in ucm_set_use_case() argument
416 if (mgr->avail_use_cases & (1 << use_case)) { in ucm_set_use_case()
417 mgr->use_case = use_case; in ucm_set_use_case()
420 use_case, mgr->name); in ucm_set_use_case()
424 rc = snd_use_case_set(mgr->mgr, "_verb", uc_verb(mgr)); in ucm_set_use_case()
427 uc_verb(mgr), mgr->name, rc); in ucm_set_use_case()
434 int ucm_swap_mode_exists(struct cras_use_case_mgr *mgr) in ucm_swap_mode_exists() argument
436 return ucm_mod_exists_with_suffix(mgr, swap_mode_suffix); in ucm_swap_mode_exists()
439 int ucm_enable_swap_mode(struct cras_use_case_mgr *mgr, const char *node_name, in ucm_enable_swap_mode() argument
449 if (!ucm_mod_exists_with_name(mgr, swap_mod)) { in ucm_enable_swap_mode()
454 if (modifier_enabled(mgr, swap_mod) == !!enable) { in ucm_enable_swap_mode()
458 rc = ucm_set_modifier_enabled(mgr, swap_mod, enable); in ucm_enable_swap_mode()
463 int ucm_set_enabled(struct cras_use_case_mgr *mgr, const char *dev, int enable) in ucm_set_enabled() argument
465 if (device_enabled(mgr, dev) == !!enable) in ucm_set_enabled()
468 return snd_use_case_set(mgr->mgr, enable ? "_enadev" : "_disdev", dev); in ucm_set_enabled()
471 char *ucm_get_flag(struct cras_use_case_mgr *mgr, const char *flag_name) in ucm_get_flag() argument
478 rc = get_var(mgr, flag_name, "", uc_verb(mgr), &value); in ucm_get_flag()
487 char *ucm_get_cap_control(struct cras_use_case_mgr *mgr, const char *ucm_dev) in ucm_get_cap_control() argument
493 rc = get_var(mgr, cap_var, ucm_dev, uc_verb(mgr), &value); in ucm_get_cap_control()
502 char *ucm_get_mic_positions(struct cras_use_case_mgr *mgr) in ucm_get_mic_positions() argument
508 rc = get_var(mgr, mic_positions, "", uc_verb(mgr), &value); in ucm_get_mic_positions()
517 const char *ucm_get_override_type_name(struct cras_use_case_mgr *mgr, in ucm_get_override_type_name() argument
523 rc = get_var(mgr, override_type_name_var, dev, uc_verb(mgr), in ucm_get_override_type_name()
531 char *ucm_get_dev_for_jack(struct cras_use_case_mgr *mgr, const char *jack, in ucm_get_dev_for_jack() argument
537 section_names = ucm_get_devices_for_var(mgr, jack_var, jack, direction); in ucm_get_dev_for_jack()
562 char *ucm_get_dev_for_mixer(struct cras_use_case_mgr *mgr, const char *mixer, in ucm_get_dev_for_mixer() argument
568 section_names = ucm_get_devices_for_var(mgr, mixer_var, mixer, dir); in ucm_get_dev_for_mixer()
582 const char *ucm_get_edid_file_for_dev(struct cras_use_case_mgr *mgr, in ucm_get_edid_file_for_dev() argument
588 rc = get_var(mgr, edid_var, dev, uc_verb(mgr), &file_name); in ucm_get_edid_file_for_dev()
595 const char *ucm_get_dsp_name(struct cras_use_case_mgr *mgr, const char *ucm_dev, in ucm_get_dsp_name() argument
604 rc = get_var(mgr, var, ucm_dev, uc_verb(mgr), &dsp_name); in ucm_get_dsp_name()
611 const char *ucm_get_dsp_name_default(struct cras_use_case_mgr *mgr, in ucm_get_dsp_name_default() argument
614 return ucm_get_dsp_name(mgr, "", direction); in ucm_get_dsp_name_default()
617 unsigned int ucm_get_min_buffer_level(struct cras_use_case_mgr *mgr) in ucm_get_min_buffer_level() argument
622 rc = get_int(mgr, min_buffer_level_var, "", uc_verb(mgr), &value); in ucm_get_min_buffer_level()
629 unsigned int ucm_get_disable_software_volume(struct cras_use_case_mgr *mgr) in ucm_get_disable_software_volume() argument
634 rc = get_int(mgr, disable_software_volume, "", uc_verb(mgr), &value); in ucm_get_disable_software_volume()
641 int ucm_get_max_software_gain(struct cras_use_case_mgr *mgr, const char *dev, in ucm_get_max_software_gain() argument
647 rc = get_int(mgr, max_software_gain, dev, uc_verb(mgr), &value); in ucm_get_max_software_gain()
654 int ucm_get_default_node_gain(struct cras_use_case_mgr *mgr, const char *dev, in ucm_get_default_node_gain() argument
660 rc = get_int(mgr, default_node_gain, dev, uc_verb(mgr), &value); in ucm_get_default_node_gain()
668 struct cras_use_case_mgr *mgr, const char *dev, in ucm_get_device_name_for_dev() argument
672 return ucm_get_playback_device_name_for_dev(mgr, dev); in ucm_get_device_name_for_dev()
674 return ucm_get_capture_device_name_for_dev(mgr, dev); in ucm_get_device_name_for_dev()
678 int ucm_get_sample_rate_for_dev(struct cras_use_case_mgr *mgr, const char *dev, in ucm_get_sample_rate_for_dev() argument
692 rc = get_int(mgr, var_name, dev, uc_verb(mgr), &value); in ucm_get_sample_rate_for_dev()
699 int ucm_get_capture_chmap_for_dev(struct cras_use_case_mgr *mgr, in ucm_get_capture_chmap_for_dev() argument
707 rc = get_var(mgr, capture_channel_map_var, dev, uc_verb(mgr), &var_str); in ucm_get_capture_chmap_for_dev()
724 struct cras_use_case_mgr *mgr, const char *dev) in ucm_get_coupled_mixer_names() argument
726 return ucm_get_mixer_names(mgr, dev, coupled_mixers, in ucm_get_coupled_mixer_names()
746 struct ucm_section *ucm_get_sections(struct cras_use_case_mgr *mgr) in ucm_get_sections() argument
757 identifier = snd_use_case_identifier("_devices/%s", uc_verb(mgr)); in ucm_get_sections()
758 num_devs = snd_use_case_get_list(mgr->mgr, identifier, &list); in ucm_get_sections()
778 ucm_get_playback_device_name_for_dev(mgr, dev_name); in ucm_get_sections()
784 mgr, dev_name); in ucm_get_sections()
809 jack_name = ucm_get_jack_name_for_dev(mgr, dev_name); in ucm_get_sections()
810 jack_type = ucm_get_jack_type_for_dev(mgr, dev_name); in ucm_get_sections()
811 mixer_name = ucm_get_mixer_name_for_dev(mgr, dev_name); in ucm_get_sections()
828 ucm_get_jack_switch_for_dev(mgr, dev_name); in ucm_get_sections()
837 m_name = ucm_get_mixer_names(mgr, dev_name, coupled_mixers, in ucm_get_sections()
856 char *ucm_get_hotword_models(struct cras_use_case_mgr *mgr) in ucm_get_hotword_models() argument
865 identifier = snd_use_case_identifier("_modifiers/%s", uc_verb(mgr)); in ucm_get_hotword_models()
866 num_entries = snd_use_case_get_list(mgr->mgr, identifier, &list); in ucm_get_hotword_models()
892 int ucm_set_hotword_model(struct cras_use_case_mgr *mgr, const char *model) in ucm_set_hotword_model() argument
904 if (!ucm_mod_exists_with_name(mgr, model_mod)) { in ucm_set_hotword_model()
910 num_enmods = snd_use_case_get_list(mgr->mgr, "_enamods", &list); in ucm_set_hotword_model()
917 ucm_set_modifier_enabled(mgr, list[mod_idx], 0); in ucm_set_hotword_model()
922 ucm_set_modifier_enabled(mgr, model_mod, 1); in ucm_set_hotword_model()
927 int ucm_has_fully_specified_ucm_flag(struct cras_use_case_mgr *mgr) in ucm_has_fully_specified_ucm_flag() argument
931 flag = ucm_get_flag(mgr, fully_specified_ucm_var); in ucm_has_fully_specified_ucm_flag()
939 const char *ucm_get_mixer_name_for_dev(struct cras_use_case_mgr *mgr, const char *dev) in ucm_get_mixer_name_for_dev() argument
944 rc = get_var(mgr, mixer_var, dev, uc_verb(mgr), &name); in ucm_get_mixer_name_for_dev()
951 struct mixer_name *ucm_get_main_volume_names(struct cras_use_case_mgr *mgr) in ucm_get_main_volume_names() argument
953 return ucm_get_mixer_names(mgr, "", main_volume_names, in ucm_get_main_volume_names()
958 struct cras_use_case_mgr *mgr, in ucm_list_section_devices_by_device_name() argument
976 identifier = snd_use_case_identifier("_devices/%s", uc_verb(mgr)); in ucm_list_section_devices_by_device_name()
978 mgr, var, device_name, identifier, direction); in ucm_list_section_devices_by_device_name()
996 const char *ucm_get_jack_name_for_dev(struct cras_use_case_mgr *mgr, in ucm_get_jack_name_for_dev() argument
1002 rc = get_var(mgr, jack_var, dev, uc_verb(mgr), &name); in ucm_get_jack_name_for_dev()
1009 const char *ucm_get_jack_type_for_dev(struct cras_use_case_mgr *mgr, in ucm_get_jack_type_for_dev() argument
1015 rc = get_var(mgr, jack_type_var, dev, uc_verb(mgr), &name); in ucm_get_jack_type_for_dev()
1026 int ucm_get_jack_switch_for_dev(struct cras_use_case_mgr *mgr, const char *dev) in ucm_get_jack_switch_for_dev() argument
1030 int rc = get_int(mgr, jack_switch_var, dev, uc_verb(mgr), &value); in ucm_get_jack_switch_for_dev()
1036 unsigned int ucm_get_dma_period_for_dev(struct cras_use_case_mgr *mgr, in ucm_get_dma_period_for_dev() argument
1041 int rc = get_int(mgr, dma_period_var, dev, uc_verb(mgr), &value); in ucm_get_dma_period_for_dev()
1047 unsigned int ucm_get_enable_htimestamp_flag(struct cras_use_case_mgr *mgr) in ucm_get_enable_htimestamp_flag() argument
1051 flag = ucm_get_flag(mgr, enable_htimestamp_var); in ucm_get_enable_htimestamp_flag()