jpayne@69: /** jpayne@69: * \file include/use-case.h jpayne@69: * \brief use case interface for the ALSA driver jpayne@69: * \author Liam Girdwood jpayne@69: * \author Stefan Schmidt jpayne@69: * \author Jaroslav Kysela jpayne@69: * \author Justin Xu jpayne@69: * \date 2008-2010 jpayne@69: */ jpayne@69: /* jpayne@69: * jpayne@69: * This library is free software; you can redistribute it and/or modify jpayne@69: * it under the terms of the GNU Lesser General Public License as jpayne@69: * published by the Free Software Foundation; either version 2.1 of jpayne@69: * the License, or (at your option) any later version. jpayne@69: * jpayne@69: * This program is distributed in the hope that it will be useful, jpayne@69: * but WITHOUT ANY WARRANTY; without even the implied warranty of jpayne@69: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jpayne@69: * GNU Lesser General Public License for more details. jpayne@69: * jpayne@69: * You should have received a copy of the GNU Lesser General Public jpayne@69: * License along with this library; if not, write to the Free Software jpayne@69: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA jpayne@69: * jpayne@69: * Copyright (C) 2008-2010 SlimLogic Ltd jpayne@69: * Copyright (C) 2010 Wolfson Microelectronics PLC jpayne@69: * Copyright (C) 2010 Texas Instruments Inc. jpayne@69: * jpayne@69: * Support for the verb/device/modifier core logic and API, jpayne@69: * command line tool and file parser was kindly sponsored by jpayne@69: * Texas Instruments Inc. jpayne@69: * Support for multiple active modifiers and devices, jpayne@69: * transition sequences, multiple client access and user defined use jpayne@69: * cases was kindly sponsored by Wolfson Microelectronics PLC. jpayne@69: */ jpayne@69: jpayne@69: #ifndef __ALSA_USE_CASE_H jpayne@69: #define __ALSA_USE_CASE_H jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: #include jpayne@69: jpayne@69: /** jpayne@69: * \defgroup ucm Use Case Interface jpayne@69: * The ALSA Use Case manager interface. jpayne@69: * See \ref Usecase page for more details. jpayne@69: * \{ jpayne@69: */ jpayne@69: jpayne@69: /*! \page Usecase ALSA Use Case Interface jpayne@69: * jpayne@69: * The use case manager works by configuring the sound card ALSA kcontrols to jpayne@69: * change the hardware digital and analog audio routing to match the requested jpayne@69: * device use case. The use case manager kcontrol configurations are stored in jpayne@69: * easy to modify text files. jpayne@69: * jpayne@69: * An audio use case can be defined by a verb and device parameter. The verb jpayne@69: * describes the use case action i.e. a phone call, listening to music, recording jpayne@69: * a conversation etc. The device describes the physical audio capture and playback jpayne@69: * hardware i.e. headphones, phone handset, bluetooth headset, etc. jpayne@69: * jpayne@69: * It's intended clients will mostly only need to set the use case verb and jpayne@69: * device for each system use case change (as the verb and device parameters jpayne@69: * cover most audio use cases). jpayne@69: * jpayne@69: * However there are times when a use case has to be modified at runtime. e.g. jpayne@69: * jpayne@69: * + Incoming phone call when the device is playing music jpayne@69: * + Recording sections of a phone call jpayne@69: * + Playing tones during a call. jpayne@69: * jpayne@69: * In order to allow asynchronous runtime use case adaptations, we have a third jpayne@69: * optional modifier parameter that can be used to further configure jpayne@69: * the use case during live audio runtime. jpayne@69: * jpayne@69: * This interface allows clients to :- jpayne@69: * jpayne@69: * + Query the supported use case verbs, devices and modifiers for the machine. jpayne@69: * + Set and Get use case verbs, devices and modifiers for the machine. jpayne@69: * + Get the ALSA PCM playback and capture device PCMs for use case verb, jpayne@69: * use case device and modifier. jpayne@69: * + Get the TQ parameter for each use case verb, use case device and jpayne@69: * modifier. jpayne@69: * + Get the ALSA master playback and capture volume/switch kcontrols jpayne@69: * or mixer elements for each use case. jpayne@69: */ jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * Use Case Verb. jpayne@69: * jpayne@69: * The use case verb is the main device audio action. e.g. the "HiFi" use jpayne@69: * case verb will configure the audio hardware for HiFi Music playback jpayne@69: * and capture. jpayne@69: */ jpayne@69: #define SND_USE_CASE_VERB_INACTIVE "Inactive" /**< Inactive Verb */ jpayne@69: #define SND_USE_CASE_VERB_HIFI "HiFi" /**< HiFi Verb */ jpayne@69: #define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power" /**< HiFi Low Power Verb */ jpayne@69: #define SND_USE_CASE_VERB_VOICE "Voice" /**< Voice Verb */ jpayne@69: #define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power" /**< Voice Low Power Verb */ jpayne@69: #define SND_USE_CASE_VERB_VOICECALL "Voice Call" /**< Voice Call Verb */ jpayne@69: #define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP" /**< Voice Call IP Verb */ jpayne@69: #define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio" /**< FM Analog Radio Verb */ jpayne@69: #define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio" /**< FM Digital Radio Verb */ jpayne@69: /* add new verbs to end of list */ jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * Use Case Device. jpayne@69: * jpayne@69: * Physical system devices the render and capture audio. Devices can be OR'ed jpayne@69: * together to support audio on simultaneous devices. jpayne@69: * jpayne@69: * If multiple devices with the same name exists, the number suffixes should jpayne@69: * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are jpayne@69: * allowed. The names with numbers must be continuous. It is allowed to put jpayne@69: * a whitespace between name and index (like 'Line 1') for the better jpayne@69: * readability. The device names 'Line 1' and 'Line1' are equal for jpayne@69: * this purpose. jpayne@69: * jpayne@69: * If EnableSequence/DisableSequence controls independent paths in the hardware jpayne@69: * it is also recommended to split playback and capture UCM devices and use jpayne@69: * the number suffixes. Example use case: Use the integrated microphone jpayne@69: * in the laptop instead the microphone in headphones. jpayne@69: * jpayne@69: * The preference of the devices is determined by the priority value. jpayne@69: */ jpayne@69: #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ jpayne@69: #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ jpayne@69: #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ jpayne@69: #define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */ jpayne@69: #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ jpayne@69: #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ jpayne@69: #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ jpayne@69: #define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */ jpayne@69: #define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */ jpayne@69: #define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */ jpayne@69: #define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */ jpayne@69: #define SND_USE_CASE_DEV_USB "USB" /**< USB Device (multifunctional) */ jpayne@69: /* add new devices to end of list */ jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * Use Case Modifiers. jpayne@69: * jpayne@69: * The use case modifier allows runtime configuration changes to deal with jpayne@69: * asynchronous events. jpayne@69: * jpayne@69: * If multiple modifiers with the same name exists, the number suffixes should jpayne@69: * be added to these names like 'Echo Reference 1','Echo Reference 2' etc. jpayne@69: * No number gaps are allowed. The names with numbers must be continuous. jpayne@69: * It is allowed to put a whitespace between name and index for the better jpayne@69: * readability. The modifier names 'Something 1' and 'Something1' are equal jpayne@69: * for this purpose. jpayne@69: * jpayne@69: * e.g. to record a voice call :- jpayne@69: * 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call) jpayne@69: * 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required. jpayne@69: * 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name jpayne@69: * with captured voice pcm data. jpayne@69: * jpayne@69: * e.g. to play a ring tone when listenin to MP3 Music :- jpayne@69: * 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback) jpayne@69: * 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens. jpayne@69: * 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for jpayne@69: * ringtone pcm data. jpayne@69: */ jpayne@69: #define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice" /**< Capture Voice Modifier */ jpayne@69: #define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music" /**< Capture Music Modifier */ jpayne@69: #define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music" /**< Play Music Modifier */ jpayne@69: #define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice" /**< Play Voice Modifier */ jpayne@69: #define SND_USE_CASE_MOD_PLAY_TONE "Play Tone" /**< Play Tone Modifier */ jpayne@69: #define SND_USE_CASE_MOD_ECHO_REF "Echo Reference" /**< Echo Reference Modifier */ jpayne@69: /* add new modifiers to end of list */ jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * TQ - Tone Quality jpayne@69: * jpayne@69: * The interface allows clients to determine the audio TQ required for each jpayne@69: * use case verb and modifier. It's intended as an optional hint to the jpayne@69: * audio driver in order to lower power consumption. jpayne@69: * jpayne@69: */ jpayne@69: #define SND_USE_CASE_TQ_MUSIC "Music" /**< Music Tone Quality */ jpayne@69: #define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice Tone Quality */ jpayne@69: #define SND_USE_CASE_TQ_TONES "Tones" /**< Tones Tone Quality */ jpayne@69: jpayne@69: /** use case container */ jpayne@69: typedef struct snd_use_case_mgr snd_use_case_mgr_t; jpayne@69: jpayne@69: /** jpayne@69: * \brief Create an identifier jpayne@69: * \param fmt Format (sprintf like) jpayne@69: * \param ... Optional arguments for sprintf like format jpayne@69: * \return Allocated string identifier or NULL on error jpayne@69: */ jpayne@69: char *snd_use_case_identifier(const char *fmt, ...); jpayne@69: jpayne@69: /** jpayne@69: * \brief Free a string list jpayne@69: * \param list The string list to free jpayne@69: * \param items Count of strings jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_free_list(const char *list[], int items); jpayne@69: jpayne@69: /** jpayne@69: * \brief Obtain a list of entries jpayne@69: * \param uc_mgr Use case manager (may be NULL - card list) jpayne@69: * \param identifier (may be NULL - card list) jpayne@69: * \param list Returned allocated list jpayne@69: * \return Number of list entries if success, otherwise a negative error code jpayne@69: * jpayne@69: * Defined identifiers: jpayne@69: * - NULL - get card list jpayne@69: * (in pair cardname+comment) jpayne@69: * - _verbs - get verb list jpayne@69: * (in pair verb+comment) jpayne@69: * - _devices[/{verb}] - get list of supported devices jpayne@69: * (in pair device+comment) jpayne@69: * - _modifiers[/{verb}] - get list of supported modifiers jpayne@69: * (in pair modifier+comment) jpayne@69: * - TQ[/{verb}] - get list of TQ identifiers jpayne@69: * - _enadevs - get list of enabled devices jpayne@69: * - _enamods - get list of enabled modifiers jpayne@69: * jpayne@69: * - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers jpayne@69: * - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices jpayne@69: * - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices jpayne@69: * jpayne@69: * Note that at most one of the supported/conflicting devs lists has jpayne@69: * any entries, and when neither is present, all devices are supported. jpayne@69: * jpayne@69: */ jpayne@69: int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, jpayne@69: const char *identifier, jpayne@69: const char **list[]); jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * \brief Get current - string jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \param identifier jpayne@69: * \param value Value pointer jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: * jpayne@69: * Note: The returned string is dynamically allocated, use free() to jpayne@69: * deallocate this string. (Yes, the value parameter shouldn't be marked as jpayne@69: * "const", but it's too late to fix it, sorry about that.) jpayne@69: * jpayne@69: * Known identifiers: jpayne@69: * - NULL - return current card jpayne@69: * - _verb - return current verb jpayne@69: * - _file - return configuration file loaded for current card jpayne@69: * jpayne@69: * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]] jpayne@69: * - value identifier {NAME} jpayne@69: * - Search starts at given modifier or device if any, jpayne@69: * else at a verb jpayne@69: * - Search starts at given verb if any, jpayne@69: * else current verb jpayne@69: * - Searches modifier/device, then verb, then defaults jpayne@69: * - Specify a leading "=" to search only the exact jpayne@69: * device/modifier/verb specified, and not search jpayne@69: * through each object in turn. jpayne@69: * - Examples: jpayne@69: * - "PlaybackPCM/Play Music" jpayne@69: * - "CapturePCM/SPDIF" jpayne@69: * - From ValueDefaults only: jpayne@69: * "=Variable" jpayne@69: * - From current active verb: jpayne@69: * "=Variable//" jpayne@69: * - From verb "Verb": jpayne@69: * "=Variable//Verb" jpayne@69: * - From "Modifier" in current active verb: jpayne@69: * "=Variable/Modifier/" jpayne@69: * - From "Modifier" in "Verb": jpayne@69: * "=Variable/Modifier/Verb" jpayne@69: * jpayne@69: * Recommended names for values: jpayne@69: * - Linked jpayne@69: * - value "True" or "1" (case insensitive) jpayne@69: * - this is a linked UCM card jpayne@69: * - don't use this UCM card, because the other UCM card refers devices jpayne@69: * - valid only in the ValueDefaults section (query '=Linked') jpayne@69: * - TQ jpayne@69: * - Tone Quality jpayne@69: * - Priority jpayne@69: * - priority value (1-10000), higher value means higher priority jpayne@69: * - valid only for verbs jpayne@69: * - for devices - PlaybackPriority and CapturePriority jpayne@69: * - PlaybackPCM jpayne@69: * - full PCM playback device name jpayne@69: * - PlaybackPCMIsDummy jpayne@69: * - Valid values: "yes" and "no". If set to "yes", the PCM named by the jpayne@69: * PlaybackPCM value is a dummy device, meaning that opening it enables jpayne@69: * an audio path in the hardware, but writing to the PCM device has no jpayne@69: * effect. jpayne@69: * - CapturePCM jpayne@69: * - full PCM capture device name jpayne@69: * - CapturePCMIsDummy jpayne@69: * - Valid values: "yes" and "no". If set to "yes", the PCM named by the jpayne@69: * CapturePCM value is a dummy device, meaning that opening it enables jpayne@69: * an audio path in the hardware, but reading from the PCM device has no jpayne@69: * effect. jpayne@69: * - PlaybackRate jpayne@69: * - playback device sample rate jpayne@69: * - PlaybackChannels jpayne@69: * - playback device channel count jpayne@69: * - PlaybackCTL jpayne@69: * - playback control device name jpayne@69: * - PlaybackVolume jpayne@69: * - playback control volume identifier string jpayne@69: * - can be parsed using snd_use_case_parse_ctl_elem_id() jpayne@69: * - PlaybackSwitch jpayne@69: * - playback control switch identifier string jpayne@69: * - can be parsed using snd_use_case_parse_ctl_elem_id() jpayne@69: * - PlaybackPriority jpayne@69: * - priority value (1-10000), higher value means higher priority jpayne@69: * - CaptureRate jpayne@69: * - capture device sample rate jpayne@69: * - CaptureChannels jpayne@69: * - capture device channel count jpayne@69: * - CaptureCTL jpayne@69: * - capture control device name jpayne@69: * - CaptureVolume jpayne@69: * - capture control volume identifier string jpayne@69: * - can be parsed using snd_use_case_parse_ctl_elem_id() jpayne@69: * - CaptureSwitch jpayne@69: * - capture control switch identifier string jpayne@69: * - can be parsed using snd_use_case_parse_ctl_elem_id() jpayne@69: * - CapturePriority jpayne@69: * - priority value (1-10000), higher value means higher priority jpayne@69: * - PlaybackMixer jpayne@69: * - name of playback mixer jpayne@69: * - PlaybackMixerElem jpayne@69: * - mixer element playback identifier jpayne@69: * - can be parsed using snd_use_case_parse_selem_id() jpayne@69: * - PlaybackMasterElem jpayne@69: * - mixer element playback identifier for the master control jpayne@69: * - can be parsed using snd_use_case_parse_selem_id() jpayne@69: * - PlaybackMasterType jpayne@69: * - type of the master volume control jpayne@69: * - Valid values: "soft" (software attenuation) jpayne@69: * - CaptureMixer jpayne@69: * - name of capture mixer jpayne@69: * - CaptureMixerElem jpayne@69: * - mixer element capture identifier jpayne@69: * - can be parsed using snd_use_case_parse_selem_id() jpayne@69: * - CaptureMasterElem jpayne@69: * - mixer element playback identifier for the master control jpayne@69: * - can be parsed using snd_use_case_parse_selem_id() jpayne@69: * - CaptureMasterType jpayne@69: * - type of the master volume control jpayne@69: * - Valid values: "soft" (software attenuation) jpayne@69: * - EDIDFile jpayne@69: * - Path to EDID file for HDMI devices jpayne@69: * - JackCTL jpayne@69: * - jack control device name jpayne@69: * - JackControl jpayne@69: * - jack control identificator jpayne@69: * - can be parsed using snd_use_case_parse_ctl_elem_id() jpayne@69: * - UCM configuration files should contain both JackControl and JackDev jpayne@69: * when possible, because applications are likely to support only one jpayne@69: * or the other jpayne@69: * - JackDev jpayne@69: * - the input device id of the jack (if the full input device path is jpayne@69: * /dev/input/by-id/foo, the JackDev value should be "foo") jpayne@69: * - UCM configuration files should contain both JackControl and JackDev jpayne@69: * when possible, because applications are likely to support only one jpayne@69: * or the other jpayne@69: * - JackHWMute jpayne@69: * If this value is set, it indicates that when the jack is plugged jpayne@69: * in, the hardware automatically mutes some other device(s). The jpayne@69: * value is a space-separated list of device names. If the device jpayne@69: * name contains space, it must be enclosed to ' or ", e.g.: jpayne@69: * JackHWMute "'Dock Headphone' Headphone" jpayne@69: * Note that JackHWMute should be used only when the hardware enforces jpayne@69: * the automatic muting. If the hardware doesn't enforce any muting, it jpayne@69: * may still be tempting to set JackHWMute to trick upper software layers jpayne@69: * to e.g. automatically mute speakers when headphones are plugged in, jpayne@69: * but that's application policy configuration that doesn't belong jpayne@69: * to UCM configuration files. jpayne@69: * - MinBufferLevel jpayne@69: * - This is used on platform where reported buffer level is not accurate. jpayne@69: * E.g. "512", which holds 512 samples in device buffer. Note: this will jpayne@69: * increase latency. jpayne@69: */ jpayne@69: int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, jpayne@69: const char *identifier, jpayne@69: const char **value); jpayne@69: jpayne@69: /** jpayne@69: * \brief Get current - integer jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \param identifier jpayne@69: * \param value result jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: * jpayne@69: * Known identifiers: jpayne@69: * - _devstatus/{device} - return status for given device jpayne@69: * - _modstatus/{modifier} - return status for given modifier jpayne@69: */ jpayne@69: int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr, jpayne@69: const char *identifier, jpayne@69: long *value); jpayne@69: jpayne@69: /** jpayne@69: * \brief Set new jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \param identifier jpayne@69: * \param value Value jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: * jpayne@69: * Known identifiers: jpayne@69: * - _boot - execute the boot sequence (value = NULL) jpayne@69: * - _defaults - execute the 'defaults' sequence (value = NULL) jpayne@69: * - _verb - set current verb = value jpayne@69: * - _enadev - enable given device = value jpayne@69: * - _disdev - disable given device = value jpayne@69: * - _swdev/{old_device} - new_device = value jpayne@69: * - disable old_device and then enable new_device jpayne@69: * - if old_device is not enabled just return jpayne@69: * - check transmit sequence firstly jpayne@69: * - _enamod - enable given modifier = value jpayne@69: * - _dismod - disable given modifier = value jpayne@69: * - _swmod/{old_modifier} - new_modifier = value jpayne@69: * - disable old_modifier and then enable new_modifier jpayne@69: * - if old_modifier is not enabled just return jpayne@69: * - check transmit sequence firstly jpayne@69: */ jpayne@69: int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, jpayne@69: const char *identifier, jpayne@69: const char *value); jpayne@69: jpayne@69: /** jpayne@69: * \brief Open and initialise use case core for sound card jpayne@69: * \param uc_mgr Returned use case manager pointer jpayne@69: * \param card_name Sound card name. jpayne@69: * \return zero if success, otherwise a negative error code jpayne@69: * jpayne@69: * By default only first card is used when the driver card jpayne@69: * name or long name is passed in the card_name argument. jpayne@69: * jpayne@69: * The "strict:" prefix in the card_name defines that jpayne@69: * there is no driver name / long name matching. The straight jpayne@69: * configuration is used. jpayne@69: * jpayne@69: * The "hw:" prefix in the card_name will load the configuration jpayne@69: * for the ALSA card specified by the card index (value) or jpayne@69: * the card string identificator. jpayne@69: * jpayne@69: * The sound card might be also composed from several physical jpayne@69: * sound cards (for the default and strict card_name). jpayne@69: * The application cannot expect that the device names will refer jpayne@69: * only one ALSA sound card in this case. jpayne@69: */ jpayne@69: int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, jpayne@69: const char *card_name); jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * \brief Reload and re-parse use case configuration files for sound card. jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \return zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr); jpayne@69: jpayne@69: /** jpayne@69: * \brief Close use case manager jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \return zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr); jpayne@69: jpayne@69: /** jpayne@69: * \brief Reset use case manager verb, device, modifier to deafult settings. jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \return zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr); jpayne@69: jpayne@69: /* jpayne@69: * helper functions jpayne@69: */ jpayne@69: jpayne@69: /** jpayne@69: * \brief Obtain a list of cards jpayne@69: * \param list Returned allocated list jpayne@69: * \return Number of list entries if success, otherwise a negative error code jpayne@69: */ jpayne@69: static __inline__ int snd_use_case_card_list(const char **list[]) jpayne@69: { jpayne@69: return snd_use_case_get_list(NULL, NULL, list); jpayne@69: } jpayne@69: jpayne@69: /** jpayne@69: * \brief Obtain a list of verbs jpayne@69: * \param uc_mgr Use case manager jpayne@69: * \param list Returned list of verbs jpayne@69: * \return Number of list entries if success, otherwise a negative error code jpayne@69: */ jpayne@69: static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr, jpayne@69: const char **list[]) jpayne@69: { jpayne@69: return snd_use_case_get_list(uc_mgr, "_verbs", list); jpayne@69: } jpayne@69: jpayne@69: /** jpayne@69: * \brief Parse control element identifier jpayne@69: * \param elem_id Element identifier jpayne@69: * \param ucm_id Use case identifier jpayne@69: * \param value String value to be parsed jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst, jpayne@69: const char *ucm_id, jpayne@69: const char *value); jpayne@69: jpayne@69: /** jpayne@69: * \brief Parse mixer element identifier jpayne@69: * \param dst Simple mixer element identifier jpayne@69: * \param ucm_id Use case identifier jpayne@69: * \param value String value to be parsed jpayne@69: * \return Zero if success, otherwise a negative error code jpayne@69: */ jpayne@69: int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst, jpayne@69: const char *ucm_id, jpayne@69: const char *value); jpayne@69: jpayne@69: /** jpayne@69: * \} jpayne@69: */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* __ALSA_USE_CASE_H */