18e8e69d6SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
223db472bSJeeja KP /*
323db472bSJeeja KP  *  skl_topology.h - Intel HDA Platform topology header file
423db472bSJeeja KP  *
523db472bSJeeja KP  *  Copyright (C) 2014-15 Intel Corp
623db472bSJeeja KP  *  Author: Jeeja KP <jeeja.kp@intel.com>
723db472bSJeeja KP  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
823db472bSJeeja KP  *
923db472bSJeeja KP  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1023db472bSJeeja KP  */
1123db472bSJeeja KP 
1223db472bSJeeja KP #ifndef __SKL_TOPOLOGY_H__
1323db472bSJeeja KP #define __SKL_TOPOLOGY_H__
1423db472bSJeeja KP 
1523db472bSJeeja KP #include <linux/types.h>
1623db472bSJeeja KP 
1723db472bSJeeja KP #include <sound/hdaudio_ext.h>
1823db472bSJeeja KP #include <sound/soc.h>
190c24fdc0SGuenter Roeck #include <uapi/sound/skl-tplg-interface.h>
2023db472bSJeeja KP #include "skl.h"
2123db472bSJeeja KP 
2223db472bSJeeja KP #define BITS_PER_BYTE 8
2323db472bSJeeja KP #define MAX_TS_GROUPS 8
2423db472bSJeeja KP #define MAX_DMIC_TS_GROUPS 4
2523db472bSJeeja KP #define MAX_FIXED_DMIC_PARAMS_SIZE 727
2623db472bSJeeja KP 
2723db472bSJeeja KP /* Maximum number of coefficients up down mixer module */
283e1b96c8SGuneshwor Singh #define UP_DOWN_MIXER_MAX_COEFF		8
2923db472bSJeeja KP 
304cd9899fSHardik T Shah #define MODULE_MAX_IN_PINS	8
314cd9899fSHardik T Shah #define MODULE_MAX_OUT_PINS	8
324cd9899fSHardik T Shah 
337a1b749bSDharageswari R #define SKL_MIC_CH_SUPPORT	4
347a1b749bSDharageswari R #define SKL_MIC_MAX_CH_SUPPORT	8
357a1b749bSDharageswari R #define SKL_DEFAULT_MIC_SEL_GAIN	0x3FF
367a1b749bSDharageswari R #define SKL_MIC_SEL_SWITCH	0x3
377a1b749bSDharageswari R 
38822c3b04SShreyas NC #define SKL_OUTPUT_PIN		0
39822c3b04SShreyas NC #define SKL_INPUT_PIN		1
40822c3b04SShreyas NC #define SKL_MAX_PATH_CONFIGS	8
41822c3b04SShreyas NC #define SKL_MAX_MODULES_IN_PIPE	8
42822c3b04SShreyas NC #define SKL_MAX_MODULE_FORMATS		32
43822c3b04SShreyas NC #define SKL_MAX_MODULE_RESOURCES	32
44822c3b04SShreyas NC 
4523db472bSJeeja KP enum skl_channel_index {
4623db472bSJeeja KP 	SKL_CHANNEL_LEFT = 0,
4723db472bSJeeja KP 	SKL_CHANNEL_RIGHT = 1,
4823db472bSJeeja KP 	SKL_CHANNEL_CENTER = 2,
4923db472bSJeeja KP 	SKL_CHANNEL_LEFT_SURROUND = 3,
5023db472bSJeeja KP 	SKL_CHANNEL_CENTER_SURROUND = 3,
5123db472bSJeeja KP 	SKL_CHANNEL_RIGHT_SURROUND = 4,
5223db472bSJeeja KP 	SKL_CHANNEL_LFE = 7,
5323db472bSJeeja KP 	SKL_CHANNEL_INVALID = 0xF,
5423db472bSJeeja KP };
5523db472bSJeeja KP 
5623db472bSJeeja KP enum skl_bitdepth {
5723db472bSJeeja KP 	SKL_DEPTH_8BIT = 8,
5823db472bSJeeja KP 	SKL_DEPTH_16BIT = 16,
5923db472bSJeeja KP 	SKL_DEPTH_24BIT = 24,
6023db472bSJeeja KP 	SKL_DEPTH_32BIT = 32,
6123db472bSJeeja KP 	SKL_DEPTH_INVALID
6223db472bSJeeja KP };
6323db472bSJeeja KP 
6423db472bSJeeja KP 
6523db472bSJeeja KP enum skl_s_freq {
6623db472bSJeeja KP 	SKL_FS_8000 = 8000,
6723db472bSJeeja KP 	SKL_FS_11025 = 11025,
6823db472bSJeeja KP 	SKL_FS_12000 = 12000,
6923db472bSJeeja KP 	SKL_FS_16000 = 16000,
7023db472bSJeeja KP 	SKL_FS_22050 = 22050,
7123db472bSJeeja KP 	SKL_FS_24000 = 24000,
7223db472bSJeeja KP 	SKL_FS_32000 = 32000,
7323db472bSJeeja KP 	SKL_FS_44100 = 44100,
7423db472bSJeeja KP 	SKL_FS_48000 = 48000,
7523db472bSJeeja KP 	SKL_FS_64000 = 64000,
7623db472bSJeeja KP 	SKL_FS_88200 = 88200,
7723db472bSJeeja KP 	SKL_FS_96000 = 96000,
7823db472bSJeeja KP 	SKL_FS_128000 = 128000,
7923db472bSJeeja KP 	SKL_FS_176400 = 176400,
8023db472bSJeeja KP 	SKL_FS_192000 = 192000,
8123db472bSJeeja KP 	SKL_FS_INVALID
8223db472bSJeeja KP };
8323db472bSJeeja KP 
84a4ad42d2SKareem Shaik #define SKL_MAX_PARAMS_TYPES	4
85a4ad42d2SKareem Shaik 
8623db472bSJeeja KP enum skl_widget_type {
8723db472bSJeeja KP 	SKL_WIDGET_VMIXER = 1,
8823db472bSJeeja KP 	SKL_WIDGET_MIXER = 2,
8923db472bSJeeja KP 	SKL_WIDGET_PGA = 3,
9023db472bSJeeja KP 	SKL_WIDGET_MUX = 4
9123db472bSJeeja KP };
9223db472bSJeeja KP 
9323db472bSJeeja KP struct skl_audio_data_format {
9423db472bSJeeja KP 	enum skl_s_freq s_freq;
9523db472bSJeeja KP 	enum skl_bitdepth bit_depth;
9623db472bSJeeja KP 	u32 channel_map;
9723db472bSJeeja KP 	enum skl_ch_cfg ch_cfg;
9823db472bSJeeja KP 	enum skl_interleaving interleaving;
9923db472bSJeeja KP 	u8 number_of_channels;
10023db472bSJeeja KP 	u8 valid_bit_depth;
10123db472bSJeeja KP 	u8 sample_type;
10223f8d964SGustavo A. R. Silva 	u8 reserved;
10323db472bSJeeja KP } __packed;
10423db472bSJeeja KP 
10523db472bSJeeja KP struct skl_base_cfg {
10684b71067SCezary Rojewski 	u32 cpc;
10723db472bSJeeja KP 	u32 ibs;
10823db472bSJeeja KP 	u32 obs;
10923db472bSJeeja KP 	u32 is_pages;
11023db472bSJeeja KP 	struct skl_audio_data_format audio_fmt;
11123db472bSJeeja KP };
11223db472bSJeeja KP 
11323db472bSJeeja KP struct skl_cpr_gtw_cfg {
11423db472bSJeeja KP 	u32 node_id;
11523db472bSJeeja KP 	u32 dma_buffer_size;
11623db472bSJeeja KP 	u32 config_length;
11723db472bSJeeja KP 	/* not mandatory; required only for DMIC/I2S */
118*1fd61d01SAmadeusz Sławiński 	struct {
119*1fd61d01SAmadeusz Sławiński 		u32 gtw_attrs;
120*1fd61d01SAmadeusz Sławiński 		u32 data[];
121*1fd61d01SAmadeusz Sławiński 	} config_data;
12223db472bSJeeja KP } __packed;
12323db472bSJeeja KP 
124c115fa5eSDharageswari.R struct skl_dma_control {
125c115fa5eSDharageswari.R 	u32 node_id;
126c115fa5eSDharageswari.R 	u32 config_length;
127936b9df7SGustavo A. R. Silva 	u32 config_data[];
128c115fa5eSDharageswari.R } __packed;
129c115fa5eSDharageswari.R 
13023db472bSJeeja KP struct skl_cpr_cfg {
13123db472bSJeeja KP 	struct skl_base_cfg base_cfg;
13223db472bSJeeja KP 	struct skl_audio_data_format out_fmt;
13323db472bSJeeja KP 	u32 cpr_feature_mask;
13423db472bSJeeja KP 	struct skl_cpr_gtw_cfg gtw_cfg;
13523db472bSJeeja KP } __packed;
13623db472bSJeeja KP 
13738a77085SPradeep Tewani struct skl_cpr_pin_fmt {
13838a77085SPradeep Tewani 	u32 sink_id;
13938a77085SPradeep Tewani 	struct skl_audio_data_format src_fmt;
14038a77085SPradeep Tewani 	struct skl_audio_data_format dst_fmt;
14138a77085SPradeep Tewani } __packed;
142a0ffe48bSHardik T Shah 
143a0ffe48bSHardik T Shah struct skl_src_module_cfg {
144a0ffe48bSHardik T Shah 	struct skl_base_cfg base_cfg;
145a0ffe48bSHardik T Shah 	enum skl_s_freq src_cfg;
146a0ffe48bSHardik T Shah } __packed;
147a0ffe48bSHardik T Shah 
148a0ffe48bSHardik T Shah struct skl_up_down_mixer_cfg {
149a0ffe48bSHardik T Shah 	struct skl_base_cfg base_cfg;
150a0ffe48bSHardik T Shah 	enum skl_ch_cfg out_ch_cfg;
151a0ffe48bSHardik T Shah 	/* This should be set to 1 if user coefficients are required */
152a0ffe48bSHardik T Shah 	u32 coeff_sel;
153a0ffe48bSHardik T Shah 	/* Pass the user coeff in this array */
154a0ffe48bSHardik T Shah 	s32 coeff[UP_DOWN_MIXER_MAX_COEFF];
155da3417feSGuneshwor Singh 	u32 ch_map;
156a0ffe48bSHardik T Shah } __packed;
157a0ffe48bSHardik T Shah 
158db5a3f83SSzymon Mielczarek struct skl_pin_format {
159db5a3f83SSzymon Mielczarek 	u32 pin_idx;
160db5a3f83SSzymon Mielczarek 	u32 buf_size;
161db5a3f83SSzymon Mielczarek 	struct skl_audio_data_format audio_fmt;
162db5a3f83SSzymon Mielczarek } __packed;
163db5a3f83SSzymon Mielczarek 
164db5a3f83SSzymon Mielczarek struct skl_base_cfg_ext {
165db5a3f83SSzymon Mielczarek 	u16 nr_input_pins;
166db5a3f83SSzymon Mielczarek 	u16 nr_output_pins;
167db5a3f83SSzymon Mielczarek 	u8 reserved[8];
168db5a3f83SSzymon Mielczarek 	u32 priv_param_length;
169db5a3f83SSzymon Mielczarek 	/* Input pin formats followed by output ones. */
1705224f790SGustavo A. R. Silva 	struct skl_pin_format pins_fmt[];
171db5a3f83SSzymon Mielczarek } __packed;
172db5a3f83SSzymon Mielczarek 
173399b210bSJeeja KP struct skl_algo_cfg {
174399b210bSJeeja KP 	struct skl_base_cfg  base_cfg;
175936b9df7SGustavo A. R. Silva 	char params[];
176399b210bSJeeja KP } __packed;
177399b210bSJeeja KP 
178fd18110fSDharageswari R struct skl_base_outfmt_cfg {
179fd18110fSDharageswari R 	struct skl_base_cfg base_cfg;
180fd18110fSDharageswari R 	struct skl_audio_data_format out_fmt;
181fd18110fSDharageswari R } __packed;
182fd18110fSDharageswari R 
18323db472bSJeeja KP enum skl_dma_type {
18423db472bSJeeja KP 	SKL_DMA_HDA_HOST_OUTPUT_CLASS = 0,
18523db472bSJeeja KP 	SKL_DMA_HDA_HOST_INPUT_CLASS = 1,
18623db472bSJeeja KP 	SKL_DMA_HDA_HOST_INOUT_CLASS = 2,
18723db472bSJeeja KP 	SKL_DMA_HDA_LINK_OUTPUT_CLASS = 8,
18823db472bSJeeja KP 	SKL_DMA_HDA_LINK_INPUT_CLASS = 9,
18923db472bSJeeja KP 	SKL_DMA_HDA_LINK_INOUT_CLASS = 0xA,
19023db472bSJeeja KP 	SKL_DMA_DMIC_LINK_INPUT_CLASS = 0xB,
19123db472bSJeeja KP 	SKL_DMA_I2S_LINK_OUTPUT_CLASS = 0xC,
19223db472bSJeeja KP 	SKL_DMA_I2S_LINK_INPUT_CLASS = 0xD,
19323db472bSJeeja KP };
19423db472bSJeeja KP 
19523db472bSJeeja KP union skl_ssp_dma_node {
19623db472bSJeeja KP 	u8 val;
19723db472bSJeeja KP 	struct {
198d7b18813SJeeja KP 		u8 time_slot_index:4;
19923db472bSJeeja KP 		u8 i2s_instance:4;
20023db472bSJeeja KP 	} dma_node;
20123db472bSJeeja KP };
20223db472bSJeeja KP 
20323db472bSJeeja KP union skl_connector_node_id {
20423db472bSJeeja KP 	u32 val;
20523db472bSJeeja KP 	struct {
20623db472bSJeeja KP 		u32 vindex:8;
20723db472bSJeeja KP 		u32 dma_type:4;
20823db472bSJeeja KP 		u32 rsvd:20;
20923db472bSJeeja KP 	} node;
21023db472bSJeeja KP };
21123db472bSJeeja KP 
21223db472bSJeeja KP struct skl_module_fmt {
21323db472bSJeeja KP 	u32 channels;
21423db472bSJeeja KP 	u32 s_freq;
21523db472bSJeeja KP 	u32 bit_depth;
21623db472bSJeeja KP 	u32 valid_bit_depth;
21723db472bSJeeja KP 	u32 ch_cfg;
2184cd9899fSHardik T Shah 	u32 interleaving_style;
2194cd9899fSHardik T Shah 	u32 sample_type;
2204cd9899fSHardik T Shah 	u32 ch_map;
22123db472bSJeeja KP };
22223db472bSJeeja KP 
2234f745708SJeeja KP struct skl_module_cfg;
2244f745708SJeeja KP 
2255e8f0ee4SDharageswari R struct skl_mod_inst_map {
2265e8f0ee4SDharageswari R 	u16 mod_id;
2275e8f0ee4SDharageswari R 	u16 inst_id;
2285e8f0ee4SDharageswari R };
2295e8f0ee4SDharageswari R 
23024ada035SMark Brown struct skl_uuid_inst_map {
23124ada035SMark Brown 	u16 inst_id;
23224ada035SMark Brown 	u16 reserved;
2339e0784d0SAndy Shevchenko 	guid_t mod_uuid;
23424ada035SMark Brown } __packed;
23524ada035SMark Brown 
2365e8f0ee4SDharageswari R struct skl_kpb_params {
2375e8f0ee4SDharageswari R 	u32 num_modules;
23824ada035SMark Brown 	union {
2396fed3265SGustavo A. R. Silva 		DECLARE_FLEX_ARRAY(struct skl_mod_inst_map, map);
2406fed3265SGustavo A. R. Silva 		DECLARE_FLEX_ARRAY(struct skl_uuid_inst_map, map_uuid);
24124ada035SMark Brown 	} u;
2425e8f0ee4SDharageswari R };
2435e8f0ee4SDharageswari R 
24423db472bSJeeja KP struct skl_module_inst_id {
2459e0784d0SAndy Shevchenko 	guid_t mod_uuid;
246b7c50555SVinod Koul 	int module_id;
24723db472bSJeeja KP 	u32 instance_id;
248700a9a63SDharageswari R 	int pvt_id;
24923db472bSJeeja KP };
25023db472bSJeeja KP 
2514f745708SJeeja KP enum skl_module_pin_state {
2524f745708SJeeja KP 	SKL_PIN_UNBIND = 0,
2534f745708SJeeja KP 	SKL_PIN_BIND_DONE = 1,
2544f745708SJeeja KP };
2554f745708SJeeja KP 
25623db472bSJeeja KP struct skl_module_pin {
25723db472bSJeeja KP 	struct skl_module_inst_id id;
25823db472bSJeeja KP 	bool is_dynamic;
25923db472bSJeeja KP 	bool in_use;
2604f745708SJeeja KP 	enum skl_module_pin_state pin_state;
2614f745708SJeeja KP 	struct skl_module_cfg *tgt_mcfg;
26223db472bSJeeja KP };
26323db472bSJeeja KP 
26423db472bSJeeja KP struct skl_specific_cfg {
2654ced1827SJeeja KP 	u32 set_params;
266abb74003SJeeja KP 	u32 param_id;
26723db472bSJeeja KP 	u32 caps_size;
26823db472bSJeeja KP 	u32 *caps;
26923db472bSJeeja KP };
27023db472bSJeeja KP 
27123db472bSJeeja KP enum skl_pipe_state {
27223db472bSJeeja KP 	SKL_PIPE_INVALID = 0,
27323db472bSJeeja KP 	SKL_PIPE_CREATED = 1,
27423db472bSJeeja KP 	SKL_PIPE_PAUSED = 2,
2752004432fSJeeja KP 	SKL_PIPE_STARTED = 3,
2762004432fSJeeja KP 	SKL_PIPE_RESET = 4
27723db472bSJeeja KP };
27823db472bSJeeja KP 
27923db472bSJeeja KP struct skl_pipe_module {
28023db472bSJeeja KP 	struct snd_soc_dapm_widget *w;
28123db472bSJeeja KP 	struct list_head node;
28223db472bSJeeja KP };
28323db472bSJeeja KP 
28423db472bSJeeja KP struct skl_pipe_params {
28523db472bSJeeja KP 	u8 host_dma_id;
28623db472bSJeeja KP 	u8 link_dma_id;
28723db472bSJeeja KP 	u32 ch;
28823db472bSJeeja KP 	u32 s_freq;
28923db472bSJeeja KP 	u32 s_fmt;
290322fa431SAmadeusz Sławiński 	u32 s_cont;
29123db472bSJeeja KP 	u8 linktype;
29212c3be0eSJeeja KP 	snd_pcm_format_t format;
29312c3be0eSJeeja KP 	int link_index;
29423db472bSJeeja KP 	int stream;
2957f975a38SJeeja KP 	unsigned int host_bps;
2967f975a38SJeeja KP 	unsigned int link_bps;
29723db472bSJeeja KP };
29823db472bSJeeja KP 
299f6fa56e2SRamesh Babu struct skl_pipe_fmt {
300f6fa56e2SRamesh Babu 	u32 freq;
301f6fa56e2SRamesh Babu 	u8 channels;
302f6fa56e2SRamesh Babu 	u8 bps;
303f6fa56e2SRamesh Babu };
304f6fa56e2SRamesh Babu 
305f6fa56e2SRamesh Babu struct skl_pipe_mcfg {
306f6fa56e2SRamesh Babu 	u8 res_idx;
307f6fa56e2SRamesh Babu 	u8 fmt_idx;
308f6fa56e2SRamesh Babu };
309f6fa56e2SRamesh Babu 
310f6fa56e2SRamesh Babu struct skl_path_config {
311f6fa56e2SRamesh Babu 	u8 mem_pages;
312f6fa56e2SRamesh Babu 	struct skl_pipe_fmt in_fmt;
313f6fa56e2SRamesh Babu 	struct skl_pipe_fmt out_fmt;
314f6fa56e2SRamesh Babu };
315f6fa56e2SRamesh Babu 
31623db472bSJeeja KP struct skl_pipe {
31723db472bSJeeja KP 	u8 ppl_id;
31823db472bSJeeja KP 	u8 pipe_priority;
31923db472bSJeeja KP 	u16 conn_type;
32023db472bSJeeja KP 	u32 memory_pages;
3218a0cb236SVinod Koul 	u8 lp_mode;
32223db472bSJeeja KP 	struct skl_pipe_params *p_params;
32323db472bSJeeja KP 	enum skl_pipe_state state;
324f6fa56e2SRamesh Babu 	u8 direction;
325f6fa56e2SRamesh Babu 	u8 cur_config_idx;
326f6fa56e2SRamesh Babu 	u8 nr_cfgs;
327f6fa56e2SRamesh Babu 	struct skl_path_config configs[SKL_MAX_PATH_CONFIGS];
32823db472bSJeeja KP 	struct list_head w_list;
329f0aa94faSJeeja KP 	bool passthru;
33023db472bSJeeja KP };
33123db472bSJeeja KP 
33223db472bSJeeja KP enum skl_module_state {
33323db472bSJeeja KP 	SKL_MODULE_UNINIT = 0,
334e4e95d82SGustaw Lewandowski 	SKL_MODULE_INIT_DONE = 1,
335e4e95d82SGustaw Lewandowski 	SKL_MODULE_BIND_DONE = 2,
33623db472bSJeeja KP };
33723db472bSJeeja KP 
3386bd9dcf3SVinod Koul enum d0i3_capability {
3396bd9dcf3SVinod Koul 	SKL_D0I3_NONE = 0,
3406bd9dcf3SVinod Koul 	SKL_D0I3_STREAMING = 1,
3416bd9dcf3SVinod Koul 	SKL_D0I3_NON_STREAMING = 2,
3426bd9dcf3SVinod Koul };
3436bd9dcf3SVinod Koul 
344822c3b04SShreyas NC struct skl_module_pin_fmt {
345822c3b04SShreyas NC 	u8 id;
346822c3b04SShreyas NC 	struct skl_module_fmt fmt;
347822c3b04SShreyas NC };
348822c3b04SShreyas NC 
349822c3b04SShreyas NC struct skl_module_iface {
350822c3b04SShreyas NC 	u8 fmt_idx;
351822c3b04SShreyas NC 	u8 nr_in_fmt;
352822c3b04SShreyas NC 	u8 nr_out_fmt;
353822c3b04SShreyas NC 	struct skl_module_pin_fmt inputs[MAX_IN_QUEUE];
354822c3b04SShreyas NC 	struct skl_module_pin_fmt outputs[MAX_OUT_QUEUE];
355822c3b04SShreyas NC };
356822c3b04SShreyas NC 
357822c3b04SShreyas NC struct skl_module_pin_resources {
358822c3b04SShreyas NC 	u8 pin_index;
359822c3b04SShreyas NC 	u32 buf_size;
360822c3b04SShreyas NC };
361822c3b04SShreyas NC 
362822c3b04SShreyas NC struct skl_module_res {
363822c3b04SShreyas NC 	u8 id;
364822c3b04SShreyas NC 	u32 is_pages;
365822c3b04SShreyas NC 	u32 ibs;
366822c3b04SShreyas NC 	u32 obs;
367822c3b04SShreyas NC 	u32 dma_buffer_size;
368822c3b04SShreyas NC 	u32 cpc;
369822c3b04SShreyas NC 	u8 nr_input_pins;
370822c3b04SShreyas NC 	u8 nr_output_pins;
371822c3b04SShreyas NC 	struct skl_module_pin_resources input[MAX_IN_QUEUE];
372822c3b04SShreyas NC 	struct skl_module_pin_resources output[MAX_OUT_QUEUE];
373822c3b04SShreyas NC };
374822c3b04SShreyas NC 
375822c3b04SShreyas NC struct skl_module {
3769e0784d0SAndy Shevchenko 	guid_t uuid;
377822c3b04SShreyas NC 	u8 loadable;
378822c3b04SShreyas NC 	u8 input_pin_type;
379822c3b04SShreyas NC 	u8 output_pin_type;
380822c3b04SShreyas NC 	u8 max_input_pins;
381822c3b04SShreyas NC 	u8 max_output_pins;
382822c3b04SShreyas NC 	u8 nr_resources;
383822c3b04SShreyas NC 	u8 nr_interfaces;
384822c3b04SShreyas NC 	struct skl_module_res resources[SKL_MAX_MODULE_RESOURCES];
385822c3b04SShreyas NC 	struct skl_module_iface formats[SKL_MAX_MODULE_FORMATS];
386822c3b04SShreyas NC };
387822c3b04SShreyas NC 
38823db472bSJeeja KP struct skl_module_cfg {
38909305da9SShreyas NC 	u8 guid[16];
39023db472bSJeeja KP 	struct skl_module_inst_id id;
391f6fa56e2SRamesh Babu 	struct skl_module *module;
392f6fa56e2SRamesh Babu 	int res_idx;
393f6fa56e2SRamesh Babu 	int fmt_idx;
394a4ad42d2SKareem Shaik 	int fmt_cfg_idx;
39504afbbbbSHardik T Shah 	u8 domain;
3964cd9899fSHardik T Shah 	bool homogenous_inputs;
3974cd9899fSHardik T Shah 	bool homogenous_outputs;
3984cd9899fSHardik T Shah 	struct skl_module_fmt in_fmt[MODULE_MAX_IN_PINS];
3994cd9899fSHardik T Shah 	struct skl_module_fmt out_fmt[MODULE_MAX_OUT_PINS];
40023db472bSJeeja KP 	u8 max_in_queue;
40123db472bSJeeja KP 	u8 max_out_queue;
40223db472bSJeeja KP 	u8 in_queue_mask;
40323db472bSJeeja KP 	u8 out_queue_mask;
40423db472bSJeeja KP 	u8 in_queue;
40523db472bSJeeja KP 	u8 out_queue;
40623db472bSJeeja KP 	u8 is_loadable;
40723db472bSJeeja KP 	u8 core_id;
40823db472bSJeeja KP 	u8 dev_type;
40923db472bSJeeja KP 	u8 dma_id;
41023db472bSJeeja KP 	u8 time_slot;
4117a1b749bSDharageswari R 	u8 dmic_ch_combo_index;
4127a1b749bSDharageswari R 	u32 dmic_ch_type;
41323db472bSJeeja KP 	u32 params_fixup;
41423db472bSJeeja KP 	u32 converter;
41523db472bSJeeja KP 	u32 vbus_id;
416b18c458dSJeeja KP 	u32 mem_pages;
4176bd9dcf3SVinod Koul 	enum d0i3_capability d0i3_caps;
418939df3adSRamesh Babu 	u32 dma_buffer_size; /* in milli seconds */
41923db472bSJeeja KP 	struct skl_module_pin *m_in_pin;
42023db472bSJeeja KP 	struct skl_module_pin *m_out_pin;
42123db472bSJeeja KP 	enum skl_module_type m_type;
42223db472bSJeeja KP 	enum skl_hw_conn_type  hw_conn_type;
42323db472bSJeeja KP 	enum skl_module_state m_state;
42423db472bSJeeja KP 	struct skl_pipe *pipe;
425a4ad42d2SKareem Shaik 	struct skl_specific_cfg formats_config[SKL_MAX_PARAMS_TYPES];
426f6fa56e2SRamesh Babu 	struct skl_pipe_mcfg mod_cfg[SKL_MAX_MODULES_IN_PIPE];
42723db472bSJeeja KP };
428a0ffe48bSHardik T Shah 
429abb74003SJeeja KP struct skl_algo_data {
430abb74003SJeeja KP 	u32 param_id;
4314ced1827SJeeja KP 	u32 set_params;
432abb74003SJeeja KP 	u32 max;
4330d682104SDharageswari R 	u32 size;
434abb74003SJeeja KP 	char *params;
435abb74003SJeeja KP };
436abb74003SJeeja KP 
437e4e2d2f4SJeeja KP struct skl_pipeline {
438e4e2d2f4SJeeja KP 	struct skl_pipe *pipe;
439e4e2d2f4SJeeja KP 	struct list_head node;
440e4e2d2f4SJeeja KP };
441e4e2d2f4SJeeja KP 
442b8c722ddSJeeja KP struct skl_module_deferred_bind {
443b8c722ddSJeeja KP 	struct skl_module_cfg *src;
444b8c722ddSJeeja KP 	struct skl_module_cfg *dst;
445b8c722ddSJeeja KP 	struct list_head node;
446b8c722ddSJeeja KP };
447b8c722ddSJeeja KP 
4487a1b749bSDharageswari R struct skl_mic_sel_config {
4497a1b749bSDharageswari R 	u16 mic_switch;
4507a1b749bSDharageswari R 	u16 flags;
4517a1b749bSDharageswari R 	u16 blob[SKL_MIC_MAX_CH_SUPPORT][SKL_MIC_MAX_CH_SUPPORT];
4527a1b749bSDharageswari R } __packed;
4537a1b749bSDharageswari R 
4547a1b749bSDharageswari R enum skl_channel {
4557a1b749bSDharageswari R 	SKL_CH_MONO = 1,
4567a1b749bSDharageswari R 	SKL_CH_STEREO = 2,
4577a1b749bSDharageswari R 	SKL_CH_TRIO = 3,
4587a1b749bSDharageswari R 	SKL_CH_QUATRO = 4,
4597a1b749bSDharageswari R };
4607a1b749bSDharageswari R 
get_skl_ctx(struct device * dev)461bcc2a2dcSCezary Rojewski static inline struct skl_dev *get_skl_ctx(struct device *dev)
462d93f8e55SVinod Koul {
46376f56faeSRakesh Ughreja 	struct hdac_bus *bus = dev_get_drvdata(dev);
464d93f8e55SVinod Koul 
46576f56faeSRakesh Ughreja 	return bus_to_skl(bus);
466d93f8e55SVinod Koul }
467d93f8e55SVinod Koul 
468cfb0a873SVinod Koul int skl_tplg_be_update_params(struct snd_soc_dai *dai,
469cfb0a873SVinod Koul 	struct skl_pipe_params *params);
470bcc2a2dcSCezary Rojewski int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
4715514830dSJaikrishna Nemallapudi 			u32 caps_size, u32 node_id);
472cfb0a873SVinod Koul void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
473cfb0a873SVinod Koul 	struct skl_pipe_params *params, int stream);
47424ada035SMark Brown int skl_tplg_init(struct snd_soc_component *component,
4758f0ccd59SPierre-Louis Bossart 				struct hdac_bus *bus);
476e79986ceSAmadeusz Sławiński void skl_tplg_exit(struct snd_soc_component *component,
477e79986ceSAmadeusz Sławiński 				struct hdac_bus *bus);
478cfb0a873SVinod Koul struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
479cfb0a873SVinod Koul 		struct snd_soc_dai *dai, int stream);
480cfb0a873SVinod Koul int skl_tplg_update_pipe_params(struct device *dev,
481cfb0a873SVinod Koul 		struct skl_module_cfg *mconfig, struct skl_pipe_params *params);
482cfb0a873SVinod Koul 
483bcc2a2dcSCezary Rojewski void skl_tplg_d0i3_get(struct skl_dev *skl, enum d0i3_capability caps);
484bcc2a2dcSCezary Rojewski void skl_tplg_d0i3_put(struct skl_dev *skl, enum d0i3_capability caps);
485a83e3b4cSVinod Koul 
486bcc2a2dcSCezary Rojewski int skl_create_pipeline(struct skl_dev *skl, struct skl_pipe *pipe);
487c9b1e834SJeeja KP 
488bcc2a2dcSCezary Rojewski int skl_run_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
489c9b1e834SJeeja KP 
490bcc2a2dcSCezary Rojewski int skl_pause_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
491c9b1e834SJeeja KP 
492bcc2a2dcSCezary Rojewski int skl_delete_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
493c9b1e834SJeeja KP 
494bcc2a2dcSCezary Rojewski int skl_stop_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
495c9b1e834SJeeja KP 
496bcc2a2dcSCezary Rojewski int skl_reset_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
4972004432fSJeeja KP 
4988f0ccd59SPierre-Louis Bossart int skl_init_module(struct skl_dev *skl, struct skl_module_cfg *mconfig);
499beb73b26SJeeja KP 
500bcc2a2dcSCezary Rojewski int skl_bind_modules(struct skl_dev *skl, struct skl_module_cfg
5018f0ccd59SPierre-Louis Bossart 	*src_mcfg, struct skl_module_cfg *dst_mcfg);
502beb73b26SJeeja KP 
503bcc2a2dcSCezary Rojewski int skl_unbind_modules(struct skl_dev *skl, struct skl_module_cfg
5048f0ccd59SPierre-Louis Bossart 	*src_mcfg, struct skl_module_cfg *dst_mcfg);
505beb73b26SJeeja KP 
506bcc2a2dcSCezary Rojewski int skl_set_module_params(struct skl_dev *skl, u32 *params, int size,
5079939a9c3SJeeja KP 			u32 param_id, struct skl_module_cfg *mcfg);
508bcc2a2dcSCezary Rojewski int skl_get_module_params(struct skl_dev *skl, u32 *params, int size,
5097d9f2911SOmair M Abdullah 			  u32 param_id, struct skl_module_cfg *mcfg);
5109939a9c3SJeeja KP 
511718a42b5SDharageswari.R struct skl_module_cfg *skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai,
512718a42b5SDharageswari.R 								int stream);
51323db472bSJeeja KP enum skl_bitdepth skl_get_bit_depth(int params);
514ad036bdeSJeeja KP int skl_pcm_host_dma_prepare(struct device *dev,
515ad036bdeSJeeja KP 			struct skl_pipe_params *params);
516ad036bdeSJeeja KP int skl_pcm_link_dma_prepare(struct device *dev,
517ad036bdeSJeeja KP 			struct skl_pipe_params *params);
518606e21fdSGuneshwor Singh 
519c60b613aSLiam Girdwood int skl_dai_load(struct snd_soc_component *cmp, int index,
520c60b613aSLiam Girdwood 		struct snd_soc_dai_driver *dai_drv,
521c60b613aSLiam Girdwood 		struct snd_soc_tplg_pcm *pcm, struct snd_soc_dai *dai);
522bcc2a2dcSCezary Rojewski void skl_tplg_add_moduleid_in_bind_params(struct skl_dev *skl,
52324ada035SMark Brown 				struct snd_soc_dapm_widget *w);
52423db472bSJeeja KP #endif
525