hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/sound/soc/intel/skylake/skl.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * skl.h - HD Audio skylake defintions.
34 *
....@@ -5,17 +6,7 @@
56 * Author: Jeeja KP <jeeja.kp@intel.com>
67 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; version 2 of the License.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
179 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
- *
1910 */
2011
2112 #ifndef __SOUND_SOC_SKL_H
....@@ -23,9 +14,10 @@
2314
2415 #include <sound/hda_register.h>
2516 #include <sound/hdaudio_ext.h>
17
+#include <sound/hda_codec.h>
2618 #include <sound/soc.h>
27
-#include "skl-nhlt.h"
2819 #include "skl-ssp-clk.h"
20
+#include "skl-sst-ipc.h"
2921
3022 #define SKL_SUSPEND_DELAY 2000
3123
....@@ -45,14 +37,8 @@
4537 #define DMA_TRANSMITION_START 2
4638 #define DMA_TRANSMITION_STOP 3
4739
40
+#define AZX_VS_EM2_DUM BIT(23)
4841 #define AZX_REG_VS_EM2_L1SEN BIT(13)
49
-
50
-struct skl_dsp_resource {
51
- u32 max_mcps;
52
- u32 max_mem;
53
- u32 mcps;
54
- u32 mem;
55
-};
5642
5743 struct skl_debug;
5844
....@@ -63,15 +49,15 @@
6349
6450 struct skl_astate_config {
6551 u32 count;
66
- struct skl_astate_param astate_table[0];
52
+ struct skl_astate_param astate_table[];
6753 };
6854
6955 struct skl_fw_config {
7056 struct skl_astate_config *astate_cfg;
7157 };
7258
73
-struct skl {
74
- struct hdac_bus hbus;
59
+struct skl_dev {
60
+ struct hda_bus hbus;
7561 struct pci_dev *pci;
7662
7763 unsigned int init_done:1; /* delayed init status */
....@@ -82,16 +68,13 @@
8268 struct snd_soc_dai_driver *dais;
8369
8470 struct nhlt_acpi_table *nhlt; /* nhlt ptr */
85
- struct skl_sst *skl_sst; /* sst skl ctx */
8671
87
- struct skl_dsp_resource resource;
8872 struct list_head ppl_list;
8973 struct list_head bind_list;
9074
9175 const char *fw_name;
9276 char tplg_name[64];
9377 unsigned short pci_id;
94
- const struct firmware *tplg;
9578
9679 int supend_active;
9780
....@@ -103,10 +86,59 @@
10386 bool use_tplg_pcm;
10487 struct skl_fw_config cfg;
10588 struct snd_soc_acpi_mach *mach;
89
+
90
+ struct device *dev;
91
+ struct sst_dsp *dsp;
92
+
93
+ /* boot */
94
+ wait_queue_head_t boot_wait;
95
+ bool boot_complete;
96
+
97
+ /* module load */
98
+ wait_queue_head_t mod_load_wait;
99
+ bool mod_load_complete;
100
+ bool mod_load_status;
101
+
102
+ /* IPC messaging */
103
+ struct sst_generic_ipc ipc;
104
+
105
+ /* callback for miscbdge */
106
+ void (*enable_miscbdcge)(struct device *dev, bool enable);
107
+ /* Is CGCTL.MISCBDCGE disabled */
108
+ bool miscbdcg_disabled;
109
+
110
+ /* Populate module information */
111
+ struct list_head uuid_list;
112
+
113
+ /* Is firmware loaded */
114
+ bool fw_loaded;
115
+
116
+ /* first boot ? */
117
+ bool is_first_boot;
118
+
119
+ /* multi-core */
120
+ struct skl_dsp_cores cores;
121
+
122
+ /* library info */
123
+ struct skl_lib_info lib_info[SKL_MAX_LIB];
124
+ int lib_count;
125
+
126
+ /* Callback to update D0i3C register */
127
+ void (*update_d0i3c)(struct device *dev, bool enable);
128
+
129
+ struct skl_d0i3_data d0i3;
130
+
131
+ const struct skl_dsp_ops *dsp_ops;
132
+
133
+ /* Callback to update dynamic clock and power gating registers */
134
+ void (*clock_power_gating)(struct device *dev, bool enable);
106135 };
107136
108
-#define skl_to_bus(s) (&(s)->hbus)
109
-#define bus_to_skl(bus) container_of(bus, struct skl, hbus)
137
+#define skl_to_bus(s) (&(s)->hbus.core)
138
+#define bus_to_skl(bus) container_of(bus, struct skl_dev, hbus.core)
139
+
140
+#define skl_to_hbus(s) (&(s)->hbus)
141
+#define hbus_to_skl(hbus) container_of((hbus), struct skl_dev, (hbus))
110142
111143 /* to pass dai dma data */
112144 struct skl_dma_params {
....@@ -115,7 +147,6 @@
115147 };
116148
117149 struct skl_machine_pdata {
118
- u32 dmic_num;
119150 bool use_tplg_pcm; /* use dais and dai links from topology */
120151 };
121152
....@@ -126,49 +157,51 @@
126157 int (*init)(struct device *dev, void __iomem *mmio_base,
127158 int irq, const char *fw_name,
128159 struct skl_dsp_loader_ops loader_ops,
129
- struct skl_sst **skl_sst);
130
- int (*init_fw)(struct device *dev, struct skl_sst *ctx);
131
- void (*cleanup)(struct device *dev, struct skl_sst *ctx);
160
+ struct skl_dev **skl_sst);
161
+ int (*init_fw)(struct device *dev, struct skl_dev *skl);
162
+ void (*cleanup)(struct device *dev, struct skl_dev *skl);
132163 };
133164
134165 int skl_platform_unregister(struct device *dev);
135166 int skl_platform_register(struct device *dev);
136167
137
-struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
138
-void skl_nhlt_free(struct nhlt_acpi_table *addr);
139
-struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
140
- u8 link_type, u8 s_fmt, u8 no_ch,
168
+struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
169
+ u8 link_type, u8 s_fmt, u8 num_ch,
141170 u32 s_rate, u8 dirn, u8 dev_type);
142171
143
-int skl_get_dmic_geo(struct skl *skl);
144
-int skl_nhlt_update_topology_bin(struct skl *skl);
145
-int skl_init_dsp(struct skl *skl);
146
-int skl_free_dsp(struct skl *skl);
147
-int skl_suspend_late_dsp(struct skl *skl);
148
-int skl_suspend_dsp(struct skl *skl);
149
-int skl_resume_dsp(struct skl *skl);
150
-void skl_cleanup_resources(struct skl *skl);
172
+int skl_nhlt_update_topology_bin(struct skl_dev *skl);
173
+int skl_init_dsp(struct skl_dev *skl);
174
+int skl_free_dsp(struct skl_dev *skl);
175
+int skl_suspend_late_dsp(struct skl_dev *skl);
176
+int skl_suspend_dsp(struct skl_dev *skl);
177
+int skl_resume_dsp(struct skl_dev *skl);
178
+void skl_cleanup_resources(struct skl_dev *skl);
151179 const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
152180 void skl_update_d0i3c(struct device *dev, bool enable);
153
-int skl_nhlt_create_sysfs(struct skl *skl);
154
-void skl_nhlt_remove_sysfs(struct skl *skl);
155
-void skl_get_clks(struct skl *skl, struct skl_ssp_clk *ssp_clks);
181
+int skl_nhlt_create_sysfs(struct skl_dev *skl);
182
+void skl_nhlt_remove_sysfs(struct skl_dev *skl);
183
+void skl_get_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks);
156184 struct skl_clk_parent_src *skl_get_parent_clk(u8 clk_id);
157
-int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
185
+int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
158186 u32 caps_size, u32 node_id);
159187
160188 struct skl_module_cfg;
161189
162190 #ifdef CONFIG_DEBUG_FS
163
-struct skl_debug *skl_debugfs_init(struct skl *skl);
191
+struct skl_debug *skl_debugfs_init(struct skl_dev *skl);
192
+void skl_debugfs_exit(struct skl_dev *skl);
164193 void skl_debug_init_module(struct skl_debug *d,
165194 struct snd_soc_dapm_widget *w,
166195 struct skl_module_cfg *mconfig);
167196 #else
168
-static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
197
+static inline struct skl_debug *skl_debugfs_init(struct skl_dev *skl)
169198 {
170199 return NULL;
171200 }
201
+
202
+static inline void skl_debugfs_exit(struct skl_dev *skl)
203
+{}
204
+
172205 static inline void skl_debug_init_module(struct skl_debug *d,
173206 struct snd_soc_dapm_widget *w,
174207 struct skl_module_cfg *mconfig)