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