1 /* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef _CRAS_ALSA_CARD_H
7 #define _CRAS_ALSA_CARD_H
8 
9 #include "cras_types.h"
10 
11 /* cras_alsa_card represents an alsa sound card.  It adds all the devices for
12  * this card to the system when it is created, and removes them when it is
13  * destroyed.  It will create an alsa_mixer object that can control the volume
14  * and mute settings for the card.
15  */
16 
17 struct cras_alsa_card;
18 struct cras_device_blacklist;
19 
20 /* Creates a cras_alsa_card instance for the given alsa device.  Enumerates the
21  * devices for the card and adds them to the system as possible playback or
22  * capture endpoints.
23  * Args:
24  *    card_info - Contains the card index, type, and priority.
25  *    device_config_dir - The directory of device configs which contains the
26  *                        volume curves.
27  *    blacklist - List of devices that should be ignored.
28  *    ucm_suffix - The ucm config name is formed as <card-name>.<suffix>
29  * Returns:
30  *    A pointer to the newly created cras_alsa_card which must later be freed
31  *    by calling cras_alsa_card_destroy or NULL on error.
32  */
33 struct cras_alsa_card *cras_alsa_card_create(
34 		struct cras_alsa_card_info *info,
35 		const char *device_config_dir,
36 		struct cras_device_blacklist *blacklist,
37 		const char *ucm_suffix);
38 
39 /* Destroys a cras_alsa_card that was returned from cras_alsa_card_create.
40  * Args:
41  *    alsa_card - The cras_alsa_card pointer returned from
42  *        cras_alsa_card_create.
43  */
44 void cras_alsa_card_destroy(struct cras_alsa_card *alsa_card);
45 
46 /* Returns the alsa card index for the given card.
47  * Args:
48  *    alsa_card - The cras_alsa_card pointer returned from
49  *        cras_alsa_card_create.
50  */
51 size_t cras_alsa_card_get_index(const struct cras_alsa_card *alsa_card);
52 
53 #endif /* _CRAS_ALSA_CARD_H */
54