4 * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
27 #ifdef ALSA_UCM_DEBUG_TIME
32 #include "tizen-audio-internal.h"
34 #ifdef ALSA_UCM_DEBUG_TIME
35 #define SND_USE_CASE_SET __set_use_case_with_time
37 #define SND_USE_CASE_SET snd_use_case_set
40 #define UCM_PREFIX_CURRENT ">>> UCM current"
41 #define UCM_PREFIX_REQUESTED "> UCM requested"
42 #define UCM_PREFIX_CHANGED "<<< UCM changed"
46 static void __dump_use_case(const char* prefix, const char *verb, const char *devices[], int dev_count, const char *modifiers[], int mod_count)
49 dump_data_t* dump = NULL;
51 if (!(dump = _audio_dump_new(DUMP_LEN))) {
52 AUDIO_LOG_ERROR("Failed to create dump string...");
57 _audio_dump_add_str(dump, "Verb [ %s ] Devices [ ", verb ? verb : AUDIO_USE_CASE_VERB_INACTIVE);
61 for (i = 0; i < dev_count; i++) {
62 _audio_dump_add_str(dump, (i != dev_count - 1) ? "%s, " : "%s", devices[i]);
65 _audio_dump_add_str(dump, " ] Modifier [ ");
69 for (i = 0; i < mod_count; i++) {
70 _audio_dump_add_str(dump, (i != mod_count - 1) ? "%s, " : "%s", modifiers[i]);
73 _audio_dump_add_str(dump, " ]");
75 AUDIO_LOG_INFO("TEST %s : %s", prefix, _audio_dump_get_str(dump));
77 _audio_dump_free(dump);
80 #ifdef ALSA_UCM_DEBUG_TIME
81 static inline int __set_use_case_with_time(snd_use_case_mgr_t *uc_mgr, const char *identifier, const char *value)
84 struct timeval t_start, t_stop;
85 unsigned long long t_diff = 0;
87 gettimeofday(&t_start, NULL);
88 ret = snd_use_case_set(uc_mgr, identifier, value);
89 gettimeofday(&t_stop, NULL);
90 if (t_start.tv_sec < t_stop.tv_sec)
91 t_diff = (t_stop.tv_sec - t_start.tv_sec) * 1000000;
92 t_diff += (t_stop.tv_usec - t_start.tv_usec);
93 AUDIO_LOG_DEBUG("identifier %s value %s takes %lluusec", identifier, value, t_diff);
99 audio_return_t _ucm_init(audio_hal_t *ah)
101 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
103 snd_use_case_mgr_open(&ah->ucm.uc_mgr, ALSA_DEFAULT_CARD);
105 if (!ah->ucm.uc_mgr) {
106 AUDIO_LOG_ERROR("uc_mgr open failed");
107 return AUDIO_ERR_RESOURCE;
112 audio_return_t _ucm_deinit(audio_hal_t *ah)
114 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
115 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
117 if (ah->ucm.uc_mgr) {
118 snd_use_case_mgr_close(ah->ucm.uc_mgr);
119 ah->ucm.uc_mgr = NULL;
125 audio_return_t _ucm_get_device_name(audio_hal_t *ah, const char *use_case, audio_direction_t direction, const char **value)
127 char identifier[70] = { 0, };
129 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
130 AUDIO_RETURN_VAL_IF_FAIL(use_case, AUDIO_ERR_PARAMETER);
131 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
133 snprintf(identifier, sizeof(identifier), "%sPCM//%s",
134 (direction == AUDIO_DIRECTION_IN) ? "Capture" : "Playback", use_case);
136 snd_use_case_get(ah->ucm.uc_mgr, identifier, value);
138 AUDIO_LOG_INFO("get device name : [%s]", *value);
144 1) If verb is null or verb is not changed
145 1-1) If device is changed
146 (If there is request for same device, it will be ignored)
147 -> Set "Inactive" verb, disable modifiers & devices, set current verb again, enable devices & modifiers
148 (playback/capture device will be enabled again if there is no request for playback/capture device)
149 1-2) If device is not changed
150 1-2-1) If modifier is changed
151 (If there is request for same modifier, it will be ignored)
152 -> Disable modifiers, enable modifiers
153 2) If verb is changed
154 -> Reset, set new verb, enable devices & modifiers
156 audio_return_t _ucm_set_use_case(audio_hal_t *ah, const char *verb, const char *devices[], const char *modifiers[])
158 audio_return_t audio_ret = AUDIO_RET_OK;
159 int is_verb_changed = 0, is_dev_changed = 0, is_mod_changed = 0;
160 const char *old_verb = NULL, **old_dev_list = NULL, **old_mod_list = NULL;
161 int old_dev_count = 0, dev_count = 0;
162 int old_mod_count = 0, mod_count = 0;
163 const char **dis_dev_list = NULL, **ena_dev_list = NULL;
164 const char **dis_mod_list = NULL, **ena_mod_list = NULL;
165 int dis_dev_count = 0, ena_dev_count = 0;
166 int dis_mod_count = 0, ena_mod_count = 0;
169 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
170 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
171 AUDIO_RETURN_VAL_IF_FAIL(verb, AUDIO_ERR_PARAMETER);
173 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &old_verb);
174 old_dev_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enadevs", &old_dev_list);
175 old_mod_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enamods", &old_mod_list);
176 __dump_use_case(UCM_PREFIX_CURRENT, old_verb, old_dev_list, old_dev_count, old_mod_list, old_mod_count);
179 for (dev_count = 0; devices[dev_count]; dev_count++);
182 for (mod_count = 0; modifiers[mod_count]; mod_count++);
185 __dump_use_case(UCM_PREFIX_REQUESTED, verb, devices, dev_count, modifiers, mod_count);
187 if (old_verb && streq(verb, old_verb)) {
188 AUDIO_LOG_DEBUG("current verb and new verb is same. No need to change verb, disable devices explicitely");
190 if (old_dev_count > 0) {
191 dis_dev_list = (const char **)malloc(sizeof(const char *) * old_dev_count);
192 for (i = 0; i < old_dev_count; i++) {
193 dis_dev_list[i] = NULL;
197 ena_dev_list = (const char **)malloc(sizeof(const char *) * dev_count);
198 for (i = 0; i < dev_count; i++) {
199 ena_dev_list[i] = NULL;
202 if (old_mod_count > 0) {
203 dis_mod_list = (const char **)malloc(sizeof(const char *) * old_mod_count);
204 for (i = 0; i < old_mod_count; i++) {
205 dis_mod_list[i] = NULL;
209 ena_mod_list = (const char **)malloc(sizeof(const char *) * mod_count);
210 for (i = 0; i < mod_count; i++) {
211 ena_mod_list[i] = NULL;
215 /* update disable modifiers list which are not present in new modifier list */
216 for (i = 0; i < old_mod_count; i++) {
217 int need_disable_mod = 1;
219 for (j = 0; j < mod_count; j++) {
220 if (streq(old_mod_list[i], modifiers[j])) {
221 need_disable_mod = 0;
225 if (need_disable_mod) {
226 if (is_mod_changed == 0)
228 dis_mod_list[dis_mod_count++] = old_mod_list[i];
232 /* update disable devices list which are not present in new device list */
233 for (i = 0; i < old_dev_count; i++) {
234 int need_disable_dev = 1;
236 for (j = 0; j < dev_count; j++) {
237 if (streq(old_dev_list[i], devices[j])) {
238 need_disable_dev = 0;
242 if (need_disable_dev) {
243 if (is_dev_changed == 0)
245 dis_dev_list[dis_dev_count++] = old_dev_list[i];
249 /* update enable devices list which are not present in old device list */
250 for (i = 0; i < dev_count; i++) {
251 int need_enable_dev = 1;
253 for (j = 0; j < old_dev_count; j++) {
254 if (streq(devices[i], old_dev_list[j])) {
259 if (need_enable_dev) {
260 if (is_dev_changed == 0)
262 ena_dev_list[ena_dev_count++] = devices[i];
266 /* update enable modifiers list which are not present in old modifier list */
267 for (i = 0; i < mod_count; i++) {
268 int need_enable_mod = 1;
270 for (j = 0; j < old_mod_count; j++) {
271 if (streq(modifiers[i], old_mod_list[j])) {
276 if (need_enable_mod) {
277 if (is_mod_changed == 0)
279 ena_mod_list[ena_mod_count++] = modifiers[i];
283 /* disable modifiers */
284 for (i = 0; i < dis_mod_count; i++) {
285 AUDIO_LOG_INFO("Disable modifier : %s", dis_mod_list[i]);
286 if (snd_use_case_set(ah->ucm.uc_mgr, "_dismod", dis_mod_list[i]) < 0)
287 AUDIO_LOG_ERROR("disable %s modifier failed", dis_mod_list[i]);
290 /* disable devices */
291 for (i = 0; i < dis_dev_count; i++) {
292 AUDIO_LOG_INFO("Disable device : %s", dis_dev_list[i]);
293 if (snd_use_case_set(ah->ucm.uc_mgr, "_disdev", dis_dev_list[i]) < 0)
294 AUDIO_LOG_ERROR("disable %s device failed", dis_dev_list[i]);
298 for (i = 0; i < ena_dev_count; i++) {
299 AUDIO_LOG_INFO("Enable device : %s", ena_dev_list[i]);
300 if (snd_use_case_set(ah->ucm.uc_mgr, "_enadev", ena_dev_list[i]) < 0)
301 AUDIO_LOG_ERROR("enable %s device failed", ena_dev_list[i]);
304 /* enable modifiers */
305 for (i = 0; i < ena_mod_count; i++) {
306 AUDIO_LOG_INFO("Enable modifier : %s", ena_mod_list[i]);
307 if (snd_use_case_set(ah->ucm.uc_mgr, "_enamod", ena_mod_list[i]) < 0)
308 AUDIO_LOG_ERROR("enable %s modifier failed", ena_mod_list[i]);
313 AUDIO_LOG_DEBUG("Setting new verb: %s", verb);
315 if (snd_use_case_set(ah->ucm.uc_mgr, "_verb", verb) < 0) {
316 AUDIO_LOG_ERROR("Setting verb %s failed", verb);
317 audio_ret = AUDIO_ERR_UNDEFINED;
321 for (i = 0; i < dev_count; i++) {
322 AUDIO_LOG_DEBUG("Enable device : %s", devices[i]);
323 if (snd_use_case_set(ah->ucm.uc_mgr, "_enadev", devices[i]) < 0)
324 AUDIO_LOG_ERROR("Enable %s device failed", devices[i]);
326 /* enable modifiers */
327 for (i = 0; i < mod_count; i++) {
328 AUDIO_LOG_DEBUG("Enable modifier : %s", modifiers[i]);
329 if (snd_use_case_set(ah->ucm.uc_mgr, "_enamod", modifiers[i]) < 0)
330 AUDIO_LOG_ERROR("Enable %s modifier failed", modifiers[i]);
336 free((void *)old_verb);
338 snd_use_case_free_list(old_dev_list, old_dev_count);
340 snd_use_case_free_list(old_mod_list, old_mod_count);
342 free((void *)dis_dev_list);
344 free((void *)ena_dev_list);
346 free((void *)dis_mod_list);
348 free((void *)ena_mod_list);
350 if (is_verb_changed == 1 || is_dev_changed == 1 || is_mod_changed == 1) {
351 const char *new_verb = NULL, **new_dev_list = NULL, **new_mod_list = NULL;
352 int new_dev_count = 0, new_mod_count = 0;
354 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &new_verb);
355 new_dev_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enadevs", &new_dev_list);
356 new_mod_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enamods", &new_mod_list);
357 __dump_use_case(UCM_PREFIX_CHANGED, new_verb, new_dev_list, new_dev_count, new_mod_list, new_mod_count);
360 free((void *)new_verb);
362 snd_use_case_free_list(new_dev_list, new_dev_count);
364 snd_use_case_free_list(new_mod_list, new_mod_count);
370 audio_return_t _ucm_set_devices(audio_hal_t *ah, const char *verb, const char *devices[])
372 audio_return_t audio_ret = AUDIO_RET_OK;
373 int is_verb_changed = 0, is_dev_changed = 0;
374 const char *old_verb = NULL, **old_dev_list = NULL;
375 int old_dev_count = 0, dev_count = 0;
376 const char **dis_dev_list = NULL, **ena_dev_list = NULL;
377 int dis_dev_count = 0, ena_dev_count = 0;
380 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
381 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
382 AUDIO_RETURN_VAL_IF_FAIL(verb, AUDIO_ERR_PARAMETER);
383 AUDIO_RETURN_VAL_IF_FAIL(devices, AUDIO_ERR_PARAMETER);
385 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &old_verb);
386 old_dev_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enadevs", &old_dev_list);
387 __dump_use_case(UCM_PREFIX_CURRENT, old_verb, old_dev_list, old_dev_count, NULL, 0);
390 if (streq(verb, "Voice")) {
391 /* In case of Voice verb with Bluetooth device, make this device alone */
392 for (dev_count = 0; devices[dev_count]; dev_count++) {
393 if (streq(devices[dev_count], "Bluetooth")) {
394 devices = &devices[dev_count];
396 AUDIO_LOG_DEBUG("Voice verb with Bluetooth device only");
401 for (dev_count = 0; devices[dev_count]; dev_count++);
405 __dump_use_case(UCM_PREFIX_REQUESTED, verb, devices, dev_count, NULL, 0);
407 if (old_verb && streq(verb, old_verb)) {
408 AUDIO_LOG_DEBUG("current verb and new verb is same. No need to change verb, disable devices explicitely");
410 if (old_dev_count > 0) {
411 dis_dev_list = (const char **)malloc(sizeof(const char *) * old_dev_count);
412 for (i = 0; i < old_dev_count; i++) {
413 dis_dev_list[i] = NULL;
417 ena_dev_list = (const char **)malloc(sizeof(const char *) * dev_count);
418 for (i = 0; i < dev_count; i++) {
419 ena_dev_list[i] = NULL;
423 /* update disable devices list which are not present in new device list */
424 for (i = 0; i < old_dev_count; i++) {
425 int need_disable_dev = 1;
427 for (j = 0; j < dev_count; j++) {
428 if (streq(old_dev_list[i], devices[j])) {
429 need_disable_dev = 0;
433 if (need_disable_dev) {
434 if (is_dev_changed == 0)
436 dis_dev_list[dis_dev_count++] = old_dev_list[i];
440 /* update enable devices list which are not present in old device list */
441 for (i = 0; i < dev_count; i++) {
442 int need_enable_dev = 1;
444 for (j = 0; j < old_dev_count; j++) {
445 if (streq(devices[i], old_dev_list[j])) {
450 if (need_enable_dev) {
451 if (is_dev_changed == 0)
453 ena_dev_list[ena_dev_count++] = devices[i];
457 /* disable devices */
458 for (i = 0; i < dis_dev_count; i++) {
459 AUDIO_LOG_INFO("Disable device : %s", dis_dev_list[i]);
460 if (snd_use_case_set(ah->ucm.uc_mgr, "_disdev", dis_dev_list[i]) < 0)
461 AUDIO_LOG_ERROR("disable %s device failed", dis_dev_list[i]);
465 for (i = 0; i < ena_dev_count; i++) {
466 AUDIO_LOG_INFO("Enable device : %s", ena_dev_list[i]);
467 if (snd_use_case_set(ah->ucm.uc_mgr, "_enadev", ena_dev_list[i]) < 0)
468 AUDIO_LOG_ERROR("enable %s device failed", ena_dev_list[i]);
474 AUDIO_LOG_INFO("Setting new verb: %s", verb);
476 if (snd_use_case_set(ah->ucm.uc_mgr, "_verb", verb) < 0) {
477 AUDIO_LOG_ERROR("Setting verb %s failed", verb);
478 audio_ret = AUDIO_ERR_UNDEFINED;
482 for (i = 0; i < dev_count; i++) {
483 AUDIO_LOG_INFO("Enable device : %s", devices[i]);
484 if (snd_use_case_set(ah->ucm.uc_mgr, "_enadev", devices[i]) < 0)
485 AUDIO_LOG_ERROR("Enable %s device failed", devices[i]);
491 free((void *)old_verb);
493 snd_use_case_free_list(old_dev_list, old_dev_count);
495 free((void *)dis_dev_list);
497 free((void *)ena_dev_list);
499 if (is_verb_changed == 1 || is_dev_changed == 1) {
500 const char *new_verb = NULL, **new_dev_list = NULL;
501 int new_dev_count = 0;
503 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &new_verb);
504 new_dev_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enadevs", &new_dev_list);
505 __dump_use_case(UCM_PREFIX_CHANGED, new_verb, new_dev_list, new_dev_count, NULL, 0);
508 free((void *)new_verb);
510 snd_use_case_free_list(new_dev_list, new_dev_count);
517 audio_return_t _ucm_set_modifiers(audio_hal_t *ah, const char *verb, const char *modifiers[])
519 audio_return_t audio_ret = AUDIO_RET_OK;
520 int is_verb_changed = 0, is_mod_changed = 0;
521 const char *old_verb = NULL, **old_mod_list = NULL;
522 int old_mod_count = 0, mod_count = 0;
523 const char **dis_mod_list = NULL, **ena_mod_list = NULL;
524 int dis_mod_count = 0, ena_mod_count = 0;
527 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
528 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
529 AUDIO_RETURN_VAL_IF_FAIL(verb, AUDIO_ERR_PARAMETER);
530 AUDIO_RETURN_VAL_IF_FAIL(modifiers, AUDIO_ERR_PARAMETER);
532 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &old_verb);
533 old_mod_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enamods", &old_mod_list);
534 __dump_use_case(UCM_PREFIX_CURRENT, old_verb, NULL, 0, old_mod_list, old_mod_count);
537 for (mod_count = 0; modifiers[mod_count]; mod_count++);
540 __dump_use_case(UCM_PREFIX_REQUESTED, verb, NULL, 0, modifiers, mod_count);
542 if (old_verb && streq(verb, old_verb)) {
543 AUDIO_LOG_DEBUG("current verb and new verb is same. No need to change verb, disable devices explicitely");
545 if (old_mod_count > 0) {
546 dis_mod_list = (const char **)malloc(sizeof(const char *) * old_mod_count);
547 for (i = 0; i < old_mod_count; i++) {
548 dis_mod_list[i] = NULL;
552 ena_mod_list = (const char **)malloc(sizeof(const char *) * mod_count);
553 for (i = 0; i < mod_count; i++) {
554 ena_mod_list[i] = NULL;
558 /* update disable modifiers list which are not present in new modifier list */
559 for (i = 0; i < old_mod_count; i++) {
560 int need_disable_mod = 1;
562 for (j = 0; j < mod_count; j++) {
563 if (streq(old_mod_list[i], modifiers[j])) {
564 need_disable_mod = 0;
568 if (need_disable_mod) {
569 if (is_mod_changed == 0)
571 dis_mod_list[dis_mod_count++] = old_mod_list[i];
575 /* update enable modifiers list which are not present in old modifier list */
576 for (i = 0; i < mod_count; i++) {
577 int need_enable_mod = 1;
579 for (j = 0; j < old_mod_count; j++) {
580 if (streq(modifiers[i], old_mod_list[j])) {
585 if (need_enable_mod) {
586 if (is_mod_changed == 0)
588 ena_mod_list[ena_mod_count++] = modifiers[i];
592 /* disable modifiers */
593 for (i = 0; i < dis_mod_count; i++) {
594 AUDIO_LOG_INFO("Disable modifier : %s", dis_mod_list[i]);
595 if (snd_use_case_set(ah->ucm.uc_mgr, "_dismod", dis_mod_list[i]) < 0)
596 AUDIO_LOG_ERROR("disable %s modifier failed", dis_mod_list[i]);
599 /* enable modifiers */
600 for (i = 0; i < ena_mod_count; i++) {
601 AUDIO_LOG_INFO("Enable modifier : %s", ena_mod_list[i]);
602 if (snd_use_case_set(ah->ucm.uc_mgr, "_enamod", ena_mod_list[i]) < 0)
603 AUDIO_LOG_ERROR("enable %s modifier failed", ena_mod_list[i]);
608 AUDIO_LOG_DEBUG("Setting new verb: %s", verb);
610 if (snd_use_case_set(ah->ucm.uc_mgr, "_verb", verb) < 0) {
611 AUDIO_LOG_ERROR("Setting verb %s failed", verb);
612 audio_ret = AUDIO_ERR_UNDEFINED;
615 /* enable modifiers */
616 for (i = 0; i < mod_count; i++) {
617 AUDIO_LOG_DEBUG("Enable modifier : %s", modifiers[i]);
618 if (snd_use_case_set(ah->ucm.uc_mgr, "_enamod", modifiers[i]) < 0)
619 AUDIO_LOG_ERROR("Enable %s modifier failed", modifiers[i]);
625 free((void *)old_verb);
627 snd_use_case_free_list(old_mod_list, old_mod_count);
629 free((void *)dis_mod_list);
631 free((void *)ena_mod_list);
633 if (is_verb_changed == 1 || is_mod_changed == 1) {
634 const char *new_verb = NULL, **new_mod_list = NULL;
635 int new_mod_count = 0;
637 snd_use_case_get(ah->ucm.uc_mgr, "_verb", &new_verb);
638 new_mod_count = snd_use_case_get_list(ah->ucm.uc_mgr, "_enamods", &new_mod_list);
639 __dump_use_case(UCM_PREFIX_CHANGED, new_verb, NULL, 0, new_mod_list, new_mod_count);
642 free((void *)new_verb);
644 snd_use_case_free_list(new_mod_list, new_mod_count);
650 audio_return_t _ucm_get_verb(audio_hal_t *ah, const char **value)
652 audio_return_t ret = AUDIO_RET_OK;
654 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
655 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
656 AUDIO_RETURN_VAL_IF_FAIL(value, AUDIO_ERR_PARAMETER);
658 if ((ret = snd_use_case_get(ah->ucm.uc_mgr, "_verb", value)) < 0) {
659 AUDIO_LOG_ERROR("Getting current verb failed: Reason %d", ret);
660 ret = AUDIO_ERR_UNDEFINED;
666 audio_return_t _ucm_reset_use_case(audio_hal_t *ah)
668 audio_return_t ret = AUDIO_RET_OK;
670 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
671 AUDIO_RETURN_VAL_IF_FAIL(ah->ucm.uc_mgr, AUDIO_ERR_PARAMETER);
673 AUDIO_LOG_INFO(">>> UCM reset Verb [ %s ]", AUDIO_USE_CASE_VERB_INACTIVE);
675 if ((ret = snd_use_case_set(ah->ucm.uc_mgr, "_verb", AUDIO_USE_CASE_VERB_INACTIVE)) < 0) {
676 AUDIO_LOG_ERROR("Reset use case failed: Reason %d", ret);
677 ret = AUDIO_ERR_UNDEFINED;