1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
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.
6 * Copyright(c) 2018 Intel Corporation. All rights reserved.
8 * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
11 #ifndef __INCLUDE_SOUND_SOF_H
12 #define __INCLUDE_SOUND_SOF_H
14 #include <linux/pci.h>
15 #include <sound/soc.h>
16 #include <sound/soc-acpi.h>
18 struct snd_sof_dsp_ops;
22 * enum sof_fw_state - DSP firmware state definitions
23 * @SOF_FW_BOOT_NOT_STARTED: firmware boot is not yet started
24 * @SOF_FW_BOOT_PREPARE: preparing for boot (firmware loading for exaqmple)
25 * @SOF_FW_BOOT_IN_PROGRESS: firmware boot is in progress
26 * @SOF_FW_BOOT_FAILED: firmware boot failed
27 * @SOF_FW_BOOT_READY_FAILED: firmware booted but fw_ready op failed
28 * @SOF_FW_BOOT_READY_OK: firmware booted and fw_ready op passed
29 * @SOF_FW_BOOT_COMPLETE: firmware is booted up and functional
30 * @SOF_FW_CRASHED: firmware crashed after successful boot
33 SOF_FW_BOOT_NOT_STARTED = 0,
35 SOF_FW_BOOT_IN_PROGRESS,
37 SOF_FW_BOOT_READY_FAILED,
43 /* DSP power states */
44 enum sof_dsp_power_states {
51 /* Definitions for multiple IPCs */
61 struct snd_sof_pdata {
68 * notification callback used if the hardware initialization
69 * can take time or is handled in a workqueue. This callback
70 * can be used by the caller to e.g. enable runtime_pm
71 * or limit functionality until all low-level inits are
74 void (*sof_probe_complete)(struct device *dev);
77 const struct sof_dev_desc *desc;
79 /* firmware and topology filenames */
80 const char *fw_filename_prefix;
81 const char *fw_filename;
82 const char *tplg_filename_prefix;
83 const char *tplg_filename;
85 /* loadable external libraries available under this directory */
86 const char *fw_lib_prefix;
89 struct platform_device *pdev_mach;
90 const struct snd_soc_acpi_mach *machine;
91 const struct snd_sof_of_mach *of_machine;
95 enum sof_ipc_type ipc_type;
99 * Descriptor used for setting up SOF platform data. This is used when
100 * ACPI/PCI data is missing or mapped differently.
102 struct sof_dev_desc {
103 /* list of machines using this configuration */
104 struct snd_soc_acpi_mach *machines;
105 struct snd_sof_of_mach *of_machines;
107 /* alternate list of machines using this configuration */
108 struct snd_soc_acpi_mach *alt_machines;
110 bool use_acpi_target_states;
112 /* Platform resource indexes in BAR / ACPI resources. */
113 /* Must set to -1 if not used - add new items to end */
114 int resindex_lpe_base;
115 int resindex_pcicfg_base;
116 int resindex_imr_base;
117 int irqindex_host_ipc;
119 /* IPC timeouts in ms */
123 /* chip information for dsp */
124 const void *chip_info;
126 /* defaults for no codec mode */
127 const char *nocodec_tplg_filename;
129 /* information on supported IPCs */
130 unsigned int ipc_supported_mask;
131 enum sof_ipc_type ipc_default;
133 /* defaults paths for firmware, library and topology files */
134 const char *default_fw_path[SOF_IPC_TYPE_COUNT];
135 const char *default_lib_path[SOF_IPC_TYPE_COUNT];
136 const char *default_tplg_path[SOF_IPC_TYPE_COUNT];
138 /* default firmware name */
139 const char *default_fw_filename[SOF_IPC_TYPE_COUNT];
141 struct snd_sof_dsp_ops *ops;
142 int (*ops_init)(struct snd_sof_dev *sdev);
143 void (*ops_free)(struct snd_sof_dev *sdev);
146 int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd);
147 int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd);