Path: blob/master/thirdparty/linuxbsd_headers/alsa/sound/tlv.h
9917 views
/*1* This program is free software; you can redistribute it and/or modify2* it under the terms of the GNU General Public License as published by3* the Free Software Foundation; either version 2 of the License, or4* (at your option) any later version.5*6* This program is distributed in the hope that it will be useful,7* but WITHOUT ANY WARRANTY; without even the implied warranty of8* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9* GNU General Public License for more details.10*/1112#ifndef __UAPI_SOUND_TLV_H13#define __UAPI_SOUND_TLV_H1415#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */16#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */17#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */18#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */19#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */20#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */2122/*23* channel-mapping TLV items24* TLV length must match with num_channels25*/26#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */27#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */28#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */2930/*31* TLV structure is right behind the struct snd_ctl_tlv:32* unsigned int type - see SNDRV_CTL_TLVT_*33* unsigned int length34* .... data aligned to sizeof(unsigned int), use35* block_length = (length + (sizeof(unsigned int) - 1)) &36* ~(sizeof(unsigned int) - 1)) ....37*/38#define SNDRV_CTL_TLVD_ITEM(type, ...) \39(type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__40#define SNDRV_CTL_TLVD_LENGTH(...) \41((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))4243#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \44SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)45#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \46unsigned int name[] = { \47SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \48}4950#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff51#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x1000052#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \53SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \54(min), \55((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \56((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))57#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \58unsigned int name[] = { \59SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \60}6162/* dB scale specified with min/max values instead of step */63#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \64SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))65#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \66SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))67#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \68unsigned int name[] = { \69SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \70}71#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \72unsigned int name[] = { \73SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \74}7576/* linear volume between min_dB and max_dB (.01dB unit) */77#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \78SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))79#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \80unsigned int name[] = { \81SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \82}8384/* dB range container:85* Items in dB range container must be ordered by their values and by their86* dB values. This implies that larger values must correspond with larger87* dB values (which is also required for all other mixer controls).88*/89/* Each item is: <min> <max> <TLV> */90#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \91SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)92#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \93unsigned int name[] = { \94SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \95}9697#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -99999999899#endif100101102