blob: cdaba86929aa38f44bef41661ac1d3961cf7d0b3 [file] [log] [blame]
Iliyan Malchev4765c432012-06-11 14:36:16 -07001/*
Duy Truongeb337332013-01-17 10:33:22 -08002 * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Iliyan Malchev4765c432012-06-11 14:36:16 -07003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
Duy Truongeb337332013-01-17 10:33:22 -080013 * * Neither the name of The Linux Foundation nor the names of its
Iliyan Malchev4765c432012-06-11 14:36:16 -070014 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29#ifndef _MSM8960_USE_CASES_H_
30#define _MSM8960_USE_CASES_H_
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include "alsa_ucm.h"
37#include "alsa_audio.h"
38#include <pthread.h>
Mingming Yinb8851fa2013-01-06 20:50:34 -080039#include <stdbool.h>
Iliyan Malchev4765c432012-06-11 14:36:16 -070040#define SND_UCM_END_OF_LIST "end"
41
42/* ACDB Device ID macros */
43#define CAP_RX 0x1
44#define CAP_TX 0x2
45#define CAP_VOICE 0x4
46#define DEVICE_HANDSET_RX_ACDB_ID 7 // HANDSET_SPKR
47#define DEVICE_HANDSET_TX_ACDB_ID 4 // HANDSET_MIC
Mingming Yinbbd94ad2012-11-29 20:04:36 -080048#define DEVICE_SPEAKER_RX_ACDB_ID 15// SPKR_PHONE_SPKR_STEREO
ehgrace.kim91e9fad2012-07-02 18:27:28 -070049#define DEVICE_SPEAKER_MONO_RX_ACDB_ID 14// SPKR_PHONE_SPKR_MONO
50#define DEVICE_SPEAKER_STEREO_RX_ACDB_ID 15// SPKR_PHONE_SPKR_STEREO
Iliyan Malchev4765c432012-06-11 14:36:16 -070051#define DEVICE_SPEAKER_TX_ACDB_ID 11// SPKR_PHONE_MIC
52#define DEVICE_HEADSET_RX_ACDB_ID 10// HEADSET_SPKR_STEREO
Helen Zenga8037762013-02-12 10:28:46 -080053#define DEVICE_HEADSET_MONO_RX_ACDB_ID 9 // HEADSET_SPKR_MONO
Iliyan Malchev4765c432012-06-11 14:36:16 -070054#define DEVICE_HEADSET_TX_ACDB_ID 8 // HEADSET_MIC
55#define DEVICE_DUALMIC_HANDSET_TX_BROADSIDE_ACDB_ID 5 // HANDSET_MIC_BROADSIDE
56#define DEVICE_DUALMIC_HANDSET_TX_ENDFIRE_ACDB_ID 6 // HANDSET_MIC_ENDFIRE
57#define DEVICE_DUALMIC_SPEAKER_TX_BROADSIDE_ACDB_ID 12// SPKR_PHONE_MIC_BROADSIDE
58#define DEVICE_DUALMIC_SPEAKER_TX_ENDFIRE_ACDB_ID 13// SPKR_PHONE_MIC_ENDFIRE
Mingming Yinbbd94ad2012-11-29 20:04:36 -080059#define DEVICE_DUALMIC_HANDSET_STEREO_ACDB_ID 34
60#define DEVICE_DUALMIC_SPEAKER_PHONE_STEREO_ACDB_ID 35
Iliyan Malchev4765c432012-06-11 14:36:16 -070061#define DEVICE_TTY_HEADSET_MONO_RX_ACDB_ID 17// TTY_HEADSET_SPKR
62#define DEVICE_TTY_HEADSET_MONO_TX_ACDB_ID 16// TTY_HEADSET_MIC
63#define DEVICE_BT_SCO_RX_ACDB_ID 22// BT_SCO_SPKR
64#define DEVICE_BT_SCO_TX_ACDB_ID 21// BT_SCO_SPKR
65#define DEVICE_BT_SCO_RX_WB_ACDB_ID 39// BT_SCO_WB_SPKR
66#define DEVICE_BT_SCO_TX_WB_ACDB_ID 38// BT_SCO_WB_MIC
67#define DEVICE_SPEAKER_HEADSET_RX_ACDB_ID DEVICE_HEADSET_RX_ACDB_ID // Use headset calibration
68#define DEVICE_HDMI_STEREO_RX_ACDB_ID 18// HDMI_SPKR
ty.lee74060de2012-08-02 00:47:00 +090069#define DEVICE_ANC_HEADSET_STEREO_RX_ACDB_ID 26// ANC RX, same as regular headset
Iliyan Malchev4765c432012-06-11 14:36:16 -070070#define DEVICE_QUADMIC_ACDB_ID 19// QUADMIC_SKPR
ty.lee74060de2012-08-02 00:47:00 +090071#define DEVICE_PROXY_RX_ACDB_ID DEVICE_HDMI_STEREO_RX_ACDB_ID
72#define DEVICE_TTY_VCO_HANDSET_TX_ACDB_ID 36// TTY_VCO_HANDSET_MIC
73#define DEVICE_TTY_HCO_HANDSET_RX_ACDB_ID 37// TTY_HCO_HANDSET_SPRK
Mingming Yinbbd94ad2012-11-29 20:04:36 -080074#define DEVICE_HANDSET_TX_FV5_ACDB_ID 40
75#define DEVICE_DUALMIC_HANDSET_TX_ENDFIRE_FV5_ACDB_ID 41
76#define DEVICE_SPEAKER_TX_FV5_ACDB_ID 42
77#define DEVICE_DUALMIC_SPEAKER_TX_ENDFIRE_FV5_ACDB_ID 43
Vidyakumar Athotae70ace42013-03-07 14:53:24 -080078#define DEVICE_USB_RX_ACDB_ID 45// USB_Rx
79#define DEVICE_USB_TX_ACDB_ID 44// USB_Tx
ty.lee74060de2012-08-02 00:47:00 +090080#define DEVICE_CAMCORDER_TX_ACDB_ID 61// CAMCORDER_TX
81#define DEVICE_VOICE_RECOGNITION_ACDB_ID 62// VOICE_RECOGNITION
Iliyan Malchev4765c432012-06-11 14:36:16 -070082
83/* mixer control type */
84#define TYPE_INT 0
85#define TYPE_STR 1
86#define TYPE_MULTI_VAL 2
87
88/* Maximum string length of use case and device combination */
89#define MAX_UC_LEN 100
90/* Maximum string length of use case or device */
91#define MAX_STR_LEN 50
92
93/* Returns maximum length of strings x and y */
94#define MAX_LEN(x,y) ((strlen(x)>strlen(y))?strlen(x):strlen(y))
95
96/* Mixer control list type enum*/
97enum {
98 CTRL_LIST_VERB,
99 CTRL_LIST_DEVICE,
100 CTRL_LIST_MODIFIER,
101};
102
103/* mixer control structure */
104typedef struct mixer_control {
105 char *control_name;
106 unsigned type;
107 unsigned value;
108 char *string;
109 char **mulval;
110}mixer_control_t;
111
112/* Use case mixer controls structure */
113typedef struct card_mctrl {
114 char *case_name;
115 int ena_mixer_count;
116 mixer_control_t *ena_mixer_list;
117 int dis_mixer_count;
118 mixer_control_t *dis_mixer_list;
119 char *playback_dev_name;
120 char *capture_dev_name;
121 int acdb_id;
122 int capability;
123 char *effects_mixer_ctl;
Damir Didjusto7fa0f9f2013-04-19 13:38:58 -0700124 char *volume_mixer_ctl;
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800125 char *ec_ref_rx_mixer_ctl;
Iliyan Malchev4765c432012-06-11 14:36:16 -0700126}card_mctrl_t;
127
128/* identifier node structure for identifier list*/
129struct snd_ucm_ident_node {
130 int active;
SathishKumar Mani98580102012-09-20 14:46:37 -0700131 int capability;
Iliyan Malchev4765c432012-06-11 14:36:16 -0700132 char ident[MAX_STR_LEN];
133 struct snd_ucm_ident_node *next;
134};
135
136/* Structure to maintain the valid devices and
137 * modifiers list per each use case */
138typedef struct use_case_verb {
139 char *use_case_name;
140 char **device_list;
141 char **modifier_list;
142 int verb_count;
143 int device_count;
144 int mod_count;
145 card_mctrl_t *verb_ctrls;
146 card_mctrl_t *device_ctrls;
147 card_mctrl_t *mod_ctrls;
148}use_case_verb_t;
149
150/* SND card context structure */
151typedef struct card_ctxt {
152 char *card_name;
153 int card_number;
154 char *control_device;
155 struct mixer *mixer_handle;
156 char current_verb[MAX_STR_LEN];
157 struct snd_ucm_ident_node *dev_list_head;
158 struct snd_ucm_ident_node *mod_list_head;
159 pthread_mutex_t card_lock;
160 pthread_mutexattr_t card_lock_attr;
161 int current_verb_index;
162 use_case_verb_t *use_case_verb_list;
163 char **verb_list;
164}card_ctxt_t;
165
166/** use case manager structure */
167struct snd_use_case_mgr {
168 int snd_card_index;
169 int device_list_count;
170 int modifier_list_count;
171 char **current_device_list;
172 char **current_modifier_list;
173 int current_tx_device;
174 int current_rx_device;
175 card_ctxt_t *card_ctxt_ptr;
176 pthread_t thr;
Mingming Yinb8851fa2013-01-06 20:50:34 -0800177 bool isFusion3Platform;
Iliyan Malchev4765c432012-06-11 14:36:16 -0700178};
179
180#define MAX_NUM_CARDS (sizeof(card_list)/sizeof(char *))
181
182/* Valid sound cards list */
183static const char *card_list[] = {
184 "snd_soc_msm",
185 "snd_soc_msm_2x",
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800186 "snd_soc_msm_2x_mpq",
Iliyan Malchev4765c432012-06-11 14:36:16 -0700187 "snd_soc_msm_2x_Fusion3",
188 "snd_soc_msm_Sitar",
Laxminath Kasam088fbd12013-03-11 15:08:09 +0530189 "snd_soc_msm_Sitar_Sglte",
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800190 "snd_soc_msm_I2S",
191 "snd_soc_msm_Taiko",
192 "snd_soc_msm_Taiko_CDP",
193 "snd_soc_msm_Taiko_Fluid",
194 "snd_soc_msm_Taiko_liquid",
195 "snd_soc_msm_I2SFusion",
196 "us_soc_msm",
Iliyan Malchev4765c432012-06-11 14:36:16 -0700197};
198
199typedef struct card_mapping {
200 char card_name[50];
201 int card_number;
202}card_mapping_t;
203
204/* sound card name and number mapping */
205static card_mapping_t card_mapping_list[] = {
206 {"snd_soc_msm", 0},
207 {"snd_soc_msm_2x", 0},
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800208 {"snd_soc_msm_2x_mpq", 0},
Iliyan Malchev4765c432012-06-11 14:36:16 -0700209 {"snd_soc_msm_2x_Fusion3", 0},
210 {"snd_soc_msm_Sitar", 0},
Laxminath Kasam088fbd12013-03-11 15:08:09 +0530211 {"snd_soc_msm_Sitar_Sglte", 0},
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800212 {"snd_soc_msm_I2S", 0},
213 {"snd_soc_msm_Taiko", 0},
214 {"snd_soc_msm_Taiko_CDP", 0},
215 {"snd_soc_msm_Taiko_Fluid", 0},
216 {"snd_soc_msm_Taiko_liquid", 0},
217 {"snd_soc_msm_I2SFusion", 0},
218 {"us_soc_msm", 0},
Iliyan Malchev4765c432012-06-11 14:36:16 -0700219};
220
221/* New use cases, devices and modifiers added
222 * which are not part of existing macros
223 */
224#define SND_USE_CASE_VERB_FM_REC "FM REC"
225#define SND_USE_CASE_VERB_FM_A2DP_REC "FM A2DP REC"
226#define SND_USE_CASE_VERB_HIFI_REC "HiFi Rec"
SathishKumar Manid1c97002012-08-13 18:37:37 -0700227#define SND_USE_CASE_VERB_HIFI_LOWLATENCY_REC "HiFi Lowlatency Rec"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700228#define SND_USE_CASE_VERB_DL_REC "DL REC"
229#define SND_USE_CASE_VERB_UL_DL_REC "UL DL REC"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800230#define SND_USE_CASE_VERB_CAPTURE_COMPRESSED_VOICE_DL "Compressed DL REC"
231#define SND_USE_CASE_VERB_CAPTURE_COMPRESSED_VOICE_UL_DL "Compressed UL DL REC"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700232#define SND_USE_CASE_VERB_HIFI_TUNNEL "HiFi Tunnel"
SathishKumar Manid1c97002012-08-13 18:37:37 -0700233#define SND_USE_CASE_VERB_HIFI_LOWLATENCY_MUSIC "HiFi Lowlatency"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700234#define SND_USE_CASE_VERB_HIFI2 "HiFi2"
235#define SND_USE_CASE_VERB_INCALL_REC "Incall REC"
236#define SND_USE_CASE_VERB_MI2S "MI2S"
237#define SND_USE_CASE_VERB_VOLTE "VoLTE"
238#define SND_USE_CASE_VERB_ADSP_TESTFWK "ADSP testfwk"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800239#define SND_USE_CASE_VERB_HIFI_REC2 "HiFi Rec2"
240#define SND_USE_CASE_VERB_HIFI_REC_COMPRESSED "HiFi Rec Compressed"
241#define SND_USE_CASE_VERB_HIFI3 "HiFi3"
242#define SND_USE_CASE_VERB_HIFI_TUNNEL2 "HiFi Tunnel2"
243#define SND_USE_CASE_VERB_HIFI_PSEUDO_TUNNEL "HiFi Pseudo Tunnel"
Neema Shetty83d616c2013-02-20 19:18:05 -0800244#define SND_USE_CASE_VERB_VOICE2 "Voice2"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700245
246#define SND_USE_CASE_DEV_FM_TX "FM Tx"
247#define SND_USE_CASE_DEV_ANC_HEADSET "ANC Headset"
Damir Didjusto10b6ce42013-02-04 12:43:26 -0800248#define SND_USE_CASE_DEV_ANC_HANDSET "ANC Handset"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700249#define SND_USE_CASE_DEV_BTSCO_NB_RX "BT SCO Rx"
250#define SND_USE_CASE_DEV_BTSCO_NB_TX "BT SCO Tx"
251#define SND_USE_CASE_DEV_BTSCO_WB_RX "BT SCO WB Rx"
252#define SND_USE_CASE_DEV_BTSCO_WB_TX "BT SCO WB Tx"
253#define SND_USE_CASE_DEV_SPEAKER_HEADSET "Speaker Headset"
254#define SND_USE_CASE_DEV_SPEAKER_ANC_HEADSET "Speaker ANC Headset"
255#define SND_USE_CASE_DEV_SPEAKER_FM_TX "Speaker FM Tx"
256#define SND_USE_CASE_DEV_TTY_HEADSET_RX "TTY Headset Rx"
257#define SND_USE_CASE_DEV_TTY_HEADSET_TX "TTY Headset Tx"
258#define SND_USE_CASE_DEV_TTY_FULL_RX "TTY Full Rx"
259#define SND_USE_CASE_DEV_TTY_FULL_TX "TTY Full Tx"
260#define SND_USE_CASE_DEV_TTY_HANDSET_RX "TTY Handset Rx"
261#define SND_USE_CASE_DEV_TTY_HANDSET_TX "TTY Handset Tx"
262#define SND_USE_CASE_DEV_TTY_HANDSET_ANALOG_TX "TTY Handset Analog Tx"
263#define SND_USE_CASE_DEV_DUAL_MIC_BROADSIDE "DMIC Broadside"
264#define SND_USE_CASE_DEV_DUAL_MIC_ENDFIRE "DMIC Endfire"
Sidipotu Ashoka82aa812013-04-24 18:11:18 +0530265#define SND_USE_CASE_DEV_DUAL_MIC_ENDFIRE_SGLTE "DMIC Endfire Voice2"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800266#define SND_USE_CASE_DEV_DUAL_MIC_HANDSET_STEREO "Handset DMIC Stereo"
Sidipotu Ashoka82aa812013-04-24 18:11:18 +0530267#define SND_USE_CASE_DEV_DUAL_MIC_HANDSET_STEREO_SGLTE "Handset DMIC Stereo Voice2"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700268#define SND_USE_CASE_DEV_SPEAKER_DUAL_MIC_BROADSIDE "Speaker DMIC Broadside"
269#define SND_USE_CASE_DEV_SPEAKER_DUAL_MIC_ENDFIRE "Speaker DMIC Endfire"
Sidipotu Ashoka82aa812013-04-24 18:11:18 +0530270#define SND_USE_CASE_DEV_SPEAKER_DUAL_MIC_ENDFIRE_SGLTE "Speaker DMIC Endfire Voice2"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800271#define SND_USE_CASE_DEV_SPEAKER_DUAL_MIC_STEREO "Speaker DMIC Stereo"
Sidipotu Ashoka82aa812013-04-24 18:11:18 +0530272#define SND_USE_CASE_DEV_SPEAKER_DUAL_MIC_STEREO_SGLTE "Speaker DMIC Stereo Voice2"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700273#define SND_USE_CASE_DEV_HDMI_TX "HDMI Tx"
274#define SND_USE_CASE_DEV_HDMI_SPDIF "HDMI SPDIF"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800275#define SND_USE_CASE_DEV_HDMI_SPDIF_SPEAKER "HDMI SPDIF Speaker"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700276#define SND_USE_CASE_DEV_QUAD_MIC "QMIC"
277#define SND_USE_CASE_DEV_SSR_QUAD_MIC "SSR QMIC"
278#define SND_USE_CASE_DEV_PROXY_RX "PROXY Rx"
279#define SND_USE_CASE_DEV_PROXY_TX "PROXY Tx"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800280#define SND_USE_CASE_DEV_USB_PROXY_RX "USB PROXY Rx"
281#define SND_USE_CASE_DEV_USB_PROXY_TX "USB PROXY Tx"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700282#define SND_USE_CASE_DEV_SPDIF_SPEAKER "SPDIF Speaker"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800283#define SND_USE_CASE_DEV_HDMI_SPEAKER "HDMI Speaker"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700284#define SND_USE_CASE_DEV_SPDIF_HANDSET "SPDIF Earpiece"
285#define SND_USE_CASE_DEV_SPDIF_HEADSET "SPDIF Headphones"
286#define SND_USE_CASE_DEV_SPDIF_ANC_HEADSET "SPDIF ANC Headset"
287#define SND_USE_CASE_DEV_SPDIF_SPEAKER_HEADSET "SPDIF Speaker Headset"
288#define SND_USE_CASE_DEV_SPDIF_SPEAKER_ANC_HEADSET "SPDIF Speaker ANC Headset"
289#define SND_USE_CASE_DEV_DUMMY_TX "Dummy Tx"
Ajay Dudani9746c472012-06-18 16:01:16 -0700290#define SND_USE_CASE_DEV_PROXY_RX_SPEAKER "PROXY Rx Speaker"
Vidyakumar Athota9f3ab342013-01-23 04:03:18 -0800291#define SND_USE_CASE_DEV_USB_PROXY_RX_SPEAKER "USB PROXY Rx Speaker"
Ajay Dudani9746c472012-06-18 16:01:16 -0700292#define SND_USE_CASE_DEV_PROXY_RX_HANDSET "PROXY Rx Earpiece"
293#define SND_USE_CASE_DEV_PROXY_RX_HEADSET "PROXY Rx Headphones"
294#define SND_USE_CASE_DEV_PROXY_RX_ANC_HEADSET "PROXY Rx ANC Headset"
295#define SND_USE_CASE_DEV_PROXY_RX_SPEAKER_HEADSET "PROXY Rx Speaker Headset"
296#define SND_USE_CASE_DEV_PROXY_RX_SPEAKER_ANC_HEADSET "PROXY Rx Speaker ANC Headset"
ty.lee925596f2012-09-12 18:23:59 +0900297#define SND_USE_CASE_DEV_CAMCORDER_TX "Camcorder Tx"
298#define SND_USE_CASE_DEV_VOICE_RECOGNITION "Voice Recognition"
299#define SND_USE_CASE_DEV_VOC_EARPIECE "Voice Earpiece"
300#define SND_USE_CASE_DEV_VOC_HEADPHONE "Voice Headphones"
301#define SND_USE_CASE_DEV_VOC_HEADSET "Voice Headset"
302#define SND_USE_CASE_DEV_VOC_ANC_HEADSET "Voice ANC Headset"
303#define SND_USE_CASE_DEV_VOC_SPEAKER "Voice Speaker"
304#define SND_USE_CASE_DEV_VOC_LINE "Voice Line"
Damir Didjusto10b6ce42013-02-04 12:43:26 -0800305#define SND_USE_CASE_DEV_AANC_LINE "AANC Line"
306#define SND_USE_CASE_DEV_AANC_DMIC_ENDFIRE "AANC DMIC Endfire"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700307
308#define SND_USE_CASE_MOD_PLAY_FM "Play FM"
309#define SND_USE_CASE_MOD_CAPTURE_FM "Capture FM"
SathishKumar Manid1c97002012-08-13 18:37:37 -0700310#define SND_USE_CASE_MOD_CAPTURE_LOWLATENCY_MUSIC "Capture Lowlatency Music"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700311#define SND_USE_CASE_MOD_CAPTURE_A2DP_FM "Capture A2DP FM"
312#define SND_USE_CASE_MOD_PLAY_LPA "Play LPA"
313#define SND_USE_CASE_MOD_PLAY_VOIP "Play VOIP"
314#define SND_USE_CASE_MOD_CAPTURE_VOIP "Capture VOIP"
315#define SND_USE_CASE_MOD_CAPTURE_VOICE_DL "Capture Voice Downlink"
316#define SND_USE_CASE_MOD_CAPTURE_VOICE_UL_DL "Capture Voice Uplink Downlink"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800317#define SND_USE_CASE_MOD_CAPTURE_COMPRESSED_VOICE_DL "Capture Compressed Voice DL"
318#define SND_USE_CASE_MOD_CAPTURE_COMPRESSED_VOICE_UL_DL "Capture Compressed Voice UL DL"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700319#define SND_USE_CASE_MOD_PLAY_TUNNEL "Play Tunnel"
SathishKumar Manid1c97002012-08-13 18:37:37 -0700320#define SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC "Play Lowlatency Music"
Iliyan Malchev4765c432012-06-11 14:36:16 -0700321#define SND_USE_CASE_MOD_PLAY_MUSIC2 "Play Music2"
322#define SND_USE_CASE_MOD_PLAY_MI2S "Play MI2S"
323#define SND_USE_CASE_MOD_PLAY_VOLTE "Play VoLTE"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800324#define SND_USE_CASE_MOD_CAPTURE_MUSIC2 "Capture Music2"
325#define SND_USE_CASE_MOD_CAPTURE_MUSIC_COMPRESSED "Capture Music Compressed"
326#define SND_USE_CASE_MOD_PLAY_MUSIC3 "Play Music3"
327#define SND_USE_CASE_MOD_PLAY_TUNNEL1 "Play Tunnel1"
328#define SND_USE_CASE_MOD_PLAY_TUNNEL2 "Play Tunnel2"
329#define SND_USE_CASE_MOD_PSEUDO_TUNNEL "Pseudo Tunnel"
Neema Shetty83d616c2013-02-20 19:18:05 -0800330#define SND_USE_CASE_MOD_PLAY_VOICE2 "Play Voice2"
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800331
Iliyan Malchev4765c432012-06-11 14:36:16 -0700332
333/* List utility functions for maintaining enabled devices and modifiers */
334static int snd_ucm_add_ident_to_list(struct snd_ucm_ident_node **head, const char *value);
335static char *snd_ucm_get_value_at_index(struct snd_ucm_ident_node *head, int index);
336static int snd_ucm_get_size_of_list(struct snd_ucm_ident_node *head);
337static int snd_ucm_del_ident_from_list(struct snd_ucm_ident_node **head, const char *value);
338static int snd_ucm_free_list(struct snd_ucm_ident_node **head);
339static void snd_ucm_print_list(struct snd_ucm_ident_node *head);
SathishKumar Mani98580102012-09-20 14:46:37 -0700340static void snd_ucm_set_status_at_index(struct snd_ucm_ident_node *head, const char *ident, int status, int capability);
Iliyan Malchev4765c432012-06-11 14:36:16 -0700341static int snd_ucm_get_status_at_index(struct snd_ucm_ident_node *head, const char *ident);
SathishKumar Mani98580102012-09-20 14:46:37 -0700342struct snd_ucm_ident_node *snd_ucm_get_device_node(struct snd_ucm_ident_node *head, int index);
Iliyan Malchev4765c432012-06-11 14:36:16 -0700343static int snd_ucm_parse_verb(snd_use_case_mgr_t **uc_mgr, const char *file_name, int index);
344static int get_verb_count(const char *nxt_str);
345int snd_use_case_mgr_wait_for_parsing(snd_use_case_mgr_t *uc_mgr);
346int snd_use_case_set_case(snd_use_case_mgr_t *uc_mgr, const char *identifier,
347 const char *value, const char *usecase);
348static int get_usecase_type(snd_use_case_mgr_t *uc_mgr, const char *usecase);
349static int parse_single_config_format(snd_use_case_mgr_t **uc_mgr, char *current_str, int num_verbs);
350static int get_num_verbs_config_format(const char *nxt_str);
351static int get_num_device_config_format(const char *nxt_str);
352static int get_num_mod_config_format(const char *nxt_str);
353static int is_single_config_format(const char *nxt_str);
354/* Parse functions */
355static int snd_ucm_parse(snd_use_case_mgr_t **uc_mgr);
356static int snd_ucm_parse_section(snd_use_case_mgr_t **uc_mgr, char **cur_str, char **nxt_str, int verb_index, int ctrl_list_type);
357static int snd_ucm_extract_name(char *buf, char **case_name);
358static int snd_ucm_extract_acdb(char *buf, int *id, int *cap);
359static int snd_ucm_extract_effects_mixer_ctl(char *buf, char **mixer_name);
Mingming Yinbbd94ad2012-11-29 20:04:36 -0800360static int snd_ucm_extract_ec_ref_rx_mixer_ctl(char *buf, char **mixer_name);
Iliyan Malchev4765c432012-06-11 14:36:16 -0700361static int snd_ucm_extract_dev_name(char *buf, char **dev_name);
362static int snd_ucm_extract_controls(char *buf, mixer_control_t **mixer_list, int count);
Damir Didjusto7fa0f9f2013-04-19 13:38:58 -0700363static int snd_ucm_extract_volume_mixer_ctl(char *buf, char **mixer_name);
Iliyan Malchev4765c432012-06-11 14:36:16 -0700364static int snd_ucm_print(snd_use_case_mgr_t *uc_mgr);
365static void snd_ucm_free_mixer_list(snd_use_case_mgr_t **uc_mgr);
366#ifdef __cplusplus
367}
368#endif
369
370#endif