Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Add userspace ABI support

Add userspace ABI for audio userspace application IO outside of regular
ALSA PCM and kcontrols. This is intended to be used to format
coefficients and data for custom processing components.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Liam Girdwood and committed by
Mark Brown
4483151e 70cd5254

+721
+62
include/uapi/sound/sof/abi.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + /** 10 + * SOF ABI versioning is based on Semantic Versioning where we have a given 11 + * MAJOR.MINOR.PATCH version number. See https://semver.org/ 12 + * 13 + * Rules for incrementing or changing version :- 14 + * 15 + * 1) Increment MAJOR version if you make incompatible API changes. MINOR and 16 + * PATCH should be reset to 0. 17 + * 18 + * 2) Increment MINOR version if you add backwards compatible features or 19 + * changes. PATCH should be reset to 0. 20 + * 21 + * 3) Increment PATCH version if you add backwards compatible bug fixes. 22 + */ 23 + 24 + #ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__ 25 + #define __INCLUDE_UAPI_SOUND_SOF_ABI_H__ 26 + 27 + /* SOF ABI version major, minor and patch numbers */ 28 + #define SOF_ABI_MAJOR 3 29 + #define SOF_ABI_MINOR 4 30 + #define SOF_ABI_PATCH 0 31 + 32 + /* SOF ABI version number. Format within 32bit word is MMmmmppp */ 33 + #define SOF_ABI_MAJOR_SHIFT 24 34 + #define SOF_ABI_MAJOR_MASK 0xff 35 + #define SOF_ABI_MINOR_SHIFT 12 36 + #define SOF_ABI_MINOR_MASK 0xfff 37 + #define SOF_ABI_PATCH_SHIFT 0 38 + #define SOF_ABI_PATCH_MASK 0xfff 39 + 40 + #define SOF_ABI_VER(major, minor, patch) \ 41 + (((major) << SOF_ABI_MAJOR_SHIFT) | \ 42 + ((minor) << SOF_ABI_MINOR_SHIFT) | \ 43 + ((patch) << SOF_ABI_PATCH_SHIFT)) 44 + 45 + #define SOF_ABI_VERSION_MAJOR(version) \ 46 + (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK) 47 + #define SOF_ABI_VERSION_MINOR(version) \ 48 + (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK) 49 + #define SOF_ABI_VERSION_PATCH(version) \ 50 + (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK) 51 + 52 + #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver) \ 53 + (SOF_ABI_VERSION_MAJOR((sof_ver)) != \ 54 + SOF_ABI_VERSION_MAJOR((client_ver)) \ 55 + ) 56 + 57 + #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH) 58 + 59 + /* SOF ABI magic number "SOF\0". */ 60 + #define SOF_ABI_MAGIC 0x00464F53 61 + 62 + #endif
+172
include/uapi/sound/sof/eq.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__ 10 + #define __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__ 11 + 12 + /* FIR EQ type */ 13 + 14 + #define SOF_EQ_FIR_IDX_SWITCH 0 15 + 16 + #define SOF_EQ_FIR_MAX_SIZE 4096 /* Max size allowed for coef data in bytes */ 17 + 18 + #define SOF_EQ_FIR_MAX_LENGTH 192 /* Max length for individual filter */ 19 + 20 + #define SOF_EQ_FIR_MAX_RESPONSES 8 /* A blob can define max 8 FIR EQs */ 21 + 22 + /* 23 + * eq_fir_configuration data structure contains this information 24 + * uint32_t size 25 + * This is the number of bytes need to store the received EQ 26 + * configuration. 27 + * uint16_t channels_in_config 28 + * This describes the number of channels in this EQ config data. It 29 + * can be different from PLATFORM_MAX_CHANNELS. 30 + * uint16_t number_of_responses 31 + * 0=no responses, 1=one response defined, 2=two responses defined, etc. 32 + * int16_t data[] 33 + * assign_response[channels_in_config] 34 + * 0 = use first response, 1 = use 2nd response, etc. 35 + * E.g. {0, 0, 0, 0, 1, 1, 1, 1} would apply to channels 0-3 the 36 + * same first defined response and for to channels 4-7 the second. 37 + * coef_data[] 38 + * Repeated data 39 + * { filter_length, output_shift, h[] } 40 + * for every EQ response defined where vector h has filter_length 41 + * number of coefficients. Coefficients in h[] are in Q1.15 format. 42 + * E.g. 16384 (Q1.15) = 0.5. The shifts are number of right shifts. 43 + * 44 + * NOTE: The channels_in_config must be even to have coef_data aligned to 45 + * 32 bit word in RAM. Therefore a mono EQ assign must be duplicated to 2ch 46 + * even if it would never used. Similarly a 5ch EQ assign must be increased 47 + * to 6ch. EQ init will return an error if this is not met. 48 + * 49 + * NOTE: The filter_length must be multiple of four. Therefore the filter must 50 + * be padded from the end with zeros have this condition met. 51 + */ 52 + 53 + struct sof_eq_fir_config { 54 + uint32_t size; 55 + uint16_t channels_in_config; 56 + uint16_t number_of_responses; 57 + 58 + /* reserved */ 59 + uint32_t reserved[4]; 60 + 61 + int16_t data[]; 62 + } __packed; 63 + 64 + struct sof_eq_fir_coef_data { 65 + int16_t length; /* Number of FIR taps */ 66 + int16_t out_shift; /* Amount of right shifts at output */ 67 + 68 + /* reserved */ 69 + uint32_t reserved[4]; 70 + 71 + int16_t coef[]; /* FIR coefficients */ 72 + } __packed; 73 + 74 + /* In the struct above there's two 16 bit words (length, shift) and four 75 + * reserved 32 bit words before the actual FIR coefficients. This information 76 + * is used in parsing of the configuration blob. 77 + */ 78 + #define SOF_EQ_FIR_COEF_NHEADER \ 79 + (sizeof(struct sof_eq_fir_coef_data) / sizeof(int16_t)) 80 + 81 + /* IIR EQ type */ 82 + 83 + #define SOF_EQ_IIR_IDX_SWITCH 0 84 + 85 + #define SOF_EQ_IIR_MAX_SIZE 1024 /* Max size allowed for coef data in bytes */ 86 + 87 + #define SOF_EQ_IIR_MAX_RESPONSES 8 /* A blob can define max 8 IIR EQs */ 88 + 89 + /* eq_iir_configuration 90 + * uint32_t channels_in_config 91 + * This describes the number of channels in this EQ config data. It 92 + * can be different from PLATFORM_MAX_CHANNELS. 93 + * uint32_t number_of_responses_defined 94 + * 0=no responses, 1=one response defined, 2=two responses defined, etc. 95 + * int32_t data[] 96 + * Data consist of two parts. First is the response assign vector that 97 + * has length of channels_in_config. The latter part is coefficient 98 + * data. 99 + * uint32_t assign_response[channels_in_config] 100 + * -1 = not defined, 0 = use first response, 1 = use 2nd, etc. 101 + * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the 102 + * same first defined response and leave channels 4-7 unequalized. 103 + * coefficient_data[] 104 + * <1st EQ> 105 + * uint32_t num_biquads 106 + * uint32_t num_biquads_in_series 107 + * <1st biquad> 108 + * int32_t coef_a2 Q2.30 format 109 + * int32_t coef_a1 Q2.30 format 110 + * int32_t coef_b2 Q2.30 format 111 + * int32_t coef_b1 Q2.30 format 112 + * int32_t coef_b0 Q2.30 format 113 + * int32_t output_shift number of shifts right, shift left is negative 114 + * int32_t output_gain Q2.14 format 115 + * <2nd biquad> 116 + * ... 117 + * <2nd EQ> 118 + * 119 + * Note: A flat response biquad can be made with a section set to 120 + * b0 = 1.0, gain = 1.0, and other parameters set to 0 121 + * {0, 0, 0, 0, 1073741824, 0, 16484} 122 + */ 123 + 124 + struct sof_eq_iir_config { 125 + uint32_t size; 126 + uint32_t channels_in_config; 127 + uint32_t number_of_responses; 128 + 129 + /* reserved */ 130 + uint32_t reserved[4]; 131 + 132 + int32_t data[]; /* eq_assign[channels], eq 0, eq 1, ... */ 133 + } __packed; 134 + 135 + struct sof_eq_iir_header_df2t { 136 + uint32_t num_sections; 137 + uint32_t num_sections_in_series; 138 + 139 + /* reserved */ 140 + uint32_t reserved[4]; 141 + 142 + int32_t biquads[]; /* Repeated biquad coefficients */ 143 + } __packed; 144 + 145 + struct sof_eq_iir_biquad_df2t { 146 + int32_t a2; /* Q2.30 */ 147 + int32_t a1; /* Q2.30 */ 148 + int32_t b2; /* Q2.30 */ 149 + int32_t b1; /* Q2.30 */ 150 + int32_t b0; /* Q2.30 */ 151 + int32_t output_shift; /* Number of right shifts */ 152 + int32_t output_gain; /* Q2.14 */ 153 + } __packed; 154 + 155 + /* A full 22th order equalizer with 11 biquads cover octave bands 1-11 in 156 + * in the 0 - 20 kHz bandwidth. 157 + */ 158 + #define SOF_EQ_IIR_DF2T_BIQUADS_MAX 11 159 + 160 + /* The number of int32_t words in sof_eq_iir_header_df2t: 161 + * num_sections, num_sections_in_series, reserved[4] 162 + */ 163 + #define SOF_EQ_IIR_NHEADER_DF2T \ 164 + (sizeof(struct sof_eq_iir_header_df2t) / sizeof(int32_t)) 165 + 166 + /* The number of int32_t words in sof_eq_iir_biquad_df2t: 167 + * a2, a1, b2, b1, b0, output_shift, output_gain 168 + */ 169 + #define SOF_EQ_IIR_NBIQUAD_DF2T \ 170 + (sizeof(struct sof_eq_iir_biquad_df2t) / sizeof(int32_t)) 171 + 172 + #endif
+78
include/uapi/sound/sof/fw.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + /* 10 + * Firmware file format . 11 + */ 12 + 13 + #ifndef __INCLUDE_UAPI_SOF_FW_H__ 14 + #define __INCLUDE_UAPI_SOF_FW_H__ 15 + 16 + #define SND_SOF_FW_SIG_SIZE 4 17 + #define SND_SOF_FW_ABI 1 18 + #define SND_SOF_FW_SIG "Reef" 19 + 20 + /* 21 + * Firmware module is made up of 1 . N blocks of different types. The 22 + * Block header is used to determine where and how block is to be copied in the 23 + * DSP/host memory space. 24 + */ 25 + enum snd_sof_fw_blk_type { 26 + SOF_FW_BLK_TYPE_INVALID = -1, 27 + SOF_FW_BLK_TYPE_START = 0, 28 + SOF_FW_BLK_TYPE_RSRVD0 = SOF_FW_BLK_TYPE_START, 29 + SOF_FW_BLK_TYPE_IRAM = 1, /* local instruction RAM */ 30 + SOF_FW_BLK_TYPE_DRAM = 2, /* local data RAM */ 31 + SOF_FW_BLK_TYPE_SRAM = 3, /* system RAM */ 32 + SOF_FW_BLK_TYPE_ROM = 4, 33 + SOF_FW_BLK_TYPE_IMR = 5, 34 + SOF_FW_BLK_TYPE_RSRVD6 = 6, 35 + SOF_FW_BLK_TYPE_RSRVD7 = 7, 36 + SOF_FW_BLK_TYPE_RSRVD8 = 8, 37 + SOF_FW_BLK_TYPE_RSRVD9 = 9, 38 + SOF_FW_BLK_TYPE_RSRVD10 = 10, 39 + SOF_FW_BLK_TYPE_RSRVD11 = 11, 40 + SOF_FW_BLK_TYPE_RSRVD12 = 12, 41 + SOF_FW_BLK_TYPE_RSRVD13 = 13, 42 + SOF_FW_BLK_TYPE_RSRVD14 = 14, 43 + /* use SOF_FW_BLK_TYPE_RSVRDX for new block types */ 44 + SOF_FW_BLK_TYPE_NUM 45 + }; 46 + 47 + struct snd_sof_blk_hdr { 48 + enum snd_sof_fw_blk_type type; 49 + uint32_t size; /* bytes minus this header */ 50 + uint32_t offset; /* offset from base */ 51 + } __packed; 52 + 53 + /* 54 + * Firmware file is made up of 1 .. N different modules types. The module 55 + * type is used to determine how to load and parse the module. 56 + */ 57 + enum snd_sof_fw_mod_type { 58 + SOF_FW_BASE = 0, /* base firmware image */ 59 + SOF_FW_MODULE = 1, /* firmware module */ 60 + }; 61 + 62 + struct snd_sof_mod_hdr { 63 + enum snd_sof_fw_mod_type type; 64 + uint32_t size; /* bytes minus this header */ 65 + uint32_t num_blocks; /* number of blocks */ 66 + } __packed; 67 + 68 + /* 69 + * Firmware file header. 70 + */ 71 + struct snd_sof_fw_header { 72 + unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ 73 + uint32_t file_size; /* size of file minus this header */ 74 + uint32_t num_modules; /* number of modules */ 75 + uint32_t abi; /* version of header format */ 76 + } __packed; 77 + 78 + #endif
+27
include/uapi/sound/sof/header.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ 10 + #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ 11 + 12 + /* 13 + * Header for all non IPC ABI data. 14 + * 15 + * Identifies data type, size and ABI. 16 + * Used by any bespoke component data structures or binary blobs. 17 + */ 18 + struct sof_abi_hdr { 19 + uint32_t magic; /**< 'S', 'O', 'F', '\0' */ 20 + uint32_t type; /**< component specific type */ 21 + uint32_t size; /**< size in bytes of data excl. this struct */ 22 + uint32_t abi; /**< SOF ABI version */ 23 + uint32_t reserved[4]; /**< reserved for future use */ 24 + uint32_t data[0]; /**< Component data - opaque to core */ 25 + } __packed; 26 + 27 + #endif
+188
include/uapi/sound/sof/manifest.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__ 10 + #define __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__ 11 + 12 + /* start offset for base FW module */ 13 + #define SOF_MAN_ELF_TEXT_OFFSET 0x2000 14 + 15 + /* FW Extended Manifest Header id = $AE1 */ 16 + #define SOF_MAN_EXT_HEADER_MAGIC 0x31454124 17 + 18 + /* module type load type */ 19 + #define SOF_MAN_MOD_TYPE_BUILTIN 0 20 + #define SOF_MAN_MOD_TYPE_MODULE 1 21 + 22 + struct sof_man_module_type { 23 + uint32_t load_type:4; /* SOF_MAN_MOD_TYPE_ */ 24 + uint32_t auto_start:1; 25 + uint32_t domain_ll:1; 26 + uint32_t domain_dp:1; 27 + uint32_t rsvd_:25; 28 + }; 29 + 30 + /* segment flags.type */ 31 + #define SOF_MAN_SEGMENT_TEXT 0 32 + #define SOF_MAN_SEGMENT_RODATA 1 33 + #define SOF_MAN_SEGMENT_DATA 1 34 + #define SOF_MAN_SEGMENT_BSS 2 35 + #define SOF_MAN_SEGMENT_EMPTY 15 36 + 37 + union sof_man_segment_flags { 38 + uint32_t ul; 39 + struct { 40 + uint32_t contents:1; 41 + uint32_t alloc:1; 42 + uint32_t load:1; 43 + uint32_t readonly:1; 44 + uint32_t code:1; 45 + uint32_t data:1; 46 + uint32_t _rsvd0:2; 47 + uint32_t type:4; /* MAN_SEGMENT_ */ 48 + uint32_t _rsvd1:4; 49 + uint32_t length:16; /* of segment in pages */ 50 + } r; 51 + } __packed; 52 + 53 + /* 54 + * Module segment descriptor. Used by ROM - Immutable. 55 + */ 56 + struct sof_man_segment_desc { 57 + union sof_man_segment_flags flags; 58 + uint32_t v_base_addr; 59 + uint32_t file_offset; 60 + } __packed; 61 + 62 + /* 63 + * The firmware binary can be split into several modules. 64 + */ 65 + 66 + #define SOF_MAN_MOD_ID_LEN 4 67 + #define SOF_MAN_MOD_NAME_LEN 8 68 + #define SOF_MAN_MOD_SHA256_LEN 32 69 + #define SOF_MAN_MOD_ID {'$', 'A', 'M', 'E'} 70 + 71 + /* 72 + * Each module has an entry in the FW header. Used by ROM - Immutable. 73 + */ 74 + struct sof_man_module { 75 + uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */ 76 + uint8_t name[SOF_MAN_MOD_NAME_LEN]; 77 + uint8_t uuid[16]; 78 + struct sof_man_module_type type; 79 + uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; 80 + uint32_t entry_point; 81 + uint16_t cfg_offset; 82 + uint16_t cfg_count; 83 + uint32_t affinity_mask; 84 + uint16_t instance_max_count; /* max number of instances */ 85 + uint16_t instance_bss_size; /* instance (pages) */ 86 + struct sof_man_segment_desc segment[3]; 87 + } __packed; 88 + 89 + /* 90 + * Each module has a configuration in the FW header. Used by ROM - Immutable. 91 + */ 92 + struct sof_man_mod_config { 93 + uint32_t par[4]; /* module parameters */ 94 + uint32_t is_pages; /* actual size of instance .bss (pages) */ 95 + uint32_t cps; /* cycles per second */ 96 + uint32_t ibs; /* input buffer size (bytes) */ 97 + uint32_t obs; /* output buffer size (bytes) */ 98 + uint32_t module_flags; /* flags, reserved for future use */ 99 + uint32_t cpc; /* cycles per single run */ 100 + uint32_t obls; /* output block size, reserved for future use */ 101 + } __packed; 102 + 103 + /* 104 + * FW Manifest Header 105 + */ 106 + 107 + #define SOF_MAN_FW_HDR_FW_NAME_LEN 8 108 + #define SOF_MAN_FW_HDR_ID {'$', 'A', 'M', '1'} 109 + #define SOF_MAN_FW_HDR_NAME "ADSPFW" 110 + #define SOF_MAN_FW_HDR_FLAGS 0x0 111 + #define SOF_MAN_FW_HDR_FEATURES 0xff 112 + 113 + /* 114 + * The firmware has a standard header that is checked by the ROM on firmware 115 + * loading. preload_page_count is used by DMA code loader and is entire 116 + * image size on CNL. i.e. CNL: total size of the binary’s .text and .rodata 117 + * Used by ROM - Immutable. 118 + */ 119 + struct sof_man_fw_header { 120 + uint8_t header_id[4]; 121 + uint32_t header_len; 122 + uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN]; 123 + /* number of pages of preloaded image loaded by driver */ 124 + uint32_t preload_page_count; 125 + uint32_t fw_image_flags; 126 + uint32_t feature_mask; 127 + uint16_t major_version; 128 + uint16_t minor_version; 129 + uint16_t hotfix_version; 130 + uint16_t build_version; 131 + uint32_t num_module_entries; 132 + uint32_t hw_buf_base_addr; 133 + uint32_t hw_buf_length; 134 + /* target address for binary loading as offset in IMR - must be == base offset */ 135 + uint32_t load_offset; 136 + } __packed; 137 + 138 + /* 139 + * Firmware manifest descriptor. This can contain N modules and N module 140 + * configs. Used by ROM - Immutable. 141 + */ 142 + struct sof_man_fw_desc { 143 + struct sof_man_fw_header header; 144 + 145 + /* Warning - hack for module arrays. For some unknown reason the we 146 + * have a variable size array of struct man_module followed by a 147 + * variable size array of struct mod_config. These should have been 148 + * merged into a variable array of a parent structure. We have to hack 149 + * around this in many places.... 150 + * 151 + * struct sof_man_module man_module[]; 152 + * struct sof_man_mod_config mod_config[]; 153 + */ 154 + 155 + } __packed; 156 + 157 + /* 158 + * Component Descriptor. Used by ROM - Immutable. 159 + */ 160 + struct sof_man_component_desc { 161 + uint32_t reserved[2]; /* all 0 */ 162 + uint32_t version; 163 + uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; 164 + uint32_t base_offset; 165 + uint32_t limit_offset; 166 + uint32_t attributes[4]; 167 + } __packed; 168 + 169 + /* 170 + * Audio DSP extended metadata. Used by ROM - Immutable. 171 + */ 172 + struct sof_man_adsp_meta_file_ext { 173 + uint32_t ext_type; /* always 17 for ADSP extension */ 174 + uint32_t ext_len; 175 + uint32_t imr_type; 176 + uint8_t reserved[16]; /* all 0 */ 177 + struct sof_man_component_desc comp_desc[1]; 178 + } __packed; 179 + 180 + /* 181 + * Module Manifest for rimage module metadata. Not used by ROM. 182 + */ 183 + struct sof_man_module_manifest { 184 + struct sof_man_module module; 185 + uint32_t text_size; 186 + } __packed; 187 + 188 + #endif
+107
include/uapi/sound/sof/tokens.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> 8 + * Keyon Jie <yang.jie@linux.intel.com> 9 + */ 10 + 11 + /* 12 + * Topology IDs and tokens. 13 + * 14 + * ** MUST BE ALIGNED WITH TOPOLOGY CONFIGURATION TOKEN VALUES ** 15 + */ 16 + 17 + #ifndef __INCLUDE_UAPI_SOF_TOPOLOGY_H__ 18 + #define __INCLUDE_UAPI_SOF_TOPOLOGY_H__ 19 + 20 + /* 21 + * Kcontrol IDs 22 + */ 23 + #define SOF_TPLG_KCTL_VOL_ID 256 24 + #define SOF_TPLG_KCTL_ENUM_ID 257 25 + #define SOF_TPLG_KCTL_BYTES_ID 258 26 + #define SOF_TPLG_KCTL_SWITCH_ID 259 27 + 28 + /* 29 + * Tokens - must match values in topology configurations 30 + */ 31 + 32 + /* buffers */ 33 + #define SOF_TKN_BUF_SIZE 100 34 + #define SOF_TKN_BUF_CAPS 101 35 + 36 + /* DAI */ 37 + /* Token retired with ABI 3.2, do not use for new capabilities 38 + * #define SOF_TKN_DAI_DMAC_CONFIG 153 39 + */ 40 + #define SOF_TKN_DAI_TYPE 154 41 + #define SOF_TKN_DAI_INDEX 155 42 + #define SOF_TKN_DAI_DIRECTION 156 43 + 44 + /* scheduling */ 45 + #define SOF_TKN_SCHED_PERIOD 200 46 + #define SOF_TKN_SCHED_PRIORITY 201 47 + #define SOF_TKN_SCHED_MIPS 202 48 + #define SOF_TKN_SCHED_CORE 203 49 + #define SOF_TKN_SCHED_FRAMES 204 50 + #define SOF_TKN_SCHED_TIME_DOMAIN 205 51 + 52 + /* volume */ 53 + #define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250 54 + #define SOF_TKN_VOLUME_RAMP_STEP_MS 251 55 + 56 + /* SRC */ 57 + #define SOF_TKN_SRC_RATE_IN 300 58 + #define SOF_TKN_SRC_RATE_OUT 301 59 + 60 + /* PCM */ 61 + #define SOF_TKN_PCM_DMAC_CONFIG 353 62 + 63 + /* Generic components */ 64 + #define SOF_TKN_COMP_PERIOD_SINK_COUNT 400 65 + #define SOF_TKN_COMP_PERIOD_SOURCE_COUNT 401 66 + #define SOF_TKN_COMP_FORMAT 402 67 + /* Token retired with ABI 3.2, do not use for new capabilities 68 + * #define SOF_TKN_COMP_PRELOAD_COUNT 403 69 + */ 70 + 71 + /* SSP */ 72 + #define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500 73 + #define SOF_TKN_INTEL_SSP_MCLK_ID 501 74 + #define SOF_TKN_INTEL_SSP_SAMPLE_BITS 502 75 + #define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503 76 + #define SOF_TKN_INTEL_SSP_QUIRKS 504 77 + #define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505 78 + 79 + /* DMIC */ 80 + #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 81 + #define SOF_TKN_INTEL_DMIC_CLK_MIN 601 82 + #define SOF_TKN_INTEL_DMIC_CLK_MAX 602 83 + #define SOF_TKN_INTEL_DMIC_DUTY_MIN 603 84 + #define SOF_TKN_INTEL_DMIC_DUTY_MAX 604 85 + #define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605 86 + #define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608 87 + #define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609 88 + 89 + /* DMIC PDM */ 90 + #define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700 91 + #define SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable 701 92 + #define SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable 702 93 + #define SOF_TKN_INTEL_DMIC_PDM_POLARITY_A 703 94 + #define SOF_TKN_INTEL_DMIC_PDM_POLARITY_B 704 95 + #define SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE 705 96 + #define SOF_TKN_INTEL_DMIC_PDM_SKEW 706 97 + 98 + /* Tone */ 99 + #define SOF_TKN_TONE_SAMPLE_RATE 800 100 + 101 + /* Processing Components */ 102 + #define SOF_TKN_PROCESS_TYPE 900 103 + 104 + /* for backward compatibility */ 105 + #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE 106 + 107 + #endif
+21
include/uapi/sound/sof/tone.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__ 10 + #define __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__ 11 + 12 + #define SOF_TONE_IDX_FREQUENCY 0 13 + #define SOF_TONE_IDX_AMPLITUDE 1 14 + #define SOF_TONE_IDX_FREQ_MULT 2 15 + #define SOF_TONE_IDX_AMPL_MULT 3 16 + #define SOF_TONE_IDX_LENGTH 4 17 + #define SOF_TONE_IDX_PERIOD 5 18 + #define SOF_TONE_IDX_REPEATS 6 19 + #define SOF_TONE_IDX_LIN_RAMP_STEP 7 20 + 21 + #endif
+66
include/uapi/sound/sof/trace.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__ 10 + #define __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__ 11 + 12 + /* 13 + * Host system time. 14 + * 15 + * This property is used by the driver to pass down information about 16 + * current system time. It is expressed in us. 17 + * FW translates timestamps (in log entries, probe pockets) to this time 18 + * domain. 19 + * 20 + * (cavs: SystemTime). 21 + */ 22 + struct system_time { 23 + uint32_t val_l; /* Lower dword of current host time value */ 24 + uint32_t val_u; /* Upper dword of current host time value */ 25 + } __packed; 26 + 27 + #define LOG_ENABLE 1 /* Enable logging */ 28 + #define LOG_DISABLE 0 /* Disable logging */ 29 + 30 + #define LOG_LEVEL_CRITICAL 1 /* (FDK fatal) */ 31 + #define LOG_LEVEL_VERBOSE 2 32 + 33 + /* 34 + * Layout of a log fifo. 35 + */ 36 + struct log_buffer_layout { 37 + uint32_t read_ptr; /*read pointer */ 38 + uint32_t write_ptr; /* write pointer */ 39 + uint32_t buffer[0]; /* buffer */ 40 + } __packed; 41 + 42 + /* 43 + * Log buffer status reported by FW. 44 + */ 45 + struct log_buffer_status { 46 + uint32_t core_id; /* ID of core that logged to other half */ 47 + } __packed; 48 + 49 + #define TRACE_ID_LENGTH 12 50 + 51 + /* 52 + * Log entry header. 53 + * 54 + * The header is followed by an array of arguments (uint32_t[]). 55 + * Number of arguments is specified by the params_num field of log_entry 56 + */ 57 + struct log_entry_header { 58 + uint32_t id_0 : TRACE_ID_LENGTH; /* e.g. Pipeline ID */ 59 + uint32_t id_1 : TRACE_ID_LENGTH; /* e.g. Component ID */ 60 + uint32_t core_id : 8; /* Reporting core's id */ 61 + 62 + uint64_t timestamp; /* Timestamp (in dsp ticks) */ 63 + uint32_t log_entry_address; /* Address of log entry in ELF */ 64 + } __packed; 65 + 66 + #endif