.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * skl.h - HD Audio skylake defintions. |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Author: Jeeja KP <jeeja.kp@intel.com> |
---|
6 | 7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
7 | 8 | * |
---|
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 | | - * |
---|
17 | 9 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
18 | | - * |
---|
19 | 10 | */ |
---|
20 | 11 | |
---|
21 | 12 | #ifndef __SOUND_SOC_SKL_H |
---|
.. | .. |
---|
23 | 14 | |
---|
24 | 15 | #include <sound/hda_register.h> |
---|
25 | 16 | #include <sound/hdaudio_ext.h> |
---|
| 17 | +#include <sound/hda_codec.h> |
---|
26 | 18 | #include <sound/soc.h> |
---|
27 | | -#include "skl-nhlt.h" |
---|
28 | 19 | #include "skl-ssp-clk.h" |
---|
| 20 | +#include "skl-sst-ipc.h" |
---|
29 | 21 | |
---|
30 | 22 | #define SKL_SUSPEND_DELAY 2000 |
---|
31 | 23 | |
---|
.. | .. |
---|
45 | 37 | #define DMA_TRANSMITION_START 2 |
---|
46 | 38 | #define DMA_TRANSMITION_STOP 3 |
---|
47 | 39 | |
---|
| 40 | +#define AZX_VS_EM2_DUM BIT(23) |
---|
48 | 41 | #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 | | -}; |
---|
56 | 42 | |
---|
57 | 43 | struct skl_debug; |
---|
58 | 44 | |
---|
.. | .. |
---|
63 | 49 | |
---|
64 | 50 | struct skl_astate_config { |
---|
65 | 51 | u32 count; |
---|
66 | | - struct skl_astate_param astate_table[0]; |
---|
| 52 | + struct skl_astate_param astate_table[]; |
---|
67 | 53 | }; |
---|
68 | 54 | |
---|
69 | 55 | struct skl_fw_config { |
---|
70 | 56 | struct skl_astate_config *astate_cfg; |
---|
71 | 57 | }; |
---|
72 | 58 | |
---|
73 | | -struct skl { |
---|
74 | | - struct hdac_bus hbus; |
---|
| 59 | +struct skl_dev { |
---|
| 60 | + struct hda_bus hbus; |
---|
75 | 61 | struct pci_dev *pci; |
---|
76 | 62 | |
---|
77 | 63 | unsigned int init_done:1; /* delayed init status */ |
---|
.. | .. |
---|
82 | 68 | struct snd_soc_dai_driver *dais; |
---|
83 | 69 | |
---|
84 | 70 | struct nhlt_acpi_table *nhlt; /* nhlt ptr */ |
---|
85 | | - struct skl_sst *skl_sst; /* sst skl ctx */ |
---|
86 | 71 | |
---|
87 | | - struct skl_dsp_resource resource; |
---|
88 | 72 | struct list_head ppl_list; |
---|
89 | 73 | struct list_head bind_list; |
---|
90 | 74 | |
---|
91 | 75 | const char *fw_name; |
---|
92 | 76 | char tplg_name[64]; |
---|
93 | 77 | unsigned short pci_id; |
---|
94 | | - const struct firmware *tplg; |
---|
95 | 78 | |
---|
96 | 79 | int supend_active; |
---|
97 | 80 | |
---|
.. | .. |
---|
103 | 86 | bool use_tplg_pcm; |
---|
104 | 87 | struct skl_fw_config cfg; |
---|
105 | 88 | 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); |
---|
106 | 135 | }; |
---|
107 | 136 | |
---|
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)) |
---|
110 | 142 | |
---|
111 | 143 | /* to pass dai dma data */ |
---|
112 | 144 | struct skl_dma_params { |
---|
.. | .. |
---|
115 | 147 | }; |
---|
116 | 148 | |
---|
117 | 149 | struct skl_machine_pdata { |
---|
118 | | - u32 dmic_num; |
---|
119 | 150 | bool use_tplg_pcm; /* use dais and dai links from topology */ |
---|
120 | 151 | }; |
---|
121 | 152 | |
---|
.. | .. |
---|
126 | 157 | int (*init)(struct device *dev, void __iomem *mmio_base, |
---|
127 | 158 | int irq, const char *fw_name, |
---|
128 | 159 | 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); |
---|
132 | 163 | }; |
---|
133 | 164 | |
---|
134 | 165 | int skl_platform_unregister(struct device *dev); |
---|
135 | 166 | int skl_platform_register(struct device *dev); |
---|
136 | 167 | |
---|
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, |
---|
141 | 170 | u32 s_rate, u8 dirn, u8 dev_type); |
---|
142 | 171 | |
---|
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); |
---|
151 | 179 | const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id); |
---|
152 | 180 | 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); |
---|
156 | 184 | 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, |
---|
158 | 186 | u32 caps_size, u32 node_id); |
---|
159 | 187 | |
---|
160 | 188 | struct skl_module_cfg; |
---|
161 | 189 | |
---|
162 | 190 | #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); |
---|
164 | 193 | void skl_debug_init_module(struct skl_debug *d, |
---|
165 | 194 | struct snd_soc_dapm_widget *w, |
---|
166 | 195 | struct skl_module_cfg *mconfig); |
---|
167 | 196 | #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) |
---|
169 | 198 | { |
---|
170 | 199 | return NULL; |
---|
171 | 200 | } |
---|
| 201 | + |
---|
| 202 | +static inline void skl_debugfs_exit(struct skl_dev *skl) |
---|
| 203 | +{} |
---|
| 204 | + |
---|
172 | 205 | static inline void skl_debug_init_module(struct skl_debug *d, |
---|
173 | 206 | struct snd_soc_dapm_widget *w, |
---|
174 | 207 | struct skl_module_cfg *mconfig) |
---|