Home | History | Annotate | Download | only in libalsa-intf

Lines Matching defs:uc_mgr

100  * uc_mgr - UCM structure pointer or  NULL for card list
105 int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
117 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
118 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) ||
119 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL)) {
121 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
126 while(strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
129 uc_mgr->card_ctxt_ptr->verb_list[index]);
132 *list = (char ***)uc_mgr->card_ctxt_ptr->verb_list;
133 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
136 if (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
139 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
142 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
143 while(strncmp(uc_mgr->card_ctxt_ptr->current_verb,
157 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
160 if (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
163 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
166 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
167 while(strncmp(uc_mgr->card_ctxt_ptr->current_verb,
181 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
184 if (uc_mgr->device_list_count) {
185 for (index = 0; index < uc_mgr->device_list_count; index++) {
186 free(uc_mgr->current_device_list[index]);
187 uc_mgr->current_device_list[index] = NULL;
189 free(uc_mgr->current_device_list);
190 uc_mgr->current_device_list = NULL;
191 uc_mgr->device_list_count = 0;
194 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
195 uc_mgr->device_list_count = list_size;
197 uc_mgr->current_device_list =
199 if (uc_mgr->current_device_list == NULL) {
201 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
205 uc_mgr->current_device_list[index] =
206 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
210 *list = (const char **)uc_mgr->current_device_list;
211 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
214 if (uc_mgr->modifier_list_count) {
215 for (index = 0; index < uc_mgr->modifier_list_count; index++) {
216 free(uc_mgr->current_modifier_list[index]);
217 uc_mgr->current_modifier_list[index] = NULL;
219 free(uc_mgr->current_modifier_list);
220 uc_mgr->current_modifier_list = NULL;
221 uc_mgr->modifier_list_count = 0;
224 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
225 uc_mgr->modifier_list_count = list_size;
227 uc_mgr->current_modifier_list =
229 if (uc_mgr->current_modifier_list == NULL) {
231 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
235 uc_mgr->current_modifier_list[index] =
236 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->mod_list_head,
240 *list = (const char **)uc_mgr->current_modifier_list;
241 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
245 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
263 int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
272 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
273 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) ||
274 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL)) {
276 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
281 if (uc_mgr->card_ctxt_ptr->card_name != NULL) {
282 *value = strdup(uc_mgr->card_ctxt_ptr->card_name);
286 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
291 if (uc_mgr->card_ctxt_ptr->current_verb != NULL) {
292 *value = strdup(uc_mgr->card_ctxt_ptr->current_verb);
296 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
310 verb_index = uc_mgr->card_ctxt_ptr->current_verb_index;
311 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
312 if((get_usecase_type(uc_mgr, ident2)) == CTRL_LIST_VERB) {
318 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
321 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
322 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
366 if(uc_mgr->card_ctxt_ptr->control_device != NULL) {
367 *value = strdup(uc_mgr->card_ctxt_ptr->control_device);
376 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
378 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
382 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
383 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
412 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
414 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
418 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
419 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
451 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
457 * uc_mgr - UCM structure
463 int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
470 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
471 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) ||
472 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL)) {
474 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
488 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
491 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
511 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
514 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->mod_list_head,
534 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
538 static int check_devices_for_voice_call(snd_use_case_mgr_t *uc_mgr,
554 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
557 snd_ucm_get_device_node(uc_mgr->card_ctxt_ptr->dev_list_head,
578 static int snd_use_case_apply_voice_acdb(snd_use_case_mgr_t *uc_mgr,
586 if ((!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
588 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
595 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
598 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->mod_list_head,
615 verb_index = uc_mgr->card_ctxt_ptr->current_verb_index;
617 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
620 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
625 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
627 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
630 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
669 if ((rx_id != uc_mgr->current_rx_device) ||
670 (tx_id != uc_mgr->current_tx_device)) {
671 uc_mgr->current_rx_device = rx_id;
672 uc_mgr->current_tx_device = tx_id;
674 uc_mgr->current_rx_device,
675 uc_mgr->current_tx_device);
676 if (uc_mgr->acdb_handle && !uc_mgr->isFusion3Platform) {
677 acdb_send_voice_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_voice_cal");
681 acdb_send_voice_cal(uc_mgr->current_rx_device,
682 uc_mgr->current_tx_device);
687 rx id %d tx id %d", uc_mgr->current_rx_device,
688 uc_mgr->current_tx_device);
696 uc_mgr->current_rx_device = -1; uc_mgr->current_tx_device = -1;
702 int get_use_case_index(snd_use_case_mgr_t *uc_mgr, const char *use_case,
709 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
710 verb_index = uc_mgr->card_ctxt_ptr->current_verb_index;
713 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].verb_ctrls;
716 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
719 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].mod_ctrls;
724 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb, SND_UCM_END_OF_LIST, 3)) ||
727 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
751 * uc_mgr - UCM structure pointer
755 int snd_use_case_apply_mixer_controls(snd_use_case_mgr_t *uc_mgr,
763 verb_index = uc_mgr->card_ctxt_ptr->current_verb_index;
766 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].verb_ctrls;
769 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
772 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].mod_ctrls;
777 (!strncmp(uc_mgr->card_ctxt_ptr->current_verb, SND_UCM_END_OF_LIST, 3)) ||
780 uc_mgr->card_ctxt_ptr->current_verb, verb_index);
787 if (!uc_mgr->card_ctxt_ptr->mixer_handle) {
792 (check_devices_for_voice_call(uc_mgr, use_case) != NULL))
797 if (snd_use_case_apply_voice_acdb(uc_mgr, uc_index)) {
801 if (uc_mgr->acdb_handle) {
802 acdb_send_audio_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_audio_cal");
825 ctl = mixer_get_control(uc_mgr->card_ctxt_ptr->mixer_handle,
854 uc_mgr->card_ctxt_ptr->mixer_handle,
952 * uc_mgr - UCM structure pointer
957 static int set_controls_of_usecase_for_all_devices(snd_use_case_mgr_t *uc_mgr,
966 if ((verb_index = uc_mgr->card_ctxt_ptr->current_verb_index) < 0)
969 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
972 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].verb_ctrls;
975 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].mod_ctrls;
980 list_size = snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
983 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head, index);
985 uc_index = get_use_case_index(uc_mgr, current_device,
996 uc_mgr->card_ctxt_ptr->dev_list_head, current_device)) {
1000 ret = snd_use_case_apply_mixer_controls(uc_mgr,
1004 uc_mgr->card_ctxt_ptr->dev_list_head,
1008 snd_use_case_apply_voice_acdb(uc_mgr, uc_index);
1015 get_use_case_index(uc_mgr, use_case, ctrl_list_type)) < 0) {
1021 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case,
1031 if ((uc_index = get_use_case_index(uc_mgr, ident, ctrl_list_type)) < 0) {
1036 snd_use_case_apply_mixer_controls(uc_mgr, ident, enable,
1045 * uc_mgr - UCM structure pointer
1051 static int set_controls_of_usecase_for_device(snd_use_case_mgr_t *uc_mgr,
1061 if ((verb_index = uc_mgr->card_ctxt_ptr->current_verb_index) < 0)
1064 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
1067 dev_index = get_use_case_index(uc_mgr, device, CTRL_LIST_DEVICE);
1070 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1071 ret = snd_use_case_apply_mixer_controls(uc_mgr, device,
1075 uc_mgr->card_ctxt_ptr->dev_list_head, device, enable,
1082 if ((uc_index = get_use_case_index(uc_mgr, use_case, ctrl_list_type)) < 0) {
1084 uc_index = get_use_case_index(uc_mgr, ident, ctrl_list_type);
1085 if (snd_use_case_apply_mixer_controls(uc_mgr, ident, enable,
1091 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case, enable,
1095 uc_index = get_use_case_index(uc_mgr, ident, ctrl_list_type);
1096 if (snd_use_case_apply_mixer_controls(uc_mgr, ident, enable,
1106 * uc_mgr - UCM structure pointer
1111 static int set_controls_of_device_for_all_usecases(snd_use_case_mgr_t *uc_mgr,
1120 if ((verb_index = uc_mgr->card_ctxt_ptr->current_verb_index) < 0)
1123 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
1124 dev_index = get_use_case_index(uc_mgr, device, CTRL_LIST_DEVICE);
1127 if (strncmp(uc_mgr->card_ctxt_ptr->current_verb, SND_USE_CASE_VERB_INACTIVE,
1130 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].verb_ctrls;
1132 capability == getUseCaseType(uc_mgr->card_ctxt_ptr->current_verb) ||
1133 getUseCaseType(uc_mgr->card_ctxt_ptr->current_verb) == CAP_VOICE) {
1134 strlcpy(use_case, uc_mgr->card_ctxt_ptr->current_verb,
1138 get_use_case_index(uc_mgr, use_case, CTRL_LIST_VERB)) < 0) {
1144 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1145 ret = snd_use_case_apply_mixer_controls(uc_mgr, device,
1149 uc_mgr->card_ctxt_ptr->dev_list_head, device,
1155 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case,
1165 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1166 ret = snd_use_case_apply_mixer_controls(uc_mgr,
1170 uc_mgr->card_ctxt_ptr->dev_list_head, device, enable,
1176 strlcpy(use_case, uc_mgr->card_ctxt_ptr->current_verb,
1178 uc_index = get_use_case_index(uc_mgr, use_case, CTRL_LIST_VERB);
1181 getUseCaseType(uc_mgr->card_ctxt_ptr->current_verb) ||
1182 getUseCaseType(uc_mgr->card_ctxt_ptr->current_verb) ==
1185 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case,
1195 snd_ucm_print_list(uc_mgr->card_ctxt_ptr->mod_list_head);
1197 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].mod_ctrls;
1198 list_size = snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
1201 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->mod_list_head,
1208 if ((uc_index = get_use_case_index(uc_mgr, use_case,
1215 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1216 ret = snd_use_case_apply_mixer_controls(uc_mgr,
1221 uc_mgr->card_ctxt_ptr->dev_list_head,
1227 ret = snd_use_case_apply_mixer_controls(uc_mgr,
1237 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1238 ret = snd_use_case_apply_mixer_controls(uc_mgr,
1242 uc_mgr->card_ctxt_ptr->dev_list_head, device,
1250 get_use_case_index(uc_mgr, ident_value, CTRL_LIST_MODIFIER);
1255 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case,
1268 ret = snd_use_case_apply_mixer_controls(uc_mgr, device, enable,
1271 snd_ucm_set_status_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1278 * uc_mgr - UCM structure pointer
1282 static int get_usecase_type(snd_use_case_mgr_t *uc_mgr, const char *usecase)
1286 while (strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1288 if (!strncmp(uc_mgr->card_ctxt_ptr->verb_list[index], usecase,
1302 * uc_mgr - UCM structure pointer
1308 static int set_controls_of_device_for_usecase(snd_use_case_mgr_t *uc_mgr,
1317 if ((verb_index = uc_mgr->card_ctxt_ptr->current_verb_index) < 0)
1320 uc_mgr->card_ctxt_ptr->use_case_verb_list[verb_index].device_ctrls;
1321 dev_index = get_use_case_index(uc_mgr, device, CTRL_LIST_DEVICE);
1326 if ((uc_index = get_use_case_index(uc_mgr, use_case,
1327 get_usecase_type(uc_mgr, usecase))) < 0) {
1332 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1333 ret = snd_use_case_apply_mixer_controls(uc_mgr, device,
1337 (uc_mgr->card_ctxt_ptr->dev_list_head, device, enable,
1342 ret = snd_use_case_apply_mixer_controls(uc_mgr, use_case, enable,
1343 get_usecase_type(uc_mgr, usecase), uc_index);
1352 uc_mgr->card_ctxt_ptr->dev_list_head, device)) {
1353 ret = snd_use_case_apply_mixer_controls(uc_mgr, device, enable,
1357 uc_mgr->card_ctxt_ptr->dev_list_head, device, enable,
1363 ret = snd_use_case_apply_mixer_controls(uc_mgr, device, enable,
1366 snd_ucm_set_status_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1374 * uc_mgr - UCM structure
1380 int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
1388 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
1389 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) || (value == NULL) ||
1390 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL) ||
1393 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1397 ALOGD("snd_use_case_set(): uc_mgr %p identifier %s value %s", uc_mgr,
1410 &uc_mgr->card_ctxt_ptr->dev_list_head, ident2);
1418 ret = set_controls_of_device_for_all_usecases(uc_mgr,
1426 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1427 ret = snd_use_case_set(uc_mgr, "_enadev", value);
1434 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1439 ret = snd_use_case_set(uc_mgr, "_dismod", ident2);
1445 ret = snd_use_case_set(uc_mgr, "_enamod", value);
1459 while (strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1461 if (!strncmp(uc_mgr->card_ctxt_ptr->verb_list[index], value,
1473 uc_mgr->card_ctxt_ptr->verb_list[index]);
1476 if (strncmp(uc_mgr->card_ctxt_ptr->current_verb,
1479 ret = set_controls_of_usecase_for_all_devices(uc_mgr,
1480 uc_mgr->card_ctxt_ptr->current_verb, 0, CTRL_LIST_VERB);
1483 uc_mgr->card_ctxt_ptr->current_verb);
1485 strlcpy(uc_mgr->card_ctxt_ptr->current_verb, value, MAX_STR_LEN);
1488 if (strncmp(uc_mgr->card_ctxt_ptr->current_verb,
1491 uc_mgr->card_ctxt_ptr->current_verb_index = index;
1492 ret = set_controls_of_usecase_for_all_devices(uc_mgr,
1493 uc_mgr->card_ctxt_ptr->current_verb, 1, CTRL_LIST_VERB);
1499 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1502 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1515 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1518 snd_ucm_print_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1520 ret = set_controls_of_device_for_all_usecases(uc_mgr, value, 1);
1522 ret = snd_ucm_get_status_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1529 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1536 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1542 index = get_use_case_index(uc_mgr, value, CTRL_LIST_DEVICE);
1544 ret = snd_use_case_apply_mixer_controls(uc_mgr, value, 0,
1550 verb_index = uc_mgr->card_ctxt_ptr->current_verb_index;
1555 uc_mgr->card_ctxt_ptr->verb_list[verb_index]);
1556 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
1569 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->mod_list_head,
1573 ret = set_controls_of_usecase_for_all_devices(uc_mgr, value, 1,
1578 ret = snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->mod_list_head,
1586 ret = set_controls_of_usecase_for_all_devices(uc_mgr, value, 0,
1592 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1598 * uc_mgr - UCM structure
1605 int snd_use_case_set_case(snd_use_case_mgr_t *uc_mgr,
1613 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
1614 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) || (value == NULL) ||
1615 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL) ||
1618 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1622 ALOGD("snd_use_case_set_case(): uc_mgr %p identifier %s value %s",
1623 uc_mgr, identifier, value);
1635 &uc_mgr->card_ctxt_ptr->dev_list_head, ident2);
1643 ret = set_controls_of_device_for_usecase(uc_mgr, ident2,
1651 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1652 ret = snd_use_case_set_case(uc_mgr, "_enadev", value, usecase);
1659 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1664 ret = snd_use_case_set_case(uc_mgr, "_dismod", ident2, usecase);
1670 ret = snd_use_case_set_case(uc_mgr, "_enamod", value, usecase);
1684 while (strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1686 if (!strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1698 uc_mgr->card_ctxt_ptr->verb_list[index]);
1701 if (strncmp(uc_mgr->card_ctxt_ptr->current_verb,
1703 ret = set_controls_of_usecase_for_device(uc_mgr,
1704 uc_mgr->card_ctxt_ptr->current_verb, usecase,
1708 uc_mgr->card_ctxt_ptr->current_verb);
1710 strlcpy(uc_mgr->card_ctxt_ptr->current_verb, value, MAX_STR_LEN);
1713 if (strncmp(uc_mgr->card_ctxt_ptr->current_verb,
1715 uc_mgr->card_ctxt_ptr->current_verb_index = index;
1718 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1721 uc_mgr->card_ctxt_ptr->dev_list_head, index))) {
1733 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1736 ret = set_controls_of_usecase_for_device(uc_mgr,
1737 uc_mgr->card_ctxt_ptr->current_verb, usecase,
1744 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1747 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1759 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1762 snd_ucm_print_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1764 ret = set_controls_of_device_for_usecase(uc_mgr, value, usecase, 1);
1766 ret = snd_ucm_get_status_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
1773 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1780 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1787 ret = set_controls_of_device_for_usecase(uc_mgr, value,
1792 if (!strncmp(uc_mgr->card_ctxt_ptr->current_verb,
1798 while(strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1799 uc_mgr->card_ctxt_ptr->current_verb, MAX_STR_LEN)) {
1800 if (!strncmp(uc_mgr->card_ctxt_ptr->verb_list[index],
1812 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
1814 uc_mgr->card_ctxt_ptr->verb_list[verb_index]);
1829 snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
1832 uc_mgr->card_ctxt_ptr->dev_list_head, index))) {
1844 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
1847 snd_ucm_add_ident_to_list(&uc_mgr->card_ctxt_ptr->mod_list_head,
1851 ret = set_controls_of_usecase_for_device(uc_mgr, value,
1856 ret = snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->mod_list_head,
1864 ret = set_controls_of_usecase_for_device(uc_mgr, value, usecase,
1870 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
1876 * uc_mgr - Returned use case manager pointer
1880 int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name)
1974 *uc_mgr = uc_mgr_ptr;
1983 * \param uc_mgr Use case manager
1986 int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr) {
1993 * \param uc_mgr Use case manager
1996 int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr)
2000 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) ||
2001 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL)) {
2006 ALOGV("snd_use_case_close(): instance %p", uc_mgr);
2007 ret = snd_use_case_mgr_reset(uc_mgr);
2010 snd_ucm_free_mixer_list(&uc_mgr);
2011 pthread_mutexattr_destroy(&uc_mgr->card_ctxt_ptr->card_lock_attr);
2012 pthread_mutex_destroy(&uc_mgr->card_ctxt_ptr->card_lock);
2013 if (uc_mgr->card_ctxt_ptr->mixer_handle) {
2014 mixer_close(uc_mgr->card_ctxt_ptr->mixer_handle);
2015 uc_mgr->card_ctxt_ptr->mixer_handle = NULL;
2017 uc_mgr->snd_card_index = -1;
2018 uc_mgr->current_tx_device = -1;
2019 uc_mgr->current_rx_device = -1;
2020 free(uc_mgr->card_ctxt_ptr->control_device);
2021 free(uc_mgr->card_ctxt_ptr->card_name);
2022 free(uc_mgr->card_ctxt_ptr);
2023 uc_mgr->card_ctxt_ptr = NULL;
2024 free(uc_mgr);
2025 uc_mgr = NULL;
2032 * \param uc_mgr Use case manager
2035 int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr)
2040 ALOGV("snd_use_case_reset(): instance %p", uc_mgr);
2041 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
2042 if ((uc_mgr->snd_card_index >= (int)MAX_NUM_CARDS) ||
2043 (uc_mgr->snd_card_index < 0) || (uc_mgr->card_ctxt_ptr == NULL)) {
2045 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
2050 list_size = snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
2053 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->mod_list_head,
2055 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->mod_list_head,
2057 ret = set_controls_of_usecase_for_all_devices(uc_mgr,
2065 if (uc_mgr->modifier_list_count) {
2066 for (index = 0; index < uc_mgr->modifier_list_count; index++) {
2067 free(uc_mgr->current_modifier_list[index]);
2068 uc_mgr->current_modifier_list[index] = NULL;
2070 free(uc_mgr->current_modifier_list);
2071 uc_mgr->current_modifier_list = NULL;
2072 uc_mgr->modifier_list_count = 0;
2075 if(strncmp(uc_mgr->card_ctxt_ptr->current_verb, SND_USE_CASE_VERB_INACTIVE,
2077 ret = set_controls_of_usecase_for_all_devices(uc_mgr,
2078 uc_mgr->card_ctxt_ptr->current_verb, 0, CTRL_LIST_VERB);
2081 uc_mgr->card_ctxt_ptr->current_verb);
2082 strlcpy(uc_mgr->card_ctxt_ptr->current_verb, SND_USE_CASE_VERB_INACTIVE,
2086 list_size = snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
2089 snd_ucm_get_value_at_index(uc_mgr->card_ctxt_ptr->dev_list_head,
2091 snd_ucm_del_ident_from_list(&uc_mgr->card_ctxt_ptr->dev_list_head,
2093 ret = set_controls_of_device_for_all_usecases(uc_mgr,
2102 if (uc_mgr->device_list_count) {
2103 for (index = 0; index < uc_mgr->device_list_count; index++) {
2104 free(uc_mgr->current_device_list[index]);
2105 uc_mgr->current_device_list[index] = NULL;
2107 free(uc_mgr->current_device_list);
2108 uc_mgr->current_device_list = NULL;
2109 uc_mgr->device_list_count = 0;
2111 uc_mgr->current_tx_device = -1;
2112 uc_mgr->current_rx_device = -1;
2113 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
2126 snd_use_case_mgr_t **uc_mgr = (snd_use_case_mgr_t **)&uc_mgr_ptr;
2129 strlcat(path, (*uc_mgr)->card_ctxt_ptr->card_name, sizeof(path));
2206 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
2208 ret = snd_ucm_parse_verb(uc_mgr, file_name, index);
2218 if((*uc_mgr)->card_ctxt_ptr->verb_list[index]) {
2219 free((*uc_mgr)->card_ctxt_ptr->verb_list[index]);
2220 (*uc_mgr)->card_ctxt_ptr->verb_list[index] = NULL;
2222 (*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2224 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index], verb_name,
2232 (*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2234 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index],
2253 snd_ucm_print((*uc_mgr));
2257 ALOGE("Exiting parsing thread uc_mgr %p\n", uc_mgr);
2262 * uc_mgr - use case manager structure
2265 int snd_use_case_mgr_wait_for_parsing(snd_use_case_mgr_t *uc_mgr)
2269 ret = pthread_join(uc_mgr->thr, NULL);
2275 * uc_mgr - use case manager structure
2278 static int snd_ucm_parse(snd_use_case_mgr_t **uc_mgr)
2288 strlcat(path, (*uc_mgr)->card_ctxt_ptr->card_name, sizeof(path));
2309 (*uc_mgr)->card_ctxt_ptr->use_case_verb_list =
2311 if ((*uc_mgr)->card_ctxt_ptr->use_case_verb_list == NULL) {
2317 if (((*uc_mgr)->card_ctxt_ptr->verb_list =
2327 ret = parse_single_config_format(uc_mgr, current_str, verb_count);
2345 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
2365 if (((*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2367 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index],
2397 ret = snd_ucm_parse_verb(uc_mgr, file_name, index);
2418 if (((*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2420 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index], SND_UCM_END_OF_LIST,
2427 ALOGD("Creating Parsing thread uc_mgr %p\n", uc_mgr);
2428 rc = pthread_create(&(*uc_mgr)->thr, 0, second_stage_parsing_thread,
2429 (void*)(*uc_mgr));
2444 * uc_mgr - use case manager structure
2448 static int parse_single_config_format(snd_use_case_mgr_t **uc_mgr,
2457 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
2498 if (((*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2500 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index],
2525 ret = snd_ucm_parse_section(uc_mgr, &current_str,
2544 ret = snd_ucm_parse_section(uc_mgr, &current_str,
2577 ret = snd_ucm_parse_section(uc_mgr, &current_str,
2619 if (((*uc_mgr)->card_ctxt_ptr->verb_list[index] =
2621 strlcpy((*uc_mgr)->card_ctxt_ptr->verb_list[index],
2697 snd_ucm_print((*uc_mgr));
2865 * uc_mgr - use case manager structure
2870 static int snd_ucm_parse_verb(snd_use_case_mgr_t **uc_mgr,
2884 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
2924 ret = snd_ucm_parse_section(uc_mgr, &current_str,
2934 ret = snd_ucm_parse_section(uc_mgr, &current_str,
2958 ret = snd_ucm_parse_section(uc_mgr, &current_str,
3129 * uc_mgr - use case manager structure
3132 static int snd_ucm_print(snd_use_case_mgr_t *uc_mgr)
3138 pthread_mutex_lock(&uc_mgr->card_ctxt_ptr->card_lock);
3139 verb_list = uc_mgr->card_ctxt_ptr->use_case_verb_list;
3140 while(strncmp(uc_mgr->card_ctxt_ptr->verb_list[verb_index],
3143 uc_mgr->card_ctxt_ptr->verb_list[verb_index]);
3173 pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock);
3211 * uc_mgr - use case manager structure
3214 static int snd_ucm_parse_section(snd_use_case_mgr_t **uc_mgr, char **cur_str,
3222 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
3645 void snd_ucm_free_mixer_list(snd_use_case_mgr_t **uc_mgr)
3651 pthread_mutex_lock(&(*uc_mgr)->card_ctxt_ptr->card_lock);
3652 verb_list = (*uc_mgr)->card_ctxt_ptr->use_case_verb_list;
3653 while(strncmp((*uc_mgr)->card_ctxt_ptr->verb_list[verb_index],
3659 if((*uc_mgr)->card_ctxt_ptr->verb_list[verb_index]) {
3660 free((*uc_mgr)->card_ctxt_ptr->verb_list[verb_index]);
3699 if((*uc_mgr)->card_ctxt_ptr->use_case_verb_list)
3700 free((*uc_mgr)->card_ctxt_ptr->use_case_verb_list);
3701 if((*uc_mgr)->card_ctxt_ptr->verb_list)
3702 free((*uc_mgr)->card_ctxt_ptr->verb_list);
3703 pthread_mutex_unlock(&(*uc_mgr)->card_ctxt_ptr->card_lock);