2 * skl_topology.h - Intel HDA Platform topology header file
4 * Copyright (C) 2014-15 Intel Corp
5 * Author: Jeeja KP <jeeja.kp@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 #ifndef __SKL_TOPOLOGY_H__
22 #define __SKL_TOPOLOGY_H__
24 #include <linux/types.h>
26 #include <sound/hdaudio_ext.h>
27 #include <sound/soc.h>
29 #include "skl-tplg-interface.h"
31 #define BITS_PER_BYTE 8
32 #define MAX_TS_GROUPS 8
33 #define MAX_DMIC_TS_GROUPS 4
34 #define MAX_FIXED_DMIC_PARAMS_SIZE 727
36 /* Maximum number of coefficients up down mixer module */
37 #define UP_DOWN_MIXER_MAX_COEFF 6
39 enum skl_channel_index {
41 SKL_CHANNEL_RIGHT = 1,
42 SKL_CHANNEL_CENTER = 2,
43 SKL_CHANNEL_LEFT_SURROUND = 3,
44 SKL_CHANNEL_CENTER_SURROUND = 3,
45 SKL_CHANNEL_RIGHT_SURROUND = 4,
47 SKL_CHANNEL_INVALID = 0xF,
58 enum skl_interleaving {
59 /* [s1_ch1...s1_chN,...,sM_ch1...sM_chN] */
60 SKL_INTERLEAVING_PER_CHANNEL = 0,
61 /* [s1_ch1...sM_ch1,...,s1_chN...sM_chN] */
62 SKL_INTERLEAVING_PER_SAMPLE = 1,
78 SKL_FS_128000 = 128000,
79 SKL_FS_176400 = 176400,
80 SKL_FS_192000 = 192000,
84 enum skl_widget_type {
85 SKL_WIDGET_VMIXER = 1,
91 struct skl_audio_data_format {
92 enum skl_s_freq s_freq;
93 enum skl_bitdepth bit_depth;
95 enum skl_ch_cfg ch_cfg;
96 enum skl_interleaving interleaving;
97 u8 number_of_channels;
103 struct skl_base_cfg {
108 struct skl_audio_data_format audio_fmt;
111 struct skl_cpr_gtw_cfg {
115 /* not mandatory; required only for DMIC/I2S */
120 struct skl_base_cfg base_cfg;
121 struct skl_audio_data_format out_fmt;
122 u32 cpr_feature_mask;
123 struct skl_cpr_gtw_cfg gtw_cfg;
127 struct skl_src_module_cfg {
128 struct skl_base_cfg base_cfg;
129 enum skl_s_freq src_cfg;
132 struct notification_mask {
137 struct skl_up_down_mixer_cfg {
138 struct skl_base_cfg base_cfg;
139 enum skl_ch_cfg out_ch_cfg;
140 /* This should be set to 1 if user coefficients are required */
142 /* Pass the user coeff in this array */
143 s32 coeff[UP_DOWN_MIXER_MAX_COEFF];
147 SKL_DMA_HDA_HOST_OUTPUT_CLASS = 0,
148 SKL_DMA_HDA_HOST_INPUT_CLASS = 1,
149 SKL_DMA_HDA_HOST_INOUT_CLASS = 2,
150 SKL_DMA_HDA_LINK_OUTPUT_CLASS = 8,
151 SKL_DMA_HDA_LINK_INPUT_CLASS = 9,
152 SKL_DMA_HDA_LINK_INOUT_CLASS = 0xA,
153 SKL_DMA_DMIC_LINK_INPUT_CLASS = 0xB,
154 SKL_DMA_I2S_LINK_OUTPUT_CLASS = 0xC,
155 SKL_DMA_I2S_LINK_INPUT_CLASS = 0xD,
158 union skl_ssp_dma_node {
161 u8 time_slot_index:4;
166 union skl_connector_node_id {
175 struct skl_module_fmt {
183 struct skl_module_inst_id {
188 struct skl_module_pin {
189 struct skl_module_inst_id id;
195 struct skl_specific_cfg {
200 enum skl_pipe_state {
201 SKL_PIPE_INVALID = 0,
202 SKL_PIPE_CREATED = 1,
207 struct skl_pipe_module {
208 struct snd_soc_dapm_widget *w;
209 struct list_head node;
212 struct skl_pipe_params {
227 struct skl_pipe_params *p_params;
228 enum skl_pipe_state state;
229 struct list_head w_list;
232 enum skl_module_state {
233 SKL_MODULE_UNINIT = 0,
234 SKL_MODULE_INIT_DONE = 1,
235 SKL_MODULE_LOADED = 2,
236 SKL_MODULE_UNLOADED = 3,
237 SKL_MODULE_BIND_DONE = 4
240 struct skl_module_cfg {
241 struct skl_module_inst_id id;
242 struct skl_module_fmt in_fmt;
243 struct skl_module_fmt out_fmt;
261 struct skl_module_pin *m_in_pin;
262 struct skl_module_pin *m_out_pin;
263 enum skl_module_type m_type;
264 enum skl_hw_conn_type hw_conn_type;
265 enum skl_module_state m_state;
266 struct skl_pipe *pipe;
267 struct skl_specific_cfg formats_config;
270 struct skl_pipeline {
271 struct skl_pipe *pipe;
272 struct list_head node;
275 struct skl_dapm_path_list {
276 struct snd_soc_dapm_path *dapm_path;
277 struct list_head node;
280 static inline struct skl *get_skl_ctx(struct device *dev)
282 struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
284 return ebus_to_skl(ebus);
287 int skl_tplg_be_update_params(struct snd_soc_dai *dai,
288 struct skl_pipe_params *params);
289 void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
290 struct skl_pipe_params *params, int stream);
291 int skl_tplg_init(struct snd_soc_platform *platform,
292 struct hdac_ext_bus *ebus);
293 struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
294 struct snd_soc_dai *dai, int stream);
295 int skl_tplg_update_pipe_params(struct device *dev,
296 struct skl_module_cfg *mconfig, struct skl_pipe_params *params);
298 int skl_create_pipeline(struct skl_sst *ctx, struct skl_pipe *pipe);
300 int skl_run_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
302 int skl_pause_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
304 int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
306 int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
308 int skl_init_module(struct skl_sst *ctx, struct skl_module_cfg *module_config,
311 int skl_bind_modules(struct skl_sst *ctx, struct skl_module_cfg
312 *src_module, struct skl_module_cfg *dst_module);
314 int skl_unbind_modules(struct skl_sst *ctx, struct skl_module_cfg
315 *src_module, struct skl_module_cfg *dst_module);
317 enum skl_bitdepth skl_get_bit_depth(int params);