Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / sound / sof.h
1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
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  *
6  * Copyright(c) 2018 Intel Corporation. All rights reserved.
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>
15 #include <sound/soc.h>
16 #include <sound/soc-acpi.h>
17
18 struct snd_sof_dsp_ops;
19
20 /*
21  * SOF Platform data.
22  */
23 struct snd_sof_pdata {
24         const struct firmware *fw;
25         const char *drv_name;
26         const char *name;
27         const char *platform;
28
29         struct device *dev;
30
31         /*
32          * notification callback used if the hardware initialization
33          * can take time or is handled in a workqueue. This callback
34          * can be used by the caller to e.g. enable runtime_pm
35          * or limit functionality until all low-level inits are
36          * complete.
37          */
38         void (*sof_probe_complete)(struct device *dev);
39
40         /* descriptor */
41         const struct sof_dev_desc *desc;
42
43         /* firmware and topology filenames */
44         const char *fw_filename_prefix;
45         const char *fw_filename;
46         const char *tplg_filename_prefix;
47         const char *tplg_filename;
48
49         /* machine */
50         struct platform_device *pdev_mach;
51         const struct snd_soc_acpi_mach *machine;
52
53         void *hw_pdata;
54 };
55
56 /*
57  * Descriptor used for setting up SOF platform data. This is used when
58  * ACPI/PCI data is missing or mapped differently.
59  */
60 struct sof_dev_desc {
61         /* list of machines using this configuration */
62         struct snd_soc_acpi_mach *machines;
63
64         /* alternate list of machines using this configuration */
65         struct snd_soc_acpi_mach *alt_machines;
66
67         /* Platform resource indexes in BAR / ACPI resources. */
68         /* Must set to -1 if not used - add new items to end */
69         int resindex_lpe_base;
70         int resindex_pcicfg_base;
71         int resindex_imr_base;
72         int irqindex_host_ipc;
73         int resindex_dma_base;
74
75         /* DMA only valid when resindex_dma_base != -1*/
76         int dma_engine;
77         int dma_size;
78
79         /* IPC timeouts in ms */
80         int ipc_timeout;
81         int boot_timeout;
82
83         /* chip information for dsp */
84         const void *chip_info;
85
86         /* defaults for no codec mode */
87         const char *nocodec_fw_filename;
88         const char *nocodec_tplg_filename;
89
90         /* defaults paths for firmware and topology files */
91         const char *default_fw_path;
92         const char *default_tplg_path;
93
94         const struct snd_sof_dsp_ops *ops;
95         const struct sof_arch_ops *arch_ops;
96 };
97
98 int sof_nocodec_setup(struct device *dev,
99                       struct snd_sof_pdata *sof_pdata,
100                       struct snd_soc_acpi_mach *mach,
101                       const struct sof_dev_desc *desc,
102                       const struct snd_sof_dsp_ops *ops);
103 #endif