1e149ca29SPierre-Louis Bossart /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2c16211d6SLiam Girdwood /* 3c16211d6SLiam Girdwood * This file is provided under a dual BSD/GPLv2 license. When using or 4c16211d6SLiam Girdwood * redistributing this file, you may do so under either license. 5c16211d6SLiam Girdwood * 6c16211d6SLiam Girdwood * Copyright(c) 2018 Intel Corporation. All rights reserved. 7c16211d6SLiam Girdwood * 8c16211d6SLiam Girdwood * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> 9c16211d6SLiam Girdwood */ 10c16211d6SLiam Girdwood 11c16211d6SLiam Girdwood #ifndef __INCLUDE_SOUND_SOF_H 12c16211d6SLiam Girdwood #define __INCLUDE_SOUND_SOF_H 13c16211d6SLiam Girdwood 14c16211d6SLiam Girdwood #include <linux/pci.h> 158017b8fdSLiam Girdwood #include <sound/soc.h> 16c16211d6SLiam Girdwood #include <sound/soc-acpi.h> 17c16211d6SLiam Girdwood 18c16211d6SLiam Girdwood struct snd_sof_dsp_ops; 19c16211d6SLiam Girdwood 20fc179420SPeter Ujfalusi /** 21d41607d3SPeter Ujfalusi * enum sof_fw_state - DSP firmware state definitions 22fc179420SPeter Ujfalusi * @SOF_FW_BOOT_NOT_STARTED: firmware boot is not yet started 23fc179420SPeter Ujfalusi * @SOF_FW_BOOT_PREPARE: preparing for boot (firmware loading for exaqmple) 24fc179420SPeter Ujfalusi * @SOF_FW_BOOT_IN_PROGRESS: firmware boot is in progress 25fc179420SPeter Ujfalusi * @SOF_FW_BOOT_FAILED: firmware boot failed 26fc179420SPeter Ujfalusi * @SOF_FW_BOOT_READY_FAILED: firmware booted but fw_ready op failed 27fc179420SPeter Ujfalusi * @SOF_FW_BOOT_READY_OK: firmware booted and fw_ready op passed 28fc179420SPeter Ujfalusi * @SOF_FW_BOOT_COMPLETE: firmware is booted up and functional 29fc179420SPeter Ujfalusi * @SOF_FW_CRASHED: firmware crashed after successful boot 30fc179420SPeter Ujfalusi */ 31d41607d3SPeter Ujfalusi enum sof_fw_state { 32fc179420SPeter Ujfalusi SOF_FW_BOOT_NOT_STARTED = 0, 33fc179420SPeter Ujfalusi SOF_FW_BOOT_PREPARE, 34fc179420SPeter Ujfalusi SOF_FW_BOOT_IN_PROGRESS, 35fc179420SPeter Ujfalusi SOF_FW_BOOT_FAILED, 36fc179420SPeter Ujfalusi SOF_FW_BOOT_READY_FAILED, 37fc179420SPeter Ujfalusi SOF_FW_BOOT_READY_OK, 38fc179420SPeter Ujfalusi SOF_FW_BOOT_COMPLETE, 39fc179420SPeter Ujfalusi SOF_FW_CRASHED, 40fc179420SPeter Ujfalusi }; 41fc179420SPeter Ujfalusi 425fdc1242SPeter Ujfalusi /* DSP power states */ 435fdc1242SPeter Ujfalusi enum sof_dsp_power_states { 445fdc1242SPeter Ujfalusi SOF_DSP_PM_D0, 455fdc1242SPeter Ujfalusi SOF_DSP_PM_D1, 465fdc1242SPeter Ujfalusi SOF_DSP_PM_D2, 475fdc1242SPeter Ujfalusi SOF_DSP_PM_D3, 485fdc1242SPeter Ujfalusi }; 495fdc1242SPeter Ujfalusi 50*15527feeSPierre-Louis Bossart /* Definitions for multiple IPCs */ 51*15527feeSPierre-Louis Bossart enum sof_ipc_type { 52*15527feeSPierre-Louis Bossart SOF_IPC, 53*15527feeSPierre-Louis Bossart SOF_INTEL_IPC4, 54*15527feeSPierre-Louis Bossart SOF_IPC_TYPE_COUNT 55*15527feeSPierre-Louis Bossart }; 56*15527feeSPierre-Louis Bossart 57c16211d6SLiam Girdwood /* 58c16211d6SLiam Girdwood * SOF Platform data. 59c16211d6SLiam Girdwood */ 60c16211d6SLiam Girdwood struct snd_sof_pdata { 61c16211d6SLiam Girdwood const struct firmware *fw; 62c16211d6SLiam Girdwood const char *name; 63c16211d6SLiam Girdwood const char *platform; 64c16211d6SLiam Girdwood 65c16211d6SLiam Girdwood struct device *dev; 66c16211d6SLiam Girdwood 6792be17a5SKarol Trzcinski /* indicate how many first bytes shouldn't be loaded into DSP memory. */ 6892be17a5SKarol Trzcinski size_t fw_offset; 6992be17a5SKarol Trzcinski 70c16211d6SLiam Girdwood /* 71c16211d6SLiam Girdwood * notification callback used if the hardware initialization 72c16211d6SLiam Girdwood * can take time or is handled in a workqueue. This callback 73c16211d6SLiam Girdwood * can be used by the caller to e.g. enable runtime_pm 74c16211d6SLiam Girdwood * or limit functionality until all low-level inits are 75c16211d6SLiam Girdwood * complete. 76c16211d6SLiam Girdwood */ 77c16211d6SLiam Girdwood void (*sof_probe_complete)(struct device *dev); 78c16211d6SLiam Girdwood 79c16211d6SLiam Girdwood /* descriptor */ 80c16211d6SLiam Girdwood const struct sof_dev_desc *desc; 81c16211d6SLiam Girdwood 82c16211d6SLiam Girdwood /* firmware and topology filenames */ 83c16211d6SLiam Girdwood const char *fw_filename_prefix; 84c16211d6SLiam Girdwood const char *fw_filename; 85c16211d6SLiam Girdwood const char *tplg_filename_prefix; 86c16211d6SLiam Girdwood const char *tplg_filename; 87c16211d6SLiam Girdwood 88c16211d6SLiam Girdwood /* machine */ 89c16211d6SLiam Girdwood struct platform_device *pdev_mach; 90c16211d6SLiam Girdwood const struct snd_soc_acpi_mach *machine; 91c16211d6SLiam Girdwood 92c16211d6SLiam Girdwood void *hw_pdata; 93*15527feeSPierre-Louis Bossart 94*15527feeSPierre-Louis Bossart enum sof_ipc_type ipc_type; 95c16211d6SLiam Girdwood }; 96c16211d6SLiam Girdwood 97c16211d6SLiam Girdwood /* 98c16211d6SLiam Girdwood * Descriptor used for setting up SOF platform data. This is used when 99c16211d6SLiam Girdwood * ACPI/PCI data is missing or mapped differently. 100c16211d6SLiam Girdwood */ 101c16211d6SLiam Girdwood struct sof_dev_desc { 102c16211d6SLiam Girdwood /* list of machines using this configuration */ 103c16211d6SLiam Girdwood struct snd_soc_acpi_mach *machines; 104c16211d6SLiam Girdwood 1051466327eSPierre-Louis Bossart /* alternate list of machines using this configuration */ 1061466327eSPierre-Louis Bossart struct snd_soc_acpi_mach *alt_machines; 1071466327eSPierre-Louis Bossart 10843437d04SDaniel Baluta bool use_acpi_target_states; 10943437d04SDaniel Baluta 110c16211d6SLiam Girdwood /* Platform resource indexes in BAR / ACPI resources. */ 111c16211d6SLiam Girdwood /* Must set to -1 if not used - add new items to end */ 112c16211d6SLiam Girdwood int resindex_lpe_base; 113c16211d6SLiam Girdwood int resindex_pcicfg_base; 114c16211d6SLiam Girdwood int resindex_imr_base; 115c16211d6SLiam Girdwood int irqindex_host_ipc; 116c16211d6SLiam Girdwood 117c16211d6SLiam Girdwood /* IPC timeouts in ms */ 118c16211d6SLiam Girdwood int ipc_timeout; 119c16211d6SLiam Girdwood int boot_timeout; 120c16211d6SLiam Girdwood 121c16211d6SLiam Girdwood /* chip information for dsp */ 122c16211d6SLiam Girdwood const void *chip_info; 123c16211d6SLiam Girdwood 124c16211d6SLiam Girdwood /* defaults for no codec mode */ 125c16211d6SLiam Girdwood const char *nocodec_tplg_filename; 126c16211d6SLiam Girdwood 127c16211d6SLiam Girdwood /* defaults paths for firmware and topology files */ 128c16211d6SLiam Girdwood const char *default_fw_path; 129c16211d6SLiam Girdwood const char *default_tplg_path; 130c16211d6SLiam Girdwood 13103eec9b4SRanjani Sridharan /* default firmware name */ 13203eec9b4SRanjani Sridharan const char *default_fw_filename; 13303eec9b4SRanjani Sridharan 134c16211d6SLiam Girdwood const struct snd_sof_dsp_ops *ops; 135c16211d6SLiam Girdwood }; 136c16211d6SLiam Girdwood 137b951b51eSKeyon Jie int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd); 138bc619cfcSBrent Lu int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd); 139f805e7e0SRanjani Sridharan 140c16211d6SLiam Girdwood #endif 141