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 struct AudioCtrlElemId { 21 const char *cardServiceName; 22 int32_t iface; 23 const char *itemName; /* ASCII name of item */ 24 }; 25 26 struct AudioCtrlElemInfo { 27 struct AudioCtrlElemId id; 28 uint32_t count; /* count of values */ 29 int32_t type; /* R: value type - AUDIODRV_CTL_ELEM_IFACE_MIXER_* */ 30 int32_t min; /* R: minimum value */ 31 int32_t max; /* R: maximum value */ 32 }; 33 34 struct AudioCtrlElemValue { 35 struct AudioCtrlElemId id; 36 uint32_t value[2]; 37 }; 38 39 /* mixer control */ 40 struct AudioMixerControl { 41 int32_t min; 42 int32_t max; 43 int32_t platformMax; 44 uint32_t mask; 45 uint32_t reg; 46 uint32_t rreg; /* right sound channel reg */ 47 uint32_t shift; 48 uint32_t rshift; /* right sound channel reg shift */ 49 uint32_t invert; 50 uint32_t value; 51 }; 52 53 struct AudioKcontrol { 54 const char *name; /* ASCII name of item */ 55 int32_t iface; 56 int32_t (*Info)(const struct AudioKcontrol *kcontrol, struct AudioCtrlElemInfo *elemInfo); 57 int32_t (*Get)(const struct AudioKcontrol *kcontrol, struct AudioCtrlElemValue *elemValue); 58 int32_t (*Set)(const struct AudioKcontrol *kcontrol, const struct AudioCtrlElemValue *elemValue); 59 void *privateData; 60 void *pri; 61 unsigned long privateValue; 62 struct DListHead list; /* list of controls */ 63 }; 64 65 #ifdef __cplusplus 66 #if __cplusplus 67 } 68 #endif 69 #endif /* __cplusplus */ 70 71 #endif 72