1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __SKL_IPC_H
17#define __SKL_IPC_H
18
19#include <linux/irqreturn.h>
20#include "../common/sst-ipc.h"
21
22struct sst_dsp;
23struct skl_sst;
24struct sst_generic_ipc;
25
26enum skl_ipc_pipeline_state {
27 PPL_INVALID_STATE = 0,
28 PPL_UNINITIALIZED = 1,
29 PPL_RESET = 2,
30 PPL_PAUSED = 3,
31 PPL_RUNNING = 4,
32 PPL_ERROR_STOP = 5,
33 PPL_SAVED = 6,
34 PPL_RESTORED = 7
35};
36
37struct skl_ipc_dxstate_info {
38 u32 core_mask;
39 u32 dx_mask;
40};
41
42struct skl_ipc_header {
43 u32 primary;
44 u32 extension;
45};
46
47struct skl_dsp_cores {
48 unsigned int count;
49 enum skl_dsp_states *state;
50 int *usage_count;
51};
52
53
54
55
56
57
58
59
60
61
62struct skl_d0i3_data {
63 int streaming;
64 int non_streaming;
65 int non_d0i3;
66 enum skl_dsp_d0i3_states state;
67 struct delayed_work work;
68};
69
70#define SKL_LIB_NAME_LENGTH 128
71#define SKL_MAX_LIB 16
72
73struct skl_lib_info {
74 char name[SKL_LIB_NAME_LENGTH];
75 const struct firmware *fw;
76};
77
78struct skl_sst {
79 struct device *dev;
80 struct sst_dsp *dsp;
81
82
83 wait_queue_head_t boot_wait;
84 bool boot_complete;
85
86
87 wait_queue_head_t mod_load_wait;
88 bool mod_load_complete;
89 bool mod_load_status;
90
91
92 struct sst_generic_ipc ipc;
93
94
95 void (*enable_miscbdcge)(struct device *dev, bool enable);
96
97 bool miscbdcg_disabled;
98
99
100 struct list_head uuid_list;
101
102
103 bool fw_loaded;
104
105
106 bool is_first_boot;
107
108
109 struct skl_dsp_cores cores;
110
111
112 struct skl_lib_info lib_info[SKL_MAX_LIB];
113 int lib_count;
114
115
116 void (*update_d0i3c)(struct device *dev, bool enable);
117
118 struct skl_d0i3_data d0i3;
119
120 const struct skl_dsp_ops *dsp_ops;
121};
122
123struct skl_ipc_init_instance_msg {
124 u32 module_id;
125 u32 instance_id;
126 u16 param_data_size;
127 u8 ppl_instance_id;
128 u8 core_id;
129 u8 domain;
130};
131
132struct skl_ipc_bind_unbind_msg {
133 u32 module_id;
134 u32 instance_id;
135 u32 dst_module_id;
136 u32 dst_instance_id;
137 u8 src_queue;
138 u8 dst_queue;
139 bool bind;
140};
141
142struct skl_ipc_large_config_msg {
143 u32 module_id;
144 u32 instance_id;
145 u32 large_param_id;
146 u32 param_data_size;
147};
148
149struct skl_ipc_d0ix_msg {
150 u32 module_id;
151 u32 instance_id;
152 u8 streaming;
153 u8 wake;
154};
155
156#define SKL_IPC_BOOT_MSECS 3000
157
158#define SKL_IPC_D3_MASK 0
159#define SKL_IPC_D0_MASK 3
160
161irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
162
163int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
164 u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
165
166int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
167
168int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
169 u8 instance_id, enum skl_ipc_pipeline_state state);
170
171int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
172 u8 instance_id, int dma_id);
173
174int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
175
176int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
177 struct skl_ipc_init_instance_msg *msg, void *param_data);
178
179int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
180 struct skl_ipc_bind_unbind_msg *msg);
181
182int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
183 u8 module_cnt, void *data);
184
185int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
186 u8 module_cnt, void *data);
187
188int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
189 u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
190
191int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
192 struct skl_ipc_large_config_msg *msg, u32 *param);
193
194int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
195 struct skl_ipc_large_config_msg *msg, u32 *param);
196
197int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
198 u8 dma_id, u8 table_id, bool wait);
199
200int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
201 struct skl_ipc_d0ix_msg *msg);
202
203int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
204
205void skl_ipc_int_enable(struct sst_dsp *dsp);
206void skl_ipc_op_int_enable(struct sst_dsp *ctx);
207void skl_ipc_op_int_disable(struct sst_dsp *ctx);
208void skl_ipc_int_disable(struct sst_dsp *dsp);
209
210bool skl_ipc_int_status(struct sst_dsp *dsp);
211void skl_ipc_free(struct sst_generic_ipc *ipc);
212int skl_ipc_init(struct device *dev, struct skl_sst *skl);
213void skl_clear_module_cnt(struct sst_dsp *ctx);
214
215void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
216 struct skl_ipc_header header);
217int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
218 struct skl_ipc_header header);
219void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
220 size_t tx_size);
221#endif
222