Lines Matching defs:*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) any later version.
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * Support for the verb/device/modifier core logic and API,
17 * command line tool and file parser was kindly sponsored by
18 * Texas Instruments Inc.
19 * Support for multiple active modifiers and devices,
20 * transition sequences, multiple client access and user defined use
21 * cases was kindly sponsored by Wolfson Microelectronics PLC.
23 * Copyright (C) 2008-2010 SlimLogic Ltd
24 * Copyright (C) 2010 Wolfson Microelectronics PLC
25 * Copyright (C) 2010 Texas Instruments Inc.
26 * Copyright (C) 2010 Red Hat Inc.
27 * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
28 * Stefan Schmidt <stefan@slimlogic.co.uk>
29 * Justin Xu <justinx@slimlogic.co.uk>
30 * Jaroslav Kysela <perex@perex.cz>
35 #if 0
36 #define UC_MGR_DEBUG
37 #endif
39 #include <pthread.h>
40 #include "local.h"
41 #include "use-case.h"
43 #define MAX_FILE 256
44 #define ALSA_USE_CASE_DIR ALSA_CONFIG_DIR "/ucm"
46 #define SEQUENCE_ELEMENT_TYPE_CDEV 1
47 #define SEQUENCE_ELEMENT_TYPE_CSET 2
48 #define SEQUENCE_ELEMENT_TYPE_SLEEP 3
49 #define SEQUENCE_ELEMENT_TYPE_EXEC 4
51 struct ucm_value {
52 struct list_head list;
53 char *name;
54 char *data;
57 struct sequence_element {
58 struct list_head list;
59 unsigned int type;
60 union {
61 long sleep; /* Sleep time in microseconds if sleep element, else 0 */
62 char *cdev;
63 char *cset;
64 char *exec;
65 } data;
69 * Transition sequences. i.e. transition between one verb, device, mod to another
71 struct transition_sequence {
72 struct list_head list;
73 char *name;
74 struct list_head transition_list;
78 * Modifier Supported Devices.
80 enum dev_list_type {
81 DEVLIST_NONE,
82 DEVLIST_SUPPORTED,
83 DEVLIST_CONFLICTING
86 struct dev_list_node {
87 struct list_head list;
88 char *name;
91 struct dev_list {
92 enum dev_list_type type;
93 struct list_head list;
97 * Describes a Use Case Modifier and it's enable and disable sequences.
98 * A use case verb can have N modifiers.
100 struct use_case_modifier {
101 struct list_head list;
102 struct list_head active_list;
104 char *name;
105 char *comment;
107 /* modifier enable and disable sequences */
108 struct list_head enable_list;
109 struct list_head disable_list;
111 /* modifier transition list */
112 struct list_head transition_list;
114 /* list of devices supported or conflicting */
115 struct dev_list dev_list;
117 /* values */
118 struct list_head value_list;
122 * Describes a Use Case Device and it's enable and disable sequences.
123 * A use case verb can have N devices.
125 struct use_case_device {
126 struct list_head list;
127 struct list_head active_list;
129 char *name;
130 char *comment;
132 /* device enable and disable sequences */
133 struct list_head enable_list;
134 struct list_head disable_list;
136 /* device transition list */
137 struct list_head transition_list;
139 /* list of devices supported or conflicting */
140 struct dev_list dev_list;
142 /* value list */
143 struct list_head value_list;
147 * Describes a Use Case Verb and it's enable and disable sequences.
148 * A use case verb can have N devices and N modifiers.
150 struct use_case_verb {
151 struct list_head list;
153 unsigned int active: 1;
155 char *name;
156 char *comment;
158 /* verb enable and disable sequences */
159 struct list_head enable_list;
160 struct list_head disable_list;
162 /* verb transition list */
163 struct list_head transition_list;
165 /* hardware devices that can be used with this use case */
166 struct list_head device_list;
168 /* modifiers that can be used with this use case */
169 struct list_head modifier_list;
171 /* value list */
172 struct list_head value_list;
176 * Manages a sound card and all its use cases.
178 struct snd_use_case_mgr {
179 char *card_name;
180 char *comment;
182 /* use case verb, devices and modifier configs parsed from files */
183 struct list_head verb_list;
185 /* default settings - sequence */
186 struct list_head default_list;
188 /* default settings - value list */
189 struct list_head value_list;
191 /* current status */
192 struct use_case_verb *active_verb;
193 struct list_head active_devices;
194 struct list_head active_modifiers;
196 /* locking */
197 pthread_mutex_t mutex;
199 /* change to list of ctl handles */
200 snd_ctl_t *ctl;
201 char *ctl_dev;
204 #define uc_error SNDERR
206 #ifdef UC_MGR_DEBUG
207 #define uc_dbg SNDERR
208 #else
209 #define uc_dbg(fmt, arg...) do { } while (0)
210 #endif
212 void uc_mgr_error(const char *fmt, ...);
213 void uc_mgr_stdout(const char *fmt, ...);
215 int uc_mgr_config_load(const char *file, snd_config_t **cfg);
216 int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr);
217 int uc_mgr_scan_master_configs(const char **_list[]);
219 void uc_mgr_free_sequence_element(struct sequence_element *seq);
220 void uc_mgr_free_transition_element(struct transition_sequence *seq);
221 void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr);
222 void uc_mgr_free(snd_use_case_mgr_t *uc_mgr);