Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2022 Intel Corporation. All rights reserved.
0007  */
0008 
0009 #ifndef __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
0010 #define __INCLUDE_SOUND_SOF_IPC4_TOPOLOGY_H__
0011 
0012 #include <sound/sof/ipc4/header.h>
0013 
0014 #define SOF_IPC4_FW_PAGE_SIZE BIT(12)
0015 #define SOF_IPC4_FW_PAGE(x) ((((x) + BIT(12) - 1) & ~(BIT(12) - 1)) >> 12)
0016 #define SOF_IPC4_FW_ROUNDUP(x) (((x) + BIT(6) - 1) & (~(BIT(6) - 1)))
0017 
0018 #define SOF_IPC4_MODULE_LOAD_TYPE       GENMASK(3, 0)
0019 #define SOF_IPC4_MODULE_AUTO_START      BIT(4)
0020 /*
0021  * Two module schedule domains in fw :
0022  * LL domain - Low latency domain
0023  * DP domain - Data processing domain
0024  * The LL setting should be equal to !DP setting
0025  */
0026 #define SOF_IPC4_MODULE_LL      BIT(5)
0027 #define SOF_IPC4_MODULE_DP      BIT(6)
0028 #define SOF_IPC4_MODULE_LIB_CODE        BIT(7)
0029 
0030 #define SOF_IPC4_MODULE_INSTANCE_LIST_ITEM_SIZE 12
0031 #define SOF_IPC4_PIPELINE_OBJECT_SIZE 448
0032 #define SOF_IPC4_DATA_QUEUE_OBJECT_SIZE 128
0033 #define SOF_IPC4_LL_TASK_OBJECT_SIZE 72
0034 #define SOF_IPC4_DP_TASK_OBJECT_SIZE 104
0035 #define SOF_IPC4_DP_TASK_LIST_SIZE (12 + 8)
0036 #define SOF_IPC4_LL_TASK_LIST_ITEM_SIZE 12
0037 #define SOF_IPC4_FW_MAX_PAGE_COUNT 20
0038 #define SOF_IPC4_FW_MAX_QUEUE_COUNT 8
0039 
0040 /* Node index and mask applicable for host copier and ALH/HDA type DAI copiers */
0041 #define SOF_IPC4_NODE_INDEX_MASK    0xFF
0042 #define SOF_IPC4_NODE_INDEX(x)  ((x) & SOF_IPC4_NODE_INDEX_MASK)
0043 #define SOF_IPC4_NODE_TYPE(x)  ((x) << 8)
0044 
0045 /* Node ID for SSP type DAI copiers */
0046 #define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
0047 
0048 /* Node ID for DMIC type DAI copiers */
0049 #define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) (((x) & 0x7) << 5)
0050 
0051 #define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
0052 #define SOF_IPC4_VOL_ZERO_DB    0x7fffffff
0053 
0054 #define ALH_MAX_NUMBER_OF_GTW   16
0055 
0056 /*
0057  * The base of multi-gateways. Multi-gateways addressing starts from
0058  * ALH_MULTI_GTW_BASE and there are ALH_MULTI_GTW_COUNT multi-sources
0059  * and ALH_MULTI_GTW_COUNT multi-sinks available.
0060  * Addressing is continuous from ALH_MULTI_GTW_BASE to
0061  * ALH_MULTI_GTW_BASE + ALH_MULTI_GTW_COUNT - 1.
0062  */
0063 #define ALH_MULTI_GTW_BASE  0x50
0064 /* A magic number from FW */
0065 #define ALH_MULTI_GTW_COUNT 8
0066 
0067 /**
0068  * struct sof_ipc4_pipeline - pipeline config data
0069  * @priority: Priority of this pipeline
0070  * @lp_mode: Low power mode
0071  * @mem_usage: Memory usage
0072  * @state: Pipeline state
0073  * @msg: message structure for pipeline
0074  */
0075 struct sof_ipc4_pipeline {
0076     uint32_t priority;
0077     uint32_t lp_mode;
0078     uint32_t mem_usage;
0079     int state;
0080     struct sof_ipc4_msg msg;
0081 };
0082 
0083 /**
0084  * struct sof_ipc4_available_audio_format - Available audio formats
0085  * @base_config: Available base config
0086  * @out_audio_fmt: Available output audio format
0087  * @ref_audio_fmt: Reference audio format to match runtime audio format
0088  * @dma_buffer_size: Available Gateway DMA buffer size (in bytes)
0089  * @audio_fmt_num: Number of available audio formats
0090  */
0091 struct sof_ipc4_available_audio_format {
0092     struct sof_ipc4_base_module_cfg *base_config;
0093     struct sof_ipc4_audio_format *out_audio_fmt;
0094     struct sof_ipc4_audio_format *ref_audio_fmt;
0095     u32 *dma_buffer_size;
0096     int audio_fmt_num;
0097 };
0098 
0099 /**
0100  * struct sof_copier_gateway_cfg - IPC gateway configuration
0101  * @node_id: ID of Gateway Node
0102  * @dma_buffer_size: Preferred Gateway DMA buffer size (in bytes)
0103  * @config_length: Length of gateway node configuration blob specified in #config_data
0104  * config_data: Gateway node configuration blob
0105  */
0106 struct sof_copier_gateway_cfg {
0107     uint32_t node_id;
0108     uint32_t dma_buffer_size;
0109     uint32_t config_length;
0110     uint32_t config_data[];
0111 };
0112 
0113 /**
0114  * struct sof_ipc4_copier_data - IPC data for copier
0115  * @base_config: Base configuration including input audio format
0116  * @out_format: Output audio format
0117  * @copier_feature_mask: Copier feature mask
0118  * @gtw_cfg: Gateway configuration
0119  */
0120 struct sof_ipc4_copier_data {
0121     struct sof_ipc4_base_module_cfg base_config;
0122     struct sof_ipc4_audio_format out_format;
0123     uint32_t copier_feature_mask;
0124     struct sof_copier_gateway_cfg gtw_cfg;
0125 };
0126 
0127 /**
0128  * struct sof_ipc4_gtw_attributes: Gateway attributes
0129  * @lp_buffer_alloc: Gateway data requested in low power memory
0130  * @alloc_from_reg_file: Gateway data requested in register file memory
0131  * @rsvd: reserved for future use
0132  */
0133 struct sof_ipc4_gtw_attributes {
0134     uint32_t lp_buffer_alloc : 1;
0135     uint32_t alloc_from_reg_file : 1;
0136     uint32_t rsvd : 30;
0137 };
0138 
0139 /** struct sof_ipc4_alh_multi_gtw_cfg: ALH gateway cfg data
0140  * @count: Number of streams (valid items in mapping array)
0141  * @alh_id: ALH stream id of a single ALH stream aggregated
0142  * @channel_mask: Channel mask
0143  * @mapping: ALH streams
0144  */
0145 struct sof_ipc4_alh_multi_gtw_cfg {
0146     uint32_t count;
0147     struct {
0148         uint32_t alh_id;
0149         uint32_t channel_mask;
0150     } mapping[ALH_MAX_NUMBER_OF_GTW];
0151 } __packed;
0152 
0153 /** struct sof_ipc4_alh_configuration_blob: ALH blob
0154  * @gw_attr: Gateway attributes
0155  * @alh_cfg: ALH configuration data
0156  */
0157 struct sof_ipc4_alh_configuration_blob {
0158     struct sof_ipc4_gtw_attributes gw_attr;
0159     struct sof_ipc4_alh_multi_gtw_cfg alh_cfg;
0160 };
0161 
0162 /**
0163  * struct sof_ipc4_copier - copier config data
0164  * @data: IPC copier data
0165  * @copier_config: Copier + blob
0166  * @ipc_config_size: Size of copier_config
0167  * @available_fmt: Available audio format
0168  * @frame_fmt: frame format
0169  * @msg: message structure for copier
0170  * @gtw_attr: Gateway attributes for copier blob
0171  * @dai_type: DAI type
0172  * @dai_index: DAI index
0173  */
0174 struct sof_ipc4_copier {
0175     struct sof_ipc4_copier_data data;
0176     u32 *copier_config;
0177     uint32_t ipc_config_size;
0178     void *ipc_config_data;
0179     struct sof_ipc4_available_audio_format available_fmt;
0180     u32 frame_fmt;
0181     struct sof_ipc4_msg msg;
0182     struct sof_ipc4_gtw_attributes *gtw_attr;
0183     u32 dai_type;
0184     int dai_index;
0185 };
0186 
0187 /**
0188  * struct sof_ipc4_ctrl_value_chan: generic channel mapped value data
0189  * @channel: Channel ID
0190  * @value: gain value
0191  */
0192 struct sof_ipc4_ctrl_value_chan {
0193     u32 channel;
0194     u32 value;
0195 };
0196 
0197 /**
0198  * struct sof_ipc4_control_data - IPC data for kcontrol IO
0199  * @msg: message structure for kcontrol IO
0200  * @index: pipeline ID
0201  * @chanv: channel ID and value array used by volume type controls
0202  * @data: data for binary kcontrols
0203  */
0204 struct sof_ipc4_control_data {
0205     struct sof_ipc4_msg msg;
0206     int index;
0207 
0208     union {
0209         struct sof_ipc4_ctrl_value_chan chanv[0];
0210         struct sof_abi_hdr data[0];
0211     };
0212 };
0213 
0214 /**
0215  * struct sof_ipc4_gain_data - IPC gain blob
0216  * @channels: Channels
0217  * @init_val: Initial value
0218  * @curve_type: Curve type
0219  * @reserved: reserved for future use
0220  * @curve_duration: Curve duration
0221  */
0222 struct sof_ipc4_gain_data {
0223     uint32_t channels;
0224     uint32_t init_val;
0225     uint32_t curve_type;
0226     uint32_t reserved;
0227     uint32_t curve_duration;
0228 } __aligned(8);
0229 
0230 /**
0231  * struct sof_ipc4_gain - gain config data
0232  * @base_config: IPC base config data
0233  * @data: IPC gain blob
0234  * @available_fmt: Available audio format
0235  * @msg: message structure for gain
0236  */
0237 struct sof_ipc4_gain {
0238     struct sof_ipc4_base_module_cfg base_config;
0239     struct sof_ipc4_gain_data data;
0240     struct sof_ipc4_available_audio_format available_fmt;
0241     struct sof_ipc4_msg msg;
0242 };
0243 
0244 /**
0245  * struct sof_ipc4_mixer - mixer config data
0246  * @base_config: IPC base config data
0247  * @available_fmt: Available audio format
0248  * @msg: IPC4 message struct containing header and data info
0249  */
0250 struct sof_ipc4_mixer {
0251     struct sof_ipc4_base_module_cfg base_config;
0252     struct sof_ipc4_available_audio_format available_fmt;
0253     struct sof_ipc4_msg msg;
0254 };
0255 
0256 /**
0257  * struct sof_ipc4_src SRC config data
0258  * @base_config: IPC base config data
0259  * @sink_rate: Output rate for sink module
0260  * @available_fmt: Available audio format
0261  * @msg: IPC4 message struct containing header and data info
0262  */
0263 struct sof_ipc4_src {
0264     struct sof_ipc4_base_module_cfg base_config;
0265     uint32_t sink_rate;
0266     struct sof_ipc4_available_audio_format available_fmt;
0267     struct sof_ipc4_msg msg;
0268 };
0269 
0270 #endif