~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/sound/tlv.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2 
  3 #ifndef __UAPI_SOUND_TLV_H
  4 #define __UAPI_SOUND_TLV_H
  5 
  6 #define SNDRV_CTL_TLVT_CONTAINER 0      /* one level down - group of TLVs */
  7 #define SNDRV_CTL_TLVT_DB_SCALE 1       /* dB scale */
  8 #define SNDRV_CTL_TLVT_DB_LINEAR 2      /* linear volume */
  9 #define SNDRV_CTL_TLVT_DB_RANGE 3       /* dB range container */
 10 #define SNDRV_CTL_TLVT_DB_MINMAX 4      /* dB scale with min/max */
 11 #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
 12 
 13 /*
 14  * channel-mapping TLV items
 15  *  TLV length must match with num_channels
 16  */
 17 #define SNDRV_CTL_TLVT_CHMAP_FIXED      0x101   /* fixed channel position */
 18 #define SNDRV_CTL_TLVT_CHMAP_VAR        0x102   /* channels freely swappable */
 19 #define SNDRV_CTL_TLVT_CHMAP_PAIRED     0x103   /* pair-wise swappable */
 20 
 21 /*
 22  * TLV structure is right behind the struct snd_ctl_tlv:
 23  *   unsigned int type          - see SNDRV_CTL_TLVT_*
 24  *   unsigned int length
 25  *   .... data aligned to sizeof(unsigned int), use
 26  *        block_length = (length + (sizeof(unsigned int) - 1)) &
 27  *                       ~(sizeof(unsigned int) - 1)) ....
 28  */
 29 #define SNDRV_CTL_TLVD_ITEM(type, ...) \
 30         (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
 31 #define SNDRV_CTL_TLVD_LENGTH(...) \
 32         ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
 33 
 34 /* Accessor offsets for TLV data items */
 35 #define SNDRV_CTL_TLVO_TYPE             0
 36 #define SNDRV_CTL_TLVO_LEN              1
 37 
 38 #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
 39         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
 40 #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
 41         unsigned int name[] = { \
 42                 SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
 43         }
 44 
 45 #define SNDRV_CTL_TLVD_DB_SCALE_MASK    0xffff
 46 #define SNDRV_CTL_TLVD_DB_SCALE_MUTE    0x10000
 47 #define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
 48         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
 49                             (min), \
 50                             ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
 51                              ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
 52 #define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
 53         unsigned int name[] = { \
 54                 SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
 55         }
 56 
 57 /* Accessor offsets for min, mute and step items in dB scale type TLV */
 58 #define SNDRV_CTL_TLVO_DB_SCALE_MIN             2
 59 #define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP   3
 60 
 61 /* dB scale specified with min/max values instead of step */
 62 #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
 63         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
 64 #define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
 65         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
 66 #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
 67         unsigned int name[] = { \
 68                 SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
 69         }
 70 #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
 71         unsigned int name[] = { \
 72                 SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
 73         }
 74 
 75 /* Accessor offsets for min, max items in db-minmax types of TLV. */
 76 #define SNDRV_CTL_TLVO_DB_MINMAX_MIN    2
 77 #define SNDRV_CTL_TLVO_DB_MINMAX_MAX    3
 78 
 79 /* linear volume between min_dB and max_dB (.01dB unit) */
 80 #define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
 81         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
 82 #define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
 83         unsigned int name[] = { \
 84                 SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
 85         }
 86 
 87 /* Accessor offsets for min, max items in db-linear type of TLV. */
 88 #define SNDRV_CTL_TLVO_DB_LINEAR_MIN    2
 89 #define SNDRV_CTL_TLVO_DB_LINEAR_MAX    3
 90 
 91 /* dB range container:
 92  * Items in dB range container must be ordered by their values and by their
 93  * dB values. This implies that larger values must correspond with larger
 94  * dB values (which is also required for all other mixer controls).
 95  */
 96 /* Each item is: <min> <max> <TLV> */
 97 #define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
 98         SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
 99 #define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
100         unsigned int name[] = { \
101                 SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
102         }
103 
104 #define SNDRV_CTL_TLVD_DB_GAIN_MUTE     -9999999
105 
106 #endif
107 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php