xref: /OK3568_Linux_fs/kernel/include/sound/sof.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * This file is provided under a dual BSD/GPLv2 license.  When using or
4*4882a593Smuzhiyun  * redistributing this file, you may do so under either license.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright(c) 2018 Intel Corporation. All rights reserved.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef __INCLUDE_SOUND_SOF_H
12*4882a593Smuzhiyun #define __INCLUDE_SOUND_SOF_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/pci.h>
15*4882a593Smuzhiyun #include <sound/soc.h>
16*4882a593Smuzhiyun #include <sound/soc-acpi.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun struct snd_sof_dsp_ops;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun /*
21*4882a593Smuzhiyun  * SOF Platform data.
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun struct snd_sof_pdata {
24*4882a593Smuzhiyun 	const struct firmware *fw;
25*4882a593Smuzhiyun 	const char *name;
26*4882a593Smuzhiyun 	const char *platform;
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun 	struct device *dev;
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun 	/* indicate how many first bytes shouldn't be loaded into DSP memory. */
31*4882a593Smuzhiyun 	size_t fw_offset;
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun 	/*
34*4882a593Smuzhiyun 	 * notification callback used if the hardware initialization
35*4882a593Smuzhiyun 	 * can take time or is handled in a workqueue. This callback
36*4882a593Smuzhiyun 	 * can be used by the caller to e.g. enable runtime_pm
37*4882a593Smuzhiyun 	 * or limit functionality until all low-level inits are
38*4882a593Smuzhiyun 	 * complete.
39*4882a593Smuzhiyun 	 */
40*4882a593Smuzhiyun 	void (*sof_probe_complete)(struct device *dev);
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun 	/* descriptor */
43*4882a593Smuzhiyun 	const struct sof_dev_desc *desc;
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun 	/* firmware and topology filenames */
46*4882a593Smuzhiyun 	const char *fw_filename_prefix;
47*4882a593Smuzhiyun 	const char *fw_filename;
48*4882a593Smuzhiyun 	const char *tplg_filename_prefix;
49*4882a593Smuzhiyun 	const char *tplg_filename;
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun 	/* machine */
52*4882a593Smuzhiyun 	struct platform_device *pdev_mach;
53*4882a593Smuzhiyun 	const struct snd_soc_acpi_mach *machine;
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun 	void *hw_pdata;
56*4882a593Smuzhiyun };
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun /*
59*4882a593Smuzhiyun  * Descriptor used for setting up SOF platform data. This is used when
60*4882a593Smuzhiyun  * ACPI/PCI data is missing or mapped differently.
61*4882a593Smuzhiyun  */
62*4882a593Smuzhiyun struct sof_dev_desc {
63*4882a593Smuzhiyun 	/* list of machines using this configuration */
64*4882a593Smuzhiyun 	struct snd_soc_acpi_mach *machines;
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun 	/* alternate list of machines using this configuration */
67*4882a593Smuzhiyun 	struct snd_soc_acpi_mach *alt_machines;
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun 	bool use_acpi_target_states;
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun 	/* Platform resource indexes in BAR / ACPI resources. */
72*4882a593Smuzhiyun 	/* Must set to -1 if not used - add new items to end */
73*4882a593Smuzhiyun 	int resindex_lpe_base;
74*4882a593Smuzhiyun 	int resindex_pcicfg_base;
75*4882a593Smuzhiyun 	int resindex_imr_base;
76*4882a593Smuzhiyun 	int irqindex_host_ipc;
77*4882a593Smuzhiyun 	int resindex_dma_base;
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun 	/* DMA only valid when resindex_dma_base != -1*/
80*4882a593Smuzhiyun 	int dma_engine;
81*4882a593Smuzhiyun 	int dma_size;
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun 	/* IPC timeouts in ms */
84*4882a593Smuzhiyun 	int ipc_timeout;
85*4882a593Smuzhiyun 	int boot_timeout;
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun 	/* chip information for dsp */
88*4882a593Smuzhiyun 	const void *chip_info;
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun 	/* defaults for no codec mode */
91*4882a593Smuzhiyun 	const char *nocodec_tplg_filename;
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun 	/* defaults paths for firmware and topology files */
94*4882a593Smuzhiyun 	const char *default_fw_path;
95*4882a593Smuzhiyun 	const char *default_tplg_path;
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun 	/* default firmware name */
98*4882a593Smuzhiyun 	const char *default_fw_filename;
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun 	const struct snd_sof_dsp_ops *ops;
101*4882a593Smuzhiyun };
102*4882a593Smuzhiyun 
103*4882a593Smuzhiyun int sof_nocodec_setup(struct device *dev,
104*4882a593Smuzhiyun 		      const struct snd_sof_dsp_ops *ops);
105*4882a593Smuzhiyun #endif
106