Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) // This file is provided under a dual BSD/GPLv2 license.  When using or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) // redistributing this file, you may do so under either license.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) // Copyright(c) 2018 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/dmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/pm_runtime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <sound/intel-dsp-config.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <sound/soc-acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <sound/soc-acpi-intel-match.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <sound/sof.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /* platform specific devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include "intel/shim.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include "intel/hda.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) static char *fw_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) module_param(fw_path, charp, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static char *tplg_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) module_param(tplg_path, charp, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static int sof_pci_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static const char *sof_override_tplg_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static int sof_tplg_cb(const struct dmi_system_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	sof_override_tplg_name = id->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) static const struct dmi_system_id sof_tplg_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		.callback = sof_tplg_cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 			DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98373_ALC5682I_I2S_UP4"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		.driver_data = "sof-tgl-rt5682-ssp0-max98373-ssp2.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) static const struct dmi_system_id community_key_platforms[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		.ident = "Up Squared",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 			DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		.ident = "Up Extreme",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			DMI_MATCH(DMI_BOARD_NAME, "UP-WHL01"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		.ident = "Google Chromebooks",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) static const struct sof_dev_desc bxt_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.machines		= snd_soc_acpi_intel_bxt_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	.resindex_lpe_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	.resindex_imr_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.chip_info = &apl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.default_fw_filename = "sof-apl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.nocodec_tplg_filename = "sof-apl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.ops = &sof_apl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static const struct sof_dev_desc glk_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	.machines		= snd_soc_acpi_intel_glk_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.resindex_lpe_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	.resindex_imr_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	.chip_info = &apl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.default_fw_filename = "sof-glk.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.nocodec_tplg_filename = "sof-glk-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.ops = &sof_apl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static struct snd_soc_acpi_mach sof_tng_machines[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		.id = "INT343A",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		.drv_name = "edison",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		.sof_fw_filename = "sof-byt.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		.sof_tplg_filename = "sof-byt.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) static const struct sof_dev_desc tng_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	.machines		= sof_tng_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	.resindex_lpe_base	= 3,	/* IRAM, but subtract IRAM offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	.resindex_imr_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.chip_info = &tng_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	.default_fw_filename = "sof-byt.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.nocodec_tplg_filename = "sof-byt.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.ops = &sof_tng_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static const struct sof_dev_desc cnl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	.machines		= snd_soc_acpi_intel_cnl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	.alt_machines		= snd_soc_acpi_intel_cnl_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.resindex_lpe_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.resindex_imr_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.chip_info = &cnl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	.default_fw_filename = "sof-cnl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static const struct sof_dev_desc cfl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	.machines		= snd_soc_acpi_intel_cfl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	.alt_machines		= snd_soc_acpi_intel_cfl_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	.resindex_lpe_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	.resindex_imr_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.chip_info = &cnl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	.default_fw_filename = "sof-cfl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) static const struct sof_dev_desc cml_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	.machines		= snd_soc_acpi_intel_cml_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	.alt_machines		= snd_soc_acpi_intel_cml_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	.resindex_lpe_base	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	.resindex_pcicfg_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	.resindex_imr_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	.irqindex_host_ipc	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	.resindex_dma_base	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	.chip_info = &cnl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	.default_fw_filename = "sof-cml.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static const struct sof_dev_desc icl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	.machines               = snd_soc_acpi_intel_icl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	.alt_machines		= snd_soc_acpi_intel_icl_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	.resindex_lpe_base      = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	.resindex_pcicfg_base   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	.resindex_imr_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	.irqindex_host_ipc      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	.resindex_dma_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	.chip_info = &icl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	.default_fw_filename = "sof-icl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	.nocodec_tplg_filename = "sof-icl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static const struct sof_dev_desc tgl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.machines               = snd_soc_acpi_intel_tgl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.resindex_lpe_base      = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.resindex_pcicfg_base   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.resindex_imr_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.irqindex_host_ipc      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.resindex_dma_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.chip_info = &tgl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	.default_fw_filename = "sof-tgl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	.ops = &sof_tgl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static const struct sof_dev_desc tglh_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	.machines               = snd_soc_acpi_intel_tgl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	.resindex_lpe_base      = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.resindex_pcicfg_base   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	.resindex_imr_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.irqindex_host_ipc      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	.resindex_dma_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	.chip_info = &tglh_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	.default_fw_filename = "sof-tgl-h.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	.ops = &sof_tgl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) static const struct sof_dev_desc ehl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	.machines               = snd_soc_acpi_intel_ehl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	.resindex_lpe_base      = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	.resindex_pcicfg_base   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	.resindex_imr_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	.irqindex_host_ipc      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	.resindex_dma_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	.chip_info = &ehl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	.default_fw_filename = "sof-ehl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static const struct sof_dev_desc jsl_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	.machines               = snd_soc_acpi_intel_jsl_machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	.use_acpi_target_states	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	.resindex_lpe_base      = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	.resindex_pcicfg_base   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	.resindex_imr_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	.irqindex_host_ipc      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	.resindex_dma_base      = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	.chip_info = &jsl_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	.default_fw_path = "intel/sof",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	.default_tplg_path = "intel/sof-tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	.default_fw_filename = "sof-jsl.ri",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	.nocodec_tplg_filename = "sof-jsl-nocodec.tplg",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	.ops = &sof_cnl_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) static const struct dev_pm_ops sof_pci_pm = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	.prepare = snd_sof_prepare,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	.complete = snd_sof_complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			   snd_sof_runtime_idle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) static void sof_pci_probe_complete(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	dev_dbg(dev, "Completing SOF PCI probe");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	if (sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	/* allow runtime_pm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	pm_runtime_use_autosuspend(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	 * runtime pm for pci device is "forbidden" by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	 * so call pm_runtime_allow() to enable it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	pm_runtime_allow(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	/* mark last_busy for pm_runtime to make sure not suspend immediately */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	pm_runtime_mark_last_busy(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	/* follow recommendation in pci-driver.c to decrement usage counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	pm_runtime_put_noidle(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) static int sof_pci_probe(struct pci_dev *pci,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 			 const struct pci_device_id *pci_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	struct device *dev = &pci->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	const struct sof_dev_desc *desc =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		(const struct sof_dev_desc *)pci_id->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	struct snd_sof_pdata *sof_pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	const struct snd_sof_dsp_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	ret = snd_intel_dsp_driver_probe(pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 		dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	dev_dbg(&pci->dev, "PCI DSP detected");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	/* get ops for platform */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	ops = desc->ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	if (!ops) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		dev_err(dev, "error: no matching PCI descriptor ops\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	if (!sof_pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	ret = pcim_enable_device(pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	ret = pci_request_regions(pci, "Audio DSP");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	sof_pdata->name = pci_name(pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	sof_pdata->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	sof_pdata->fw_filename = desc->default_fw_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	 * for platforms using the SOF community key, change the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	 * default path automatically to pick the right files from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	 * linux-firmware tree. This can be overridden with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	 * fw_path kernel parameter, e.g. for developers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	/* alternate fw and tplg filenames ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	if (fw_path) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		sof_pdata->fw_filename_prefix = fw_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		dev_dbg(dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 			"Module parameter used, changed fw path to %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 			sof_pdata->fw_filename_prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	} else if (dmi_check_system(community_key_platforms)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 		sof_pdata->fw_filename_prefix =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 			devm_kasprintf(dev, GFP_KERNEL, "%s/%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 				       sof_pdata->desc->default_fw_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 				       "community");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 		dev_dbg(dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 			"Platform uses community key, changed fw path to %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 			sof_pdata->fw_filename_prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 		sof_pdata->fw_filename_prefix =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 			sof_pdata->desc->default_fw_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	if (tplg_path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 		sof_pdata->tplg_filename_prefix = tplg_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 		sof_pdata->tplg_filename_prefix =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 			sof_pdata->desc->default_tplg_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	dmi_check_system(sof_tplg_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	if (sof_override_tplg_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 		sof_pdata->tplg_filename = sof_override_tplg_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) #if IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	/* set callback to enable runtime_pm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	sof_pdata->sof_probe_complete = sof_pci_probe_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	/* call sof helper for DSP hardware probe */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	ret = snd_sof_device_probe(dev, sof_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 		dev_err(dev, "error: failed to probe DSP hardware!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 		goto release_regions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) #if !IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	sof_pci_probe_complete(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) release_regions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	pci_release_regions(pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) static void sof_pci_remove(struct pci_dev *pci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	/* call sof helper for DSP hardware remove */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	snd_sof_device_remove(&pci->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	/* follow recommendation in pci-driver.c to increment usage counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	if (!(sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 		pm_runtime_get_noresume(&pci->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	/* release pci regions and disable device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	pci_release_regions(pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /* PCI IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static const struct pci_device_id sof_pci_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) #if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	{ PCI_DEVICE(0x8086, 0x119a),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 		.driver_data = (unsigned long)&tng_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	/* BXT-P & Apollolake */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	{ PCI_DEVICE(0x8086, 0x5a98),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 		.driver_data = (unsigned long)&bxt_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	{ PCI_DEVICE(0x8086, 0x1a98),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 		.driver_data = (unsigned long)&bxt_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) #if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	{ PCI_DEVICE(0x8086, 0x3198),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 		.driver_data = (unsigned long)&glk_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) #if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	{ PCI_DEVICE(0x8086, 0x9dc8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		.driver_data = (unsigned long)&cnl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) #if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	{ PCI_DEVICE(0x8086, 0xa348),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		.driver_data = (unsigned long)&cfl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	{ PCI_DEVICE(0x8086, 0x34C8), /* ICL-LP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 		.driver_data = (unsigned long)&icl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	{ PCI_DEVICE(0x8086, 0x3dc8), /* ICL-H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 		.driver_data = (unsigned long)&icl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) #if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 	{ PCI_DEVICE(0x8086, 0x38c8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 		.driver_data = (unsigned long)&jsl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	{ PCI_DEVICE(0x8086, 0x4dc8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 		.driver_data = (unsigned long)&jsl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 	{ PCI_DEVICE(0x8086, 0x02c8), /* CML-LP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 		.driver_data = (unsigned long)&cml_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 	{ PCI_DEVICE(0x8086, 0x06c8), /* CML-H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 		.driver_data = (unsigned long)&cml_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	{ PCI_DEVICE(0x8086, 0xa3f0), /* CML-S */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 		.driver_data = (unsigned long)&cml_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	{ PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 		.driver_data = (unsigned long)&tgl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	{ PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 		.driver_data = (unsigned long)&tglh_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) #if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	{ PCI_DEVICE(0x8086, 0x4b55),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 		.driver_data = (unsigned long)&ehl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	{ PCI_DEVICE(0x8086, 0x4b58),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 		.driver_data = (unsigned long)&ehl_desc},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 	{ 0, }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) MODULE_DEVICE_TABLE(pci, sof_pci_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) /* pci_driver definition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) static struct pci_driver snd_sof_pci_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	.name = "sof-audio-pci",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	.id_table = sof_pci_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	.probe = sof_pci_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	.remove = sof_pci_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 		.pm = &sof_pci_pm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) module_pci_driver(snd_sof_pci_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) MODULE_LICENSE("Dual BSD/GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) MODULE_IMPORT_NS(SND_SOC_SOF_MERRIFIELD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);