1
2
3
4
5
6
7
8
9
10
11
12#ifndef __SOUND_SOC_SKL_H
13#define __SOUND_SOC_SKL_H
14
15#include <sound/hda_register.h>
16#include <sound/hdaudio_ext.h>
17#include <sound/hda_codec.h>
18#include <sound/soc.h>
19#include "skl-nhlt.h"
20#include "skl-ssp-clk.h"
21
22#define SKL_SUSPEND_DELAY 2000
23
24#define SKL_MAX_ASTATE_CFG 3
25
26#define AZX_PCIREG_PGCTL 0x44
27#define AZX_PGCTL_LSRMD_MASK (1 << 4)
28#define AZX_PGCTL_ADSPPGD BIT(2)
29#define AZX_PCIREG_CGCTL 0x48
30#define AZX_CGCTL_MISCBDCGE_MASK (1 << 6)
31#define AZX_CGCTL_ADSPDCGE BIT(1)
32
33#define AZX_REG_VS_D0I3C_CIP 0x1
34#define AZX_REG_VS_D0I3C_I3 0x4
35#define SKL_MAX_DMACTRL_CFG 18
36#define DMA_CLK_CONTROLS 1
37#define DMA_TRANSMITION_START 2
38#define DMA_TRANSMITION_STOP 3
39
40#define AZX_VS_EM2_DUM BIT(23)
41#define AZX_REG_VS_EM2_L1SEN BIT(13)
42
43struct skl_dsp_resource {
44 u32 max_mcps;
45 u32 max_mem;
46 u32 mcps;
47 u32 mem;
48};
49
50struct skl_debug;
51
52struct skl_astate_param {
53 u32 kcps;
54 u32 clk_src;
55};
56
57struct skl_astate_config {
58 u32 count;
59 struct skl_astate_param astate_table[0];
60};
61
62struct skl_fw_config {
63 struct skl_astate_config *astate_cfg;
64};
65
66struct skl {
67 struct hda_bus hbus;
68 struct pci_dev *pci;
69
70 unsigned int init_done:1;
71 struct platform_device *dmic_dev;
72 struct platform_device *i2s_dev;
73 struct platform_device *clk_dev;
74 struct snd_soc_component *component;
75 struct snd_soc_dai_driver *dais;
76
77 struct nhlt_acpi_table *nhlt;
78 struct skl_sst *skl_sst;
79
80 struct skl_dsp_resource resource;
81 struct list_head ppl_list;
82 struct list_head bind_list;
83
84 const char *fw_name;
85 char tplg_name[64];
86 unsigned short pci_id;
87 const struct firmware *tplg;
88
89 int supend_active;
90
91 struct work_struct probe_work;
92
93 struct skl_debug *debugfs;
94 u8 nr_modules;
95 struct skl_module **modules;
96 bool use_tplg_pcm;
97 struct skl_fw_config cfg;
98 struct snd_soc_acpi_mach *mach;
99};
100
101#define skl_to_bus(s) (&(s)->hbus.core)
102#define bus_to_skl(bus) container_of(bus, struct skl, hbus.core)
103
104#define skl_to_hbus(s) (&(s)->hbus)
105#define hbus_to_skl(hbus) container_of((hbus), struct skl, (hbus))
106
107
108struct skl_dma_params {
109 u32 format;
110 u8 stream_tag;
111};
112
113struct skl_machine_pdata {
114 bool use_tplg_pcm;
115};
116
117struct skl_dsp_ops {
118 int id;
119 unsigned int num_cores;
120 struct skl_dsp_loader_ops (*loader_ops)(void);
121 int (*init)(struct device *dev, void __iomem *mmio_base,
122 int irq, const char *fw_name,
123 struct skl_dsp_loader_ops loader_ops,
124 struct skl_sst **skl_sst);
125 int (*init_fw)(struct device *dev, struct skl_sst *ctx);
126 void (*cleanup)(struct device *dev, struct skl_sst *ctx);
127};
128
129int skl_platform_unregister(struct device *dev);
130int skl_platform_register(struct device *dev);
131
132struct nhlt_acpi_table *skl_nhlt_init(struct device *dev);
133void skl_nhlt_free(struct nhlt_acpi_table *addr);
134struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
135 u8 link_type, u8 s_fmt, u8 no_ch,
136 u32 s_rate, u8 dirn, u8 dev_type);
137
138int skl_get_dmic_geo(struct skl *skl);
139int skl_nhlt_update_topology_bin(struct skl *skl);
140int skl_init_dsp(struct skl *skl);
141int skl_free_dsp(struct skl *skl);
142int skl_suspend_late_dsp(struct skl *skl);
143int skl_suspend_dsp(struct skl *skl);
144int skl_resume_dsp(struct skl *skl);
145void skl_cleanup_resources(struct skl *skl);
146const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
147void skl_update_d0i3c(struct device *dev, bool enable);
148int skl_nhlt_create_sysfs(struct skl *skl);
149void skl_nhlt_remove_sysfs(struct skl *skl);
150void skl_get_clks(struct skl *skl, struct skl_ssp_clk *ssp_clks);
151struct skl_clk_parent_src *skl_get_parent_clk(u8 clk_id);
152int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
153 u32 caps_size, u32 node_id);
154
155struct skl_module_cfg;
156
157#ifdef CONFIG_DEBUG_FS
158struct skl_debug *skl_debugfs_init(struct skl *skl);
159void skl_debugfs_exit(struct skl *skl);
160void skl_debug_init_module(struct skl_debug *d,
161 struct snd_soc_dapm_widget *w,
162 struct skl_module_cfg *mconfig);
163#else
164static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
165{
166 return NULL;
167}
168
169static inline void skl_debugfs_exit(struct skl *skl)
170{}
171
172static inline void skl_debug_init_module(struct skl_debug *d,
173 struct snd_soc_dapm_widget *w,
174 struct skl_module_cfg *mconfig)
175{}
176#endif
177
178#endif
179