hda.c (542898c5aa5c6a3179dffb1d1606884a63f75fed) | hda.c (3dc0d709177828a22dfc9d0072e3ac937ef90d06) |
---|---|
1// SPDX-License-Identifier: (GPL-2.0-only 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// Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com> --- 1165 unchanged lines hidden (view full) --- 1174#else 1175static void hda_generic_machine_select(struct snd_sof_dev *sdev, 1176 struct snd_soc_acpi_mach **mach) 1177{ 1178} 1179#endif 1180 1181#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) | 1// SPDX-License-Identifier: (GPL-2.0-only 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// Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com> --- 1165 unchanged lines hidden (view full) --- 1174#else 1175static void hda_generic_machine_select(struct snd_sof_dev *sdev, 1176 struct snd_soc_acpi_mach **mach) 1177{ 1178} 1179#endif 1180 1181#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) |
1182 1183#define SDW_CODEC_ADR_MASK(_adr) ((_adr) & (SDW_DISCO_LINK_ID_MASK | SDW_VERSION_MASK | \ 1184 SDW_MFG_ID_MASK | SDW_PART_ID_MASK)) 1185 |
|
1182/* Check if all Slaves defined on the link can be found */ 1183static bool link_slaves_found(struct snd_sof_dev *sdev, 1184 const struct snd_soc_acpi_link_adr *link, 1185 struct sdw_intel_ctx *sdw) 1186{ 1187 struct hdac_bus *bus = sof_to_bus(sdev); 1188 struct sdw_intel_slave_id *ids = sdw->ids; 1189 int num_slaves = sdw->num_slaves; | 1186/* Check if all Slaves defined on the link can be found */ 1187static bool link_slaves_found(struct snd_sof_dev *sdev, 1188 const struct snd_soc_acpi_link_adr *link, 1189 struct sdw_intel_ctx *sdw) 1190{ 1191 struct hdac_bus *bus = sof_to_bus(sdev); 1192 struct sdw_intel_slave_id *ids = sdw->ids; 1193 int num_slaves = sdw->num_slaves; |
1190 unsigned int part_id, link_id, unique_id, mfg_id; | 1194 unsigned int part_id, link_id, unique_id, mfg_id, version; |
1191 int i, j, k; 1192 1193 for (i = 0; i < link->num_adr; i++) { 1194 u64 adr = link->adr_d[i].adr; 1195 int reported_part_count = 0; 1196 1197 mfg_id = SDW_MFG_ID(adr); 1198 part_id = SDW_PART_ID(adr); 1199 link_id = SDW_DISCO_LINK_ID(adr); | 1195 int i, j, k; 1196 1197 for (i = 0; i < link->num_adr; i++) { 1198 u64 adr = link->adr_d[i].adr; 1199 int reported_part_count = 0; 1200 1201 mfg_id = SDW_MFG_ID(adr); 1202 part_id = SDW_PART_ID(adr); 1203 link_id = SDW_DISCO_LINK_ID(adr); |
1204 version = SDW_VERSION(adr); |
|
1200 1201 for (j = 0; j < num_slaves; j++) { 1202 /* find out how many identical parts were reported on that link */ 1203 if (ids[j].link_id == link_id && 1204 ids[j].id.part_id == part_id && | 1205 1206 for (j = 0; j < num_slaves; j++) { 1207 /* find out how many identical parts were reported on that link */ 1208 if (ids[j].link_id == link_id && 1209 ids[j].id.part_id == part_id && |
1205 ids[j].id.mfg_id == mfg_id) | 1210 ids[j].id.mfg_id == mfg_id && 1211 ids[j].id.sdw_version == version) |
1206 reported_part_count++; 1207 } 1208 1209 for (j = 0; j < num_slaves; j++) { 1210 int expected_part_count = 0; 1211 1212 if (ids[j].link_id != link_id || 1213 ids[j].id.part_id != part_id || | 1212 reported_part_count++; 1213 } 1214 1215 for (j = 0; j < num_slaves; j++) { 1216 int expected_part_count = 0; 1217 1218 if (ids[j].link_id != link_id || 1219 ids[j].id.part_id != part_id || |
1214 ids[j].id.mfg_id != mfg_id) | 1220 ids[j].id.mfg_id != mfg_id || 1221 ids[j].id.sdw_version != version) |
1215 continue; 1216 1217 /* find out how many identical parts are expected */ 1218 for (k = 0; k < link->num_adr; k++) { 1219 u64 adr2 = link->adr_d[k].adr; | 1222 continue; 1223 1224 /* find out how many identical parts are expected */ 1225 for (k = 0; k < link->num_adr; k++) { 1226 u64 adr2 = link->adr_d[k].adr; |
1220 unsigned int part_id2, link_id2, mfg_id2; | |
1221 | 1227 |
1222 mfg_id2 = SDW_MFG_ID(adr2); 1223 part_id2 = SDW_PART_ID(adr2); 1224 link_id2 = SDW_DISCO_LINK_ID(adr2); 1225 1226 if (link_id2 == link_id && 1227 part_id2 == part_id && 1228 mfg_id2 == mfg_id) | 1228 if (SDW_CODEC_ADR_MASK(adr2) == SDW_CODEC_ADR_MASK(adr)) |
1229 expected_part_count++; 1230 } 1231 1232 if (reported_part_count == expected_part_count) { 1233 /* 1234 * we have to check unique id 1235 * if there is more than one 1236 * Slave on the link --- 181 unchanged lines hidden (view full) --- 1418 dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n"); 1419 return -ENODEV; 1420 } 1421 1422 return sof_pci_probe(pci, pci_id); 1423} 1424EXPORT_SYMBOL_NS(hda_pci_intel_probe, SND_SOC_SOF_INTEL_HDA_COMMON); 1425 | 1229 expected_part_count++; 1230 } 1231 1232 if (reported_part_count == expected_part_count) { 1233 /* 1234 * we have to check unique id 1235 * if there is more than one 1236 * Slave on the link --- 181 unchanged lines hidden (view full) --- 1418 dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n"); 1419 return -ENODEV; 1420 } 1421 1422 return sof_pci_probe(pci, pci_id); 1423} 1424EXPORT_SYMBOL_NS(hda_pci_intel_probe, SND_SOC_SOF_INTEL_HDA_COMMON); 1425 |
1426int hda_register_clients(struct snd_sof_dev *sdev) 1427{ 1428 return hda_probes_register(sdev); 1429} 1430 1431void hda_unregister_clients(struct snd_sof_dev *sdev) 1432{ 1433 hda_probes_unregister(sdev); 1434} 1435 |
|
1426MODULE_LICENSE("Dual BSD/GPL"); 1427MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV); 1428MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 1429MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915); 1430MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 1431MODULE_IMPORT_NS(SND_INTEL_SOUNDWIRE_ACPI); 1432MODULE_IMPORT_NS(SOUNDWIRE_INTEL_INIT); | 1436MODULE_LICENSE("Dual BSD/GPL"); 1437MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV); 1438MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 1439MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915); 1440MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 1441MODULE_IMPORT_NS(SND_INTEL_SOUNDWIRE_ACPI); 1442MODULE_IMPORT_NS(SOUNDWIRE_INTEL_INIT); |