summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiranjan H Y <niranjan.hy@ti.com>2025-12-15 18:32:16 +0300
committerMark Brown <broonie@kernel.org>2025-12-18 11:21:48 +0300
commit2bc4b4f77cb70df3ef05b80d0cb19edba17f04a6 (patch)
tree53c16404bc58bd65ad9fa23258aea6e35dad84f8
parentce65a90222e94eec1e5b7d0224b4d647af644cdc (diff)
downloadlinux-2bc4b4f77cb70df3ef05b80d0cb19edba17f04a6.tar.xz
ASoc: tas2783A: fw name based on system details
The firmware file for tas2783A contains the device and algorithm settings. So the firmware files are unique for a system and driver should have the ability to distinctly identify and pick the right firmware. This commit adds the method to uniquely identify the firmware for a system based on the below format. <Subsystem>-<Link>-<Unique>.bin * Subsystem is the PCI device subsystem-id * Link is the SoundWire link id on which the device recides. * Unique is the SoundWire slave unique id in the system. Signed-off-by: Niranjan H Y <niranjan.hy@ti.com> Link: https://patch.msgid.link/20251215153219.810-5-niranjan.hy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/tas2783-sdw.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 397442cd67ff..adfbccedbf98 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -27,6 +27,7 @@
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/soundwire/sdw_type.h>
+#include <linux/pci.h>
#include <sound/sdw.h>
#include <sound/soc.h>
#include <sound/tlv.h>
@@ -1162,8 +1163,21 @@ static const struct dev_pm_ops tas2783_sdca_pm = {
RUNTIME_PM_OPS(tas2783_sdca_dev_suspend, tas2783_sdca_dev_resume, NULL)
};
+static struct pci_dev *tas_get_pci_dev(struct sdw_slave *peripheral)
+{
+ struct device *dev = &peripheral->dev;
+
+ for (; dev; dev = dev->parent)
+ if (dev->bus == &pci_bus_type)
+ return to_pci_dev(dev);
+
+ return NULL;
+}
+
static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
{
+ struct pci_dev *pci;
+ struct sdw_bus *bus;
struct tas2783_prv *tas_dev = dev_get_drvdata(dev);
s32 ret;
u8 unique_id = tas_dev->sdw_peripheral->id.unique_id;
@@ -1171,6 +1185,13 @@ static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
if (tas_dev->hw_init)
return 0;
+ pci = tas_get_pci_dev(slave);
+ if (!pci) {
+ dev_err(dev, "pci device id can't be read");
+ return -EINVAL;
+ }
+
+ bus = slave->bus;
tas_dev->fw_dl_task_done = false;
tas_dev->fw_dl_success = false;
@@ -1181,8 +1202,10 @@ static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
}
usleep_range(2000, 2200);
+ /* subsystem_id-link_id-unique_id */
scnprintf(tas_dev->rca_binaryname, sizeof(tas_dev->rca_binaryname),
- "tas2783-%01x.bin", unique_id);
+ "%04X-%1X-%1X.bin", pci->subsystem_device, bus->link_id,
+ unique_id);
ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
tas_dev->rca_binaryname, tas_dev->dev,