]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - sound/soc/intel/skylake/skl-sst-ipc.h
Merge remote-tracking branches 'asoc/topic/inntel', 'asoc/topic/input', 'asoc/topic...
[mirror_ubuntu-bionic-kernel.git] / sound / soc / intel / skylake / skl-sst-ipc.h
CommitLineData
b81fd263
SP
1/*
2 * Intel SKL IPC Support
3 *
4 * Copyright (C) 2014-15, Intel Corporation.
5 *
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.
9 *
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.
14 */
15
16#ifndef __SKL_IPC_H
17#define __SKL_IPC_H
18
b81fd263
SP
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
052f103c
J
47#define SKL_DSP_CORES_MAX 2
48
49struct skl_dsp_cores {
50 unsigned int count;
51 enum skl_dsp_states state[SKL_DSP_CORES_MAX];
52 int usage_count[SKL_DSP_CORES_MAX];
53};
54
5bb4cd46
J
55/**
56 * skl_d0i3_data: skl D0i3 counters data struct
57 *
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
63 */
64struct skl_d0i3_data {
65 int streaming;
66 int non_streaming;
67 int non_d0i3;
68 enum skl_dsp_d0i3_states state;
69 struct delayed_work work;
70};
71
b81fd263
SP
72struct skl_sst {
73 struct device *dev;
74 struct sst_dsp *dsp;
75
76 /* boot */
77 wait_queue_head_t boot_wait;
78 bool boot_complete;
79
80 /* IPC messaging */
81 struct sst_generic_ipc ipc;
0c8ba9d2
J
82
83 /* callback for miscbdge */
84 void (*enable_miscbdcge)(struct device *dev, bool enable);
8d983be8 85 /* Is CGCTL.MISCBDCGE disabled */
0c8ba9d2 86 bool miscbdcg_disabled;
ea6b3e94
SN
87
88 /* Populate module information */
89 struct list_head uuid_list;
1665c177
J
90
91 /* Is firmware loaded */
92 bool fw_loaded;
052f103c 93
78cdbbda
VK
94 /* first boot ? */
95 bool is_first_boot;
96
052f103c
J
97 /* multi-core */
98 struct skl_dsp_cores cores;
15ecaba9
K
99
100 /* tplg manifest */
101 struct skl_dfw_manifest manifest;
a26a3f53
PS
102
103 /* Callback to update D0i3C register */
104 void (*update_d0i3c)(struct device *dev, bool enable);
5bb4cd46
J
105
106 struct skl_d0i3_data d0i3;
b81fd263
SP
107};
108
109struct skl_ipc_init_instance_msg {
110 u32 module_id;
111 u32 instance_id;
112 u16 param_data_size;
113 u8 ppl_instance_id;
114 u8 core_id;
3d4006cd 115 u8 domain;
b81fd263
SP
116};
117
118struct skl_ipc_bind_unbind_msg {
119 u32 module_id;
120 u32 instance_id;
121 u32 dst_module_id;
122 u32 dst_instance_id;
123 u8 src_queue;
124 u8 dst_queue;
125 bool bind;
126};
127
128struct skl_ipc_large_config_msg {
129 u32 module_id;
130 u32 instance_id;
131 u32 large_param_id;
132 u32 param_data_size;
133};
134
41b7523f
PS
135struct skl_ipc_d0ix_msg {
136 u32 module_id;
137 u32 instance_id;
138 u8 streaming;
139 u8 wake;
140};
141
b81fd263
SP
142#define SKL_IPC_BOOT_MSECS 3000
143
144#define SKL_IPC_D3_MASK 0
145#define SKL_IPC_D0_MASK 3
146
147irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
148
149int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
8a0cb236 150 u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
b81fd263
SP
151
152int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
153
154int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
155 u8 instance_id, enum skl_ipc_pipeline_state state);
156
157int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
158 u8 instance_id, int dma_id);
159
160int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
161
162int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
163 struct skl_ipc_init_instance_msg *msg, void *param_data);
164
165int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
166 struct skl_ipc_bind_unbind_msg *msg);
167
6c5768b3
D
168int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
169 u8 module_cnt, void *data);
170
171int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
172 u8 module_cnt, void *data);
173
b81fd263
SP
174int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
175 u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
176
177int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
178 struct skl_ipc_large_config_msg *msg, u32 *param);
179
cce1c7f3
MJ
180int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
181 struct skl_ipc_large_config_msg *msg, u32 *param);
182
20fb2fbd
RB
183int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
184 u8 dma_id, u8 table_id);
185
41b7523f
PS
186int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
187 struct skl_ipc_d0ix_msg *msg);
188
a83e3b4c
VK
189int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
190
b81fd263
SP
191void skl_ipc_int_enable(struct sst_dsp *dsp);
192void skl_ipc_op_int_enable(struct sst_dsp *ctx);
84c9e283 193void skl_ipc_op_int_disable(struct sst_dsp *ctx);
b81fd263
SP
194void skl_ipc_int_disable(struct sst_dsp *dsp);
195
196bool skl_ipc_int_status(struct sst_dsp *dsp);
197void skl_ipc_free(struct sst_generic_ipc *ipc);
198int skl_ipc_init(struct device *dev, struct skl_sst *skl);
fe3f4442 199void skl_clear_module_cnt(struct sst_dsp *ctx);
b81fd263
SP
200
201#endif /* __SKL_IPC_H */