Commit | Line | Data |
---|---|---|
e149ca29 | 1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ |
c16211d6 LG |
2 | /* |
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | |
4 | * redistributing this file, you may do so under either license. | |
5 | * | |
ea89a742 | 6 | * Copyright(c) 2018 Intel Corporation |
c16211d6 LG |
7 | * |
8 | * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> | |
9 | */ | |
10 | ||
11 | #ifndef __INCLUDE_SOUND_SOF_H | |
12 | #define __INCLUDE_SOUND_SOF_H | |
13 | ||
14 | #include <linux/pci.h> | |
8017b8fd | 15 | #include <sound/soc.h> |
c16211d6 LG |
16 | #include <sound/soc-acpi.h> |
17 | ||
18 | struct snd_sof_dsp_ops; | |
856601e5 | 19 | struct snd_sof_dev; |
c16211d6 | 20 | |
fc179420 | 21 | /** |
d41607d3 | 22 | * enum sof_fw_state - DSP firmware state definitions |
fc179420 | 23 | * @SOF_FW_BOOT_NOT_STARTED: firmware boot is not yet started |
59611370 | 24 | * @SOF_DSPLESS_MODE: DSP is not used |
fc179420 PU |
25 | * @SOF_FW_BOOT_PREPARE: preparing for boot (firmware loading for exaqmple) |
26 | * @SOF_FW_BOOT_IN_PROGRESS: firmware boot is in progress | |
27 | * @SOF_FW_BOOT_FAILED: firmware boot failed | |
28 | * @SOF_FW_BOOT_READY_FAILED: firmware booted but fw_ready op failed | |
29 | * @SOF_FW_BOOT_READY_OK: firmware booted and fw_ready op passed | |
30 | * @SOF_FW_BOOT_COMPLETE: firmware is booted up and functional | |
31 | * @SOF_FW_CRASHED: firmware crashed after successful boot | |
32 | */ | |
d41607d3 | 33 | enum sof_fw_state { |
fc179420 | 34 | SOF_FW_BOOT_NOT_STARTED = 0, |
59611370 | 35 | SOF_DSPLESS_MODE, |
fc179420 PU |
36 | SOF_FW_BOOT_PREPARE, |
37 | SOF_FW_BOOT_IN_PROGRESS, | |
38 | SOF_FW_BOOT_FAILED, | |
39 | SOF_FW_BOOT_READY_FAILED, | |
40 | SOF_FW_BOOT_READY_OK, | |
41 | SOF_FW_BOOT_COMPLETE, | |
42 | SOF_FW_CRASHED, | |
43 | }; | |
44 | ||
5fdc1242 PU |
45 | /* DSP power states */ |
46 | enum sof_dsp_power_states { | |
47 | SOF_DSP_PM_D0, | |
48 | SOF_DSP_PM_D1, | |
49 | SOF_DSP_PM_D2, | |
50 | SOF_DSP_PM_D3, | |
51 | }; | |
52 | ||
15527fee PLB |
53 | /* Definitions for multiple IPCs */ |
54 | enum sof_ipc_type { | |
6974f2cd PU |
55 | SOF_IPC_TYPE_3, |
56 | SOF_IPC_TYPE_4, | |
15527fee PLB |
57 | SOF_IPC_TYPE_COUNT |
58 | }; | |
59 | ||
1162d267 PU |
60 | struct sof_loadable_file_profile { |
61 | enum sof_ipc_type ipc_type; | |
62 | ||
63 | const char *fw_path; | |
64 | const char *fw_path_postfix; | |
65 | const char *fw_name; | |
66 | const char *fw_lib_path; | |
67 | const char *fw_lib_path_postfix; | |
68 | const char *tplg_path; | |
69 | const char *tplg_name; | |
70 | }; | |
71 | ||
c16211d6 LG |
72 | /* |
73 | * SOF Platform data. | |
74 | */ | |
75 | struct snd_sof_pdata { | |
c16211d6 LG |
76 | const char *name; |
77 | const char *platform; | |
78 | ||
ba2de401 RF |
79 | /* |
80 | * PCI SSID. As PCI does not define 0 as invalid, the subsystem_id_set | |
81 | * flag indicates that a value has been written to these members. | |
82 | */ | |
83 | unsigned short subsystem_vendor; | |
84 | unsigned short subsystem_device; | |
85 | bool subsystem_id_set; | |
86 | ||
c16211d6 LG |
87 | struct device *dev; |
88 | ||
89 | /* | |
90 | * notification callback used if the hardware initialization | |
91 | * can take time or is handled in a workqueue. This callback | |
92 | * can be used by the caller to e.g. enable runtime_pm | |
93 | * or limit functionality until all low-level inits are | |
94 | * complete. | |
95 | */ | |
96 | void (*sof_probe_complete)(struct device *dev); | |
97 | ||
98 | /* descriptor */ | |
99 | const struct sof_dev_desc *desc; | |
100 | ||
1162d267 PU |
101 | /* platform's preferred IPC type and path overrides */ |
102 | struct sof_loadable_file_profile ipc_file_profile_base; | |
103 | ||
c16211d6 LG |
104 | /* firmware and topology filenames */ |
105 | const char *fw_filename_prefix; | |
106 | const char *fw_filename; | |
107 | const char *tplg_filename_prefix; | |
108 | const char *tplg_filename; | |
e48a906a | 109 | bool disable_function_topology; |
c16211d6 | 110 | |
25bbc0c5 PU |
111 | /* loadable external libraries available under this directory */ |
112 | const char *fw_lib_prefix; | |
113 | ||
c16211d6 LG |
114 | /* machine */ |
115 | struct platform_device *pdev_mach; | |
116 | const struct snd_soc_acpi_mach *machine; | |
6ace85b9 | 117 | const struct snd_sof_of_mach *of_machine; |
c16211d6 LG |
118 | |
119 | void *hw_pdata; | |
15527fee PLB |
120 | |
121 | enum sof_ipc_type ipc_type; | |
c16211d6 LG |
122 | }; |
123 | ||
124 | /* | |
125 | * Descriptor used for setting up SOF platform data. This is used when | |
126 | * ACPI/PCI data is missing or mapped differently. | |
127 | */ | |
128 | struct sof_dev_desc { | |
129 | /* list of machines using this configuration */ | |
130 | struct snd_soc_acpi_mach *machines; | |
6ace85b9 | 131 | struct snd_sof_of_mach *of_machines; |
c16211d6 | 132 | |
1466327e PLB |
133 | /* alternate list of machines using this configuration */ |
134 | struct snd_soc_acpi_mach *alt_machines; | |
135 | ||
43437d04 DB |
136 | bool use_acpi_target_states; |
137 | ||
c16211d6 LG |
138 | /* Platform resource indexes in BAR / ACPI resources. */ |
139 | /* Must set to -1 if not used - add new items to end */ | |
140 | int resindex_lpe_base; | |
141 | int resindex_pcicfg_base; | |
142 | int resindex_imr_base; | |
143 | int irqindex_host_ipc; | |
c16211d6 LG |
144 | |
145 | /* IPC timeouts in ms */ | |
146 | int ipc_timeout; | |
147 | int boot_timeout; | |
148 | ||
149 | /* chip information for dsp */ | |
150 | const void *chip_info; | |
151 | ||
152 | /* defaults for no codec mode */ | |
c16211d6 LG |
153 | const char *nocodec_tplg_filename; |
154 | ||
0cf8ff05 PLB |
155 | /* information on supported IPCs */ |
156 | unsigned int ipc_supported_mask; | |
157 | enum sof_ipc_type ipc_default; | |
158 | ||
59611370 PU |
159 | /* The platform supports DSPless mode */ |
160 | bool dspless_mode_supported; | |
161 | ||
25bbc0c5 | 162 | /* defaults paths for firmware, library and topology files */ |
a3757915 | 163 | const char *default_fw_path[SOF_IPC_TYPE_COUNT]; |
25bbc0c5 | 164 | const char *default_lib_path[SOF_IPC_TYPE_COUNT]; |
a3757915 | 165 | const char *default_tplg_path[SOF_IPC_TYPE_COUNT]; |
c16211d6 | 166 | |
03eec9b4 | 167 | /* default firmware name */ |
a97abb3c | 168 | const char *default_fw_filename[SOF_IPC_TYPE_COUNT]; |
03eec9b4 | 169 | |
8bbc692d | 170 | const struct snd_sof_dsp_ops *ops; |
856601e5 | 171 | int (*ops_init)(struct snd_sof_dev *sdev); |
bc433fd7 | 172 | void (*ops_free)(struct snd_sof_dev *sdev); |
c16211d6 LG |
173 | }; |
174 | ||
b951b51e | 175 | int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd); |
bc619cfc | 176 | int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd); |
1deba6e2 | 177 | int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd); |
f805e7e0 | 178 | |
c16211d6 | 179 | #endif |