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