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
;
77 wait_queue_head_t boot_wait
;
81 struct sst_generic_ipc ipc
;
83 /* callback for miscbdge */
84 void (*enable_miscbdcge
)(struct device
*dev
, bool enable
);
85 /* Is CGCTL.MISCBDCGE disabled */
86 bool miscbdcg_disabled
;
88 /* Populate module information */
89 struct list_head uuid_list
;
91 /* Is firmware loaded */
98 struct skl_dsp_cores cores
;
101 struct skl_dfw_manifest manifest
;
103 /* Callback to update D0i3C register */
104 void (*update_d0i3c
)(struct device
*dev
, bool enable
);
106 struct skl_d0i3_data d0i3
;
109 struct skl_ipc_init_instance_msg
{
118 struct skl_ipc_bind_unbind_msg
{
128 struct skl_ipc_large_config_msg
{
135 struct skl_ipc_d0ix_msg
{
142 #define SKL_IPC_BOOT_MSECS 3000
144 #define SKL_IPC_D3_MASK 0
145 #define SKL_IPC_D0_MASK 3
147 irqreturn_t
skl_dsp_irq_thread_handler(int irq
, void *context
);
149 int skl_ipc_create_pipeline(struct sst_generic_ipc
*sst_ipc
,
150 u16 ppl_mem_size
, u8 ppl_type
, u8 instance_id
, u8 lp_mode
);
152 int skl_ipc_delete_pipeline(struct sst_generic_ipc
*sst_ipc
, u8 instance_id
);
154 int skl_ipc_set_pipeline_state(struct sst_generic_ipc
*sst_ipc
,
155 u8 instance_id
, enum skl_ipc_pipeline_state state
);
157 int skl_ipc_save_pipeline(struct sst_generic_ipc
*ipc
,
158 u8 instance_id
, int dma_id
);
160 int skl_ipc_restore_pipeline(struct sst_generic_ipc
*ipc
, u8 instance_id
);
162 int skl_ipc_init_instance(struct sst_generic_ipc
*sst_ipc
,
163 struct skl_ipc_init_instance_msg
*msg
, void *param_data
);
165 int skl_ipc_bind_unbind(struct sst_generic_ipc
*sst_ipc
,
166 struct skl_ipc_bind_unbind_msg
*msg
);
168 int skl_ipc_load_modules(struct sst_generic_ipc
*ipc
,
169 u8 module_cnt
, void *data
);
171 int skl_ipc_unload_modules(struct sst_generic_ipc
*ipc
,
172 u8 module_cnt
, void *data
);
174 int skl_ipc_set_dx(struct sst_generic_ipc
*ipc
,
175 u8 instance_id
, u16 module_id
, struct skl_ipc_dxstate_info
*dx
);
177 int skl_ipc_set_large_config(struct sst_generic_ipc
*ipc
,
178 struct skl_ipc_large_config_msg
*msg
, u32
*param
);
180 int skl_ipc_get_large_config(struct sst_generic_ipc
*ipc
,
181 struct skl_ipc_large_config_msg
*msg
, u32
*param
);
183 int skl_sst_ipc_load_library(struct sst_generic_ipc
*ipc
,
184 u8 dma_id
, u8 table_id
);
186 int skl_ipc_set_d0ix(struct sst_generic_ipc
*ipc
,
187 struct skl_ipc_d0ix_msg
*msg
);
189 int skl_ipc_check_D0i0(struct sst_dsp
*dsp
, bool state
);
191 void skl_ipc_int_enable(struct sst_dsp
*dsp
);
192 void skl_ipc_op_int_enable(struct sst_dsp
*ctx
);
193 void skl_ipc_op_int_disable(struct sst_dsp
*ctx
);
194 void skl_ipc_int_disable(struct sst_dsp
*dsp
);
196 bool skl_ipc_int_status(struct sst_dsp
*dsp
);
197 void skl_ipc_free(struct sst_generic_ipc
*ipc
);
198 int skl_ipc_init(struct device
*dev
, struct skl_sst
*skl
);
199 void skl_clear_module_cnt(struct sst_dsp
*ctx
);
201 #endif /* __SKL_IPC_H */