1 /* SPDX-License-Identifier: (GPL-2.0-only OR B !! 1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 /* 2 /* 3 * This file is provided under a dual BSD/GPLv 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so und 4 * redistributing this file, you may do so under either license. 5 * 5 * 6 * Copyright(c) 2018 Intel Corporation !! 6 * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 */ 7 */ 8 8 9 #ifndef __INCLUDE_SOUND_SOF_CONTROL_H__ 9 #ifndef __INCLUDE_SOUND_SOF_CONTROL_H__ 10 #define __INCLUDE_SOUND_SOF_CONTROL_H__ 10 #define __INCLUDE_SOUND_SOF_CONTROL_H__ 11 11 12 #include <uapi/sound/sof/header.h> 12 #include <uapi/sound/sof/header.h> 13 #include <sound/sof/header.h> 13 #include <sound/sof/header.h> 14 14 15 /* 15 /* 16 * Component Mixers and Controls 16 * Component Mixers and Controls 17 */ 17 */ 18 18 19 /* channel positions - uses same values as ALS 19 /* channel positions - uses same values as ALSA */ 20 enum sof_ipc_chmap { 20 enum sof_ipc_chmap { 21 SOF_CHMAP_UNKNOWN = 0, 21 SOF_CHMAP_UNKNOWN = 0, 22 SOF_CHMAP_NA, /**< N/A, sile 22 SOF_CHMAP_NA, /**< N/A, silent */ 23 SOF_CHMAP_MONO, /**< mono stre 23 SOF_CHMAP_MONO, /**< mono stream */ 24 SOF_CHMAP_FL, /**< front lef 24 SOF_CHMAP_FL, /**< front left */ 25 SOF_CHMAP_FR, /**< front rig 25 SOF_CHMAP_FR, /**< front right */ 26 SOF_CHMAP_RL, /**< rear left 26 SOF_CHMAP_RL, /**< rear left */ 27 SOF_CHMAP_RR, /**< rear righ 27 SOF_CHMAP_RR, /**< rear right */ 28 SOF_CHMAP_FC, /**< front cen 28 SOF_CHMAP_FC, /**< front centre */ 29 SOF_CHMAP_LFE, /**< LFE */ 29 SOF_CHMAP_LFE, /**< LFE */ 30 SOF_CHMAP_SL, /**< side left 30 SOF_CHMAP_SL, /**< side left */ 31 SOF_CHMAP_SR, /**< side righ 31 SOF_CHMAP_SR, /**< side right */ 32 SOF_CHMAP_RC, /**< rear cent 32 SOF_CHMAP_RC, /**< rear centre */ 33 SOF_CHMAP_FLC, /**< front lef 33 SOF_CHMAP_FLC, /**< front left centre */ 34 SOF_CHMAP_FRC, /**< front rig 34 SOF_CHMAP_FRC, /**< front right centre */ 35 SOF_CHMAP_RLC, /**< rear left 35 SOF_CHMAP_RLC, /**< rear left centre */ 36 SOF_CHMAP_RRC, /**< rear righ 36 SOF_CHMAP_RRC, /**< rear right centre */ 37 SOF_CHMAP_FLW, /**< front lef 37 SOF_CHMAP_FLW, /**< front left wide */ 38 SOF_CHMAP_FRW, /**< front rig 38 SOF_CHMAP_FRW, /**< front right wide */ 39 SOF_CHMAP_FLH, /**< front lef 39 SOF_CHMAP_FLH, /**< front left high */ 40 SOF_CHMAP_FCH, /**< front cen 40 SOF_CHMAP_FCH, /**< front centre high */ 41 SOF_CHMAP_FRH, /**< front rig 41 SOF_CHMAP_FRH, /**< front right high */ 42 SOF_CHMAP_TC, /**< top centr 42 SOF_CHMAP_TC, /**< top centre */ 43 SOF_CHMAP_TFL, /**< top front 43 SOF_CHMAP_TFL, /**< top front left */ 44 SOF_CHMAP_TFR, /**< top front 44 SOF_CHMAP_TFR, /**< top front right */ 45 SOF_CHMAP_TFC, /**< top front 45 SOF_CHMAP_TFC, /**< top front centre */ 46 SOF_CHMAP_TRL, /**< top rear 46 SOF_CHMAP_TRL, /**< top rear left */ 47 SOF_CHMAP_TRR, /**< top rear 47 SOF_CHMAP_TRR, /**< top rear right */ 48 SOF_CHMAP_TRC, /**< top rear 48 SOF_CHMAP_TRC, /**< top rear centre */ 49 SOF_CHMAP_TFLC, /**< top front 49 SOF_CHMAP_TFLC, /**< top front left centre */ 50 SOF_CHMAP_TFRC, /**< top front 50 SOF_CHMAP_TFRC, /**< top front right centre */ 51 SOF_CHMAP_TSL, /**< top side 51 SOF_CHMAP_TSL, /**< top side left */ 52 SOF_CHMAP_TSR, /**< top side 52 SOF_CHMAP_TSR, /**< top side right */ 53 SOF_CHMAP_LLFE, /**< left LFE 53 SOF_CHMAP_LLFE, /**< left LFE */ 54 SOF_CHMAP_RLFE, /**< right LFE 54 SOF_CHMAP_RLFE, /**< right LFE */ 55 SOF_CHMAP_BC, /**< bottom ce 55 SOF_CHMAP_BC, /**< bottom centre */ 56 SOF_CHMAP_BLC, /**< bottom le 56 SOF_CHMAP_BLC, /**< bottom left centre */ 57 SOF_CHMAP_BRC, /**< bottom ri 57 SOF_CHMAP_BRC, /**< bottom right centre */ 58 SOF_CHMAP_LAST = SOF_CHMAP_BRC, 58 SOF_CHMAP_LAST = SOF_CHMAP_BRC, 59 }; 59 }; 60 60 61 /* control data type and direction */ 61 /* control data type and direction */ 62 enum sof_ipc_ctrl_type { 62 enum sof_ipc_ctrl_type { 63 /* per channel data - uses struct sof 63 /* per channel data - uses struct sof_ipc_ctrl_value_chan */ 64 SOF_CTRL_TYPE_VALUE_CHAN_GET = 0, 64 SOF_CTRL_TYPE_VALUE_CHAN_GET = 0, 65 SOF_CTRL_TYPE_VALUE_CHAN_SET, 65 SOF_CTRL_TYPE_VALUE_CHAN_SET, 66 /* component data - uses struct sof_ip 66 /* component data - uses struct sof_ipc_ctrl_value_comp */ 67 SOF_CTRL_TYPE_VALUE_COMP_GET, 67 SOF_CTRL_TYPE_VALUE_COMP_GET, 68 SOF_CTRL_TYPE_VALUE_COMP_SET, 68 SOF_CTRL_TYPE_VALUE_COMP_SET, 69 /* bespoke data - uses struct sof_abi_ 69 /* bespoke data - uses struct sof_abi_hdr */ 70 SOF_CTRL_TYPE_DATA_GET, 70 SOF_CTRL_TYPE_DATA_GET, 71 SOF_CTRL_TYPE_DATA_SET, 71 SOF_CTRL_TYPE_DATA_SET, 72 }; 72 }; 73 73 74 /* control command type */ 74 /* control command type */ 75 enum sof_ipc_ctrl_cmd { 75 enum sof_ipc_ctrl_cmd { 76 SOF_CTRL_CMD_VOLUME = 0, /**< maps to 76 SOF_CTRL_CMD_VOLUME = 0, /**< maps to ALSA volume style controls */ 77 SOF_CTRL_CMD_ENUM, /**< maps to A 77 SOF_CTRL_CMD_ENUM, /**< maps to ALSA enum style controls */ 78 SOF_CTRL_CMD_SWITCH, /**< maps to A 78 SOF_CTRL_CMD_SWITCH, /**< maps to ALSA switch style controls */ 79 SOF_CTRL_CMD_BINARY, /**< maps to A 79 SOF_CTRL_CMD_BINARY, /**< maps to ALSA binary style controls */ 80 }; 80 }; 81 81 82 /* generic channel mapped value data */ 82 /* generic channel mapped value data */ 83 struct sof_ipc_ctrl_value_chan { 83 struct sof_ipc_ctrl_value_chan { 84 uint32_t channel; /**< channel m 84 uint32_t channel; /**< channel map - enum sof_ipc_chmap */ 85 uint32_t value; 85 uint32_t value; 86 } __packed; 86 } __packed; 87 87 88 /* generic component mapped value data */ 88 /* generic component mapped value data */ 89 struct sof_ipc_ctrl_value_comp { 89 struct sof_ipc_ctrl_value_comp { 90 uint32_t index; /**< component source/ 90 uint32_t index; /**< component source/sink/control index in control */ 91 union { 91 union { 92 uint32_t uvalue; 92 uint32_t uvalue; 93 int32_t svalue; 93 int32_t svalue; 94 }; 94 }; 95 } __packed; 95 } __packed; 96 96 97 /* generic control data */ 97 /* generic control data */ 98 struct sof_ipc_ctrl_data { 98 struct sof_ipc_ctrl_data { 99 struct sof_ipc_reply rhdr; 99 struct sof_ipc_reply rhdr; 100 uint32_t comp_id; 100 uint32_t comp_id; 101 101 102 /* control access and data type */ 102 /* control access and data type */ 103 uint32_t type; /**< enum sof_ 103 uint32_t type; /**< enum sof_ipc_ctrl_type */ 104 uint32_t cmd; /**< enum sof_ 104 uint32_t cmd; /**< enum sof_ipc_ctrl_cmd */ 105 uint32_t index; /**< control i 105 uint32_t index; /**< control index for comps > 1 control */ 106 106 107 /* control data - can either be append 107 /* control data - can either be appended or DMAed from host */ 108 struct sof_ipc_host_buffer buffer; 108 struct sof_ipc_host_buffer buffer; 109 uint32_t num_elems; /**< in array 109 uint32_t num_elems; /**< in array elems or bytes for data type */ 110 uint32_t elems_remaining; /**< e 110 uint32_t elems_remaining; /**< elems remaining if sent in parts */ 111 111 112 uint32_t msg_index; /**< for large 112 uint32_t msg_index; /**< for large messages sent in parts */ 113 113 114 /* reserved for future use */ 114 /* reserved for future use */ 115 uint32_t reserved[6]; 115 uint32_t reserved[6]; 116 116 117 /* control data - add new types if nee 117 /* control data - add new types if needed */ 118 union { 118 union { 119 /* channel values can be used 119 /* channel values can be used by volume type controls */ 120 DECLARE_FLEX_ARRAY(struct sof_ !! 120 struct sof_ipc_ctrl_value_chan chanv[0]; 121 /* component values used by ro 121 /* component values used by routing controls like mux, mixer */ 122 DECLARE_FLEX_ARRAY(struct sof_ !! 122 struct sof_ipc_ctrl_value_comp compv[0]; 123 /* data can be used by binary 123 /* data can be used by binary controls */ 124 DECLARE_FLEX_ARRAY(struct sof_ !! 124 struct sof_abi_hdr data[0]; 125 }; 125 }; 126 } __packed; 126 } __packed; 127 127 128 /** Event type */ 128 /** Event type */ 129 enum sof_ipc_ctrl_event_type { 129 enum sof_ipc_ctrl_event_type { 130 SOF_CTRL_EVENT_GENERIC = 0, /**< g 130 SOF_CTRL_EVENT_GENERIC = 0, /**< generic event */ 131 SOF_CTRL_EVENT_GENERIC_METADATA, 131 SOF_CTRL_EVENT_GENERIC_METADATA, /**< generic event with metadata */ 132 SOF_CTRL_EVENT_KD, /**< keyword d 132 SOF_CTRL_EVENT_KD, /**< keyword detection event */ 133 SOF_CTRL_EVENT_VAD, /**< voice act 133 SOF_CTRL_EVENT_VAD, /**< voice activity detection event */ 134 }; 134 }; 135 135 136 /** 136 /** 137 * Generic notification data. 137 * Generic notification data. 138 */ 138 */ 139 struct sof_ipc_comp_event { 139 struct sof_ipc_comp_event { 140 struct sof_ipc_reply rhdr; 140 struct sof_ipc_reply rhdr; 141 uint16_t src_comp_type; /**< COMP_TYPE 141 uint16_t src_comp_type; /**< COMP_TYPE_ */ 142 uint32_t src_comp_id; /**< source co 142 uint32_t src_comp_id; /**< source component id */ 143 uint32_t event_type; /**< event typ 143 uint32_t event_type; /**< event type - SOF_CTRL_EVENT_* */ 144 uint32_t num_elems; /**< in array 144 uint32_t num_elems; /**< in array elems or bytes for data type */ 145 145 146 /* reserved for future use */ 146 /* reserved for future use */ 147 uint32_t reserved[8]; 147 uint32_t reserved[8]; 148 148 149 /* control data - add new types if nee 149 /* control data - add new types if needed */ 150 union { 150 union { 151 /* data can be used by binary 151 /* data can be used by binary controls */ 152 struct sof_abi_hdr data[0]; 152 struct sof_abi_hdr data[0]; 153 /* event specific values */ 153 /* event specific values */ 154 uint32_t event_value; 154 uint32_t event_value; 155 }; 155 }; 156 } __packed; 156 } __packed; 157 157 158 #endif 158 #endif 159 159
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.