Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tas2783A: fw loading for devices without pci bus

Currently, there is compilation error when the
CONFIG_PCI is not enabled which is used for creating
firmware name. This commit address this issue by adding
fallback mechanism to construct unqiue name by using
SounWire slave's link and unique ids alone when the
CONFIG_PCI is not available.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601190756.IpoMY5AJ-lkp@intel.com/
Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
Link: https://patch.msgid.link/20260120040825.1460-1-niranjan.hy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Niranjan H Y and committed by
Mark Brown
1616c41e 8d38c275

+24 -19
+24 -19
sound/soc/codecs/tas2783-sdw.c
··· 27 27 #include <linux/soundwire/sdw.h> 28 28 #include <linux/soundwire/sdw_registers.h> 29 29 #include <linux/soundwire/sdw_type.h> 30 + #if IS_ENABLED(CONFIG_PCI) 30 31 #include <linux/pci.h> 32 + #endif 31 33 #include <sound/sdw.h> 32 34 #include <sound/soc.h> 33 35 #include <sound/tlv.h> ··· 1108 1106 RUNTIME_PM_OPS(tas2783_sdca_dev_suspend, tas2783_sdca_dev_resume, NULL) 1109 1107 }; 1110 1108 1111 - static struct pci_dev *tas_get_pci_dev(struct sdw_slave *peripheral) 1109 + static void tas_generate_fw_name(struct sdw_slave *slave, char *name, size_t size) 1112 1110 { 1113 - struct device *dev = &peripheral->dev; 1111 + struct sdw_bus *bus = slave->bus; 1112 + u8 unique_id = slave->id.unique_id; 1113 + bool pci_found = false; 1114 + #if IS_ENABLED(CONFIG_PCI) 1115 + struct device *dev = &slave->dev; 1116 + struct pci_dev *pci = NULL; 1114 1117 1115 - for (; dev; dev = dev->parent) 1116 - if (dev->bus == &pci_bus_type) 1117 - return to_pci_dev(dev); 1118 + for (; dev; dev = dev->parent) { 1119 + if (dev->bus == &pci_bus_type) { 1120 + pci = to_pci_dev(dev); 1121 + scnprintf(name, size, "%04X-%1X-%1X.bin", 1122 + pci->subsystem_device, bus->link_id, unique_id); 1123 + pci_found = true; 1124 + break; 1125 + } 1126 + } 1127 + #endif 1118 1128 1119 - return NULL; 1129 + if (!pci_found) 1130 + scnprintf(name, size, "tas2783-%1X-%1X.bin", 1131 + bus->link_id, unique_id); 1120 1132 } 1121 1133 1122 1134 static s32 tas_io_init(struct device *dev, struct sdw_slave *slave) 1123 1135 { 1124 - struct pci_dev *pci; 1125 - struct sdw_bus *bus; 1126 1136 struct tas2783_prv *tas_dev = dev_get_drvdata(dev); 1127 1137 s32 ret; 1128 1138 u8 unique_id = tas_dev->sdw_peripheral->id.unique_id; ··· 1142 1128 if (tas_dev->hw_init) 1143 1129 return 0; 1144 1130 1145 - pci = tas_get_pci_dev(slave); 1146 - if (!pci) { 1147 - dev_err(dev, "pci device id can't be read"); 1148 - return -EINVAL; 1149 - } 1150 - 1151 - bus = slave->bus; 1152 1131 tas_dev->fw_dl_task_done = false; 1153 1132 tas_dev->fw_dl_success = false; 1154 1133 ··· 1152 1145 } 1153 1146 usleep_range(2000, 2200); 1154 1147 1155 - /* subsystem_id-link_id-unique_id */ 1156 - scnprintf(tas_dev->rca_binaryname, sizeof(tas_dev->rca_binaryname), 1157 - "%04X-%1X-%1X.bin", pci->subsystem_device, bus->link_id, 1158 - unique_id); 1148 + tas_generate_fw_name(slave, tas_dev->rca_binaryname, 1149 + sizeof(tas_dev->rca_binaryname)); 1159 1150 1160 1151 ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT, 1161 1152 tas_dev->rca_binaryname, tas_dev->dev,