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/kthread.h>
20 #include <linux/irqreturn.h>
21 #include "../common/sst-ipc.h"
25 struct sst_generic_ipc;
27 enum skl_ipc_pipeline_state {
28 PPL_INVALID_STATE = 0,
29 PPL_UNINITIALIZED = 1,
38 struct skl_ipc_dxstate_info {
43 struct skl_ipc_header {
48 #define SKL_DSP_CORES_MAX 2
50 struct skl_dsp_cores {
52 enum skl_dsp_states state[SKL_DSP_CORES_MAX];
53 int usage_count[SKL_DSP_CORES_MAX];
61 wait_queue_head_t boot_wait;
65 struct sst_generic_ipc ipc;
67 /* callback for miscbdge */
68 void (*enable_miscbdcge)(struct device *dev, bool enable);
69 /* Is CGCTL.MISCBDCGE disabled */
70 bool miscbdcg_disabled;
72 /* Populate module information */
73 struct list_head uuid_list;
75 /* Is firmware loaded */
82 struct skl_dsp_cores cores;
85 struct skl_dfw_manifest manifest;
88 struct skl_ipc_init_instance_msg {
97 struct skl_ipc_bind_unbind_msg {
107 struct skl_ipc_large_config_msg {
114 #define SKL_IPC_BOOT_MSECS 3000
116 #define SKL_IPC_D3_MASK 0
117 #define SKL_IPC_D0_MASK 3
119 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
121 int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
122 u16 ppl_mem_size, u8 ppl_type, u8 instance_id);
124 int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
126 int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
127 u8 instance_id, enum skl_ipc_pipeline_state state);
129 int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
130 u8 instance_id, int dma_id);
132 int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
134 int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
135 struct skl_ipc_init_instance_msg *msg, void *param_data);
137 int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
138 struct skl_ipc_bind_unbind_msg *msg);
140 int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
141 u8 module_cnt, void *data);
143 int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
144 u8 module_cnt, void *data);
146 int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
147 u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
149 int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
150 struct skl_ipc_large_config_msg *msg, u32 *param);
152 int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
153 struct skl_ipc_large_config_msg *msg, u32 *param);
155 int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
156 u8 dma_id, u8 table_id);
158 void skl_ipc_int_enable(struct sst_dsp *dsp);
159 void skl_ipc_op_int_enable(struct sst_dsp *ctx);
160 void skl_ipc_op_int_disable(struct sst_dsp *ctx);
161 void skl_ipc_int_disable(struct sst_dsp *dsp);
163 bool skl_ipc_int_status(struct sst_dsp *dsp);
164 void skl_ipc_free(struct sst_generic_ipc *ipc);
165 int skl_ipc_init(struct device *dev, struct skl_sst *skl);
166 void skl_clear_module_cnt(struct sst_dsp *ctx);
168 #endif /* __SKL_IPC_H */