1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef AUDIO_CONTROL_H 10 #define AUDIO_CONTROL_H 11 12 #include "hdf_dlist.h" 13 14 #ifdef __cplusplus 15 #if __cplusplus 16 extern "C" { 17 #endif 18 #endif /* __cplusplus */ 19 20 #define AUDIO_ELEMENT_NAME_LEN 64 21 22 struct AudioCtrlElemId { 23 const char *cardServiceName; 24 int32_t iface; 25 const char *itemName; /* ASCII name of item */ 26 }; 27 28 struct AudioCtlElemListReport { 29 char name[AUDIO_ELEMENT_NAME_LEN]; 30 int32_t iface; 31 }; 32 33 struct AudioCtlElemList { 34 const char *cardServiceName; 35 uint32_t count; /* R: count of all elements */ 36 uint32_t space; /* W: count of element IDs to get */ 37 struct AudioCtlElemListReport *ctlElemListAddr; /* R: AudioCtrlElemId list addr */ 38 }; 39 40 struct AudioCtrlElemInfo { 41 struct AudioCtrlElemId id; 42 uint32_t count; /* count of values */ 43 int32_t type; /* R: value type - AUDIODRV_CTL_ELEM_IFACE_MIXER_* */ 44 int32_t min; /* R: minimum value */ 45 int32_t max; /* R: maximum value */ 46 }; 47 48 struct AudioCtrlElemValue { 49 struct AudioCtrlElemId id; 50 uint32_t value[2]; 51 }; 52 53 /* enumerated kcontrol */ 54 struct AudioEnumKcontrol { 55 uint32_t reg; 56 uint32_t reg2; 57 uint8_t shiftLeft; 58 uint8_t shiftRight; 59 uint32_t max; 60 uint32_t mask; 61 const char * const *texts; 62 const uint32_t *values; 63 void *sapm; 64 }; 65 66 /* mixer control */ 67 struct AudioMixerControl { 68 uint32_t min; 69 uint32_t max; 70 int32_t platformMax; 71 uint32_t mask; 72 uint32_t reg; 73 uint32_t rreg; /* right sound channel reg */ 74 uint32_t shift; 75 uint32_t rshift; /* right sound channel reg shift */ 76 uint32_t invert; 77 uint32_t value; 78 }; 79 80 struct AudioKcontrol { 81 char *name; /* ASCII name of item */ 82 int32_t iface; 83 int32_t (*Info)(const struct AudioKcontrol *kcontrol, struct AudioCtrlElemInfo *elemInfo); 84 int32_t (*Get)(const struct AudioKcontrol *kcontrol, struct AudioCtrlElemValue *elemValue); 85 int32_t (*Set)(const struct AudioKcontrol *kcontrol, const struct AudioCtrlElemValue *elemValue); 86 void *privateData; 87 void *pri; 88 unsigned long privateValue; 89 struct DListHead list; /* list of controls */ 90 }; 91 92 #ifdef __cplusplus 93 #if __cplusplus 94 } 95 #endif 96 #endif /* __cplusplus */ 97 98 #endif 99