2 * Intel SKL IPC Support
4 * Copyright (C) 2014-15, Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as version 2, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
19 #include <linux/irqreturn.h>
20 #include "../common/sst-ipc.h"
24 struct sst_generic_ipc
;
26 enum skl_ipc_pipeline_state
{
27 PPL_INVALID_STATE
= 0,
28 PPL_UNINITIALIZED
= 1,
37 struct skl_ipc_dxstate_info
{
42 struct skl_ipc_header
{
47 #define SKL_DSP_CORES_MAX 2
49 struct skl_dsp_cores
{
51 enum skl_dsp_states state
[SKL_DSP_CORES_MAX
];
52 int usage_count
[SKL_DSP_CORES_MAX
];
56 * skl_d0i3_data: skl D0i3 counters data struct
58 * @streaming: Count of usecases that can attempt streaming D0i3
59 * @non_streaming: Count of usecases that can attempt non-streaming D0i3
60 * @non_d0i3: Count of usecases that cannot attempt D0i3
61 * @state: current state
62 * @work: D0i3 worker thread
64 struct skl_d0i3_data
{
68 enum skl_dsp_d0i3_states state
;
69 struct delayed_work work
;
72 #define SKL_LIB_NAME_LENGTH 128
73 #define SKL_MAX_LIB 16
76 char name
[SKL_LIB_NAME_LENGTH
];
77 const struct firmware
*fw
;
85 wait_queue_head_t boot_wait
;
89 wait_queue_head_t mod_load_wait
;
90 bool mod_load_complete
;
94 struct sst_generic_ipc ipc
;
96 /* callback for miscbdge */
97 void (*enable_miscbdcge
)(struct device
*dev
, bool enable
);
98 /* Is CGCTL.MISCBDCGE disabled */
99 bool miscbdcg_disabled
;
101 /* Populate module information */
102 struct list_head uuid_list
;
104 /* Is firmware loaded */
111 struct skl_dsp_cores cores
;
114 struct skl_lib_info lib_info
[SKL_MAX_LIB
];
117 /* Callback to update D0i3C register */
118 void (*update_d0i3c
)(struct device
*dev
, bool enable
);
120 struct skl_d0i3_data d0i3
;
122 const struct skl_dsp_ops
*dsp_ops
;
125 struct skl_ipc_init_instance_msg
{
134 struct skl_ipc_bind_unbind_msg
{
144 struct skl_ipc_large_config_msg
{
151 struct skl_ipc_d0ix_msg
{
158 #define SKL_IPC_BOOT_MSECS 3000
160 #define SKL_IPC_D3_MASK 0
161 #define SKL_IPC_D0_MASK 3
163 irqreturn_t
skl_dsp_irq_thread_handler(int irq
, void *context
);
165 int skl_ipc_create_pipeline(struct sst_generic_ipc
*sst_ipc
,
166 u16 ppl_mem_size
, u8 ppl_type
, u8 instance_id
, u8 lp_mode
);
168 int skl_ipc_delete_pipeline(struct sst_generic_ipc
*sst_ipc
, u8 instance_id
);
170 int skl_ipc_set_pipeline_state(struct sst_generic_ipc
*sst_ipc
,
171 u8 instance_id
, enum skl_ipc_pipeline_state state
);
173 int skl_ipc_save_pipeline(struct sst_generic_ipc
*ipc
,
174 u8 instance_id
, int dma_id
);
176 int skl_ipc_restore_pipeline(struct sst_generic_ipc
*ipc
, u8 instance_id
);
178 int skl_ipc_init_instance(struct sst_generic_ipc
*sst_ipc
,
179 struct skl_ipc_init_instance_msg
*msg
, void *param_data
);
181 int skl_ipc_bind_unbind(struct sst_generic_ipc
*sst_ipc
,
182 struct skl_ipc_bind_unbind_msg
*msg
);
184 int skl_ipc_load_modules(struct sst_generic_ipc
*ipc
,
185 u8 module_cnt
, void *data
);
187 int skl_ipc_unload_modules(struct sst_generic_ipc
*ipc
,
188 u8 module_cnt
, void *data
);
190 int skl_ipc_set_dx(struct sst_generic_ipc
*ipc
,
191 u8 instance_id
, u16 module_id
, struct skl_ipc_dxstate_info
*dx
);
193 int skl_ipc_set_large_config(struct sst_generic_ipc
*ipc
,
194 struct skl_ipc_large_config_msg
*msg
, u32
*param
);
196 int skl_ipc_get_large_config(struct sst_generic_ipc
*ipc
,
197 struct skl_ipc_large_config_msg
*msg
, u32
*param
);
199 int skl_sst_ipc_load_library(struct sst_generic_ipc
*ipc
,
200 u8 dma_id
, u8 table_id
, bool wait
);
202 int skl_ipc_set_d0ix(struct sst_generic_ipc
*ipc
,
203 struct skl_ipc_d0ix_msg
*msg
);
205 int skl_ipc_check_D0i0(struct sst_dsp
*dsp
, bool state
);
207 void skl_ipc_int_enable(struct sst_dsp
*dsp
);
208 void skl_ipc_op_int_enable(struct sst_dsp
*ctx
);
209 void skl_ipc_op_int_disable(struct sst_dsp
*ctx
);
210 void skl_ipc_int_disable(struct sst_dsp
*dsp
);
212 bool skl_ipc_int_status(struct sst_dsp
*dsp
);
213 void skl_ipc_free(struct sst_generic_ipc
*ipc
);
214 int skl_ipc_init(struct device
*dev
, struct skl_sst
*skl
);
215 void skl_clear_module_cnt(struct sst_dsp
*ctx
);
217 #endif /* __SKL_IPC_H */