Skip to content

Commit 90405d3

Browse files
committed
ASoc: tas2783A: fw name based on system details
Signed-off-by: Niranjan H Y <[email protected]>
1 parent d30608c commit 90405d3

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

sound/soc/codecs/tas2783-sdw.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/soundwire/sdw.h>
2828
#include <linux/soundwire/sdw_registers.h>
2929
#include <linux/soundwire/sdw_type.h>
30+
#include <linux/pci.h>
3031
#include <sound/sdca_function.h>
3132
#include <sound/sdw.h>
3233
#include <sound/soc.h>
@@ -1172,19 +1173,42 @@ static const struct dev_pm_ops tas2783_sdca_pm = {
11721173
RUNTIME_PM_OPS(tas2783_sdca_dev_suspend, tas2783_sdca_dev_resume, NULL)
11731174
};
11741175

1176+
static struct pci_dev *tas_get_hwid(struct sdw_slave *peripheral)
1177+
{
1178+
struct device *dev = &peripheral->dev;
1179+
1180+
for (; dev; dev = dev->parent)
1181+
if (dev->bus == &pci_bus_type)
1182+
return to_pci_dev(dev);
1183+
1184+
return NULL;
1185+
}
1186+
11751187
static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
11761188
{
1189+
struct pci_dev *pci;
1190+
struct sdw_bus *bus;
11771191
struct tas2783_prv *tas_dev = dev_get_drvdata(dev);
11781192
s32 ret;
11791193
u8 unique_id = tas_dev->sdw_peripheral->id.unique_id;
11801194

11811195
if (tas_dev->hw_init)
11821196
return 0;
11831197

1198+
pci = tas_get_hwid(slave);
1199+
if (!pci) {
1200+
dev_err(dev, "pci device id can't be read");
1201+
return -EINVAL;
1202+
}
1203+
1204+
bus = slave->bus;
11841205
tas_dev->fw_dl_task_done = false;
11851206
tas_dev->fw_dl_success = false;
1207+
1208+
/* subsystem_id-link_id-unique_id */
11861209
scnprintf(tas_dev->rca_binaryname, sizeof(tas_dev->rca_binaryname),
1187-
"tas2783-%01x.bin", unique_id);
1210+
"%04X-%1X-%1X.bin", pci->subsystem_device, bus->link_id,
1211+
unique_id);
11881212

11891213
ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
11901214
tas_dev->rca_binaryname, tas_dev->dev,

0 commit comments

Comments
 (0)