From: Niranjan H Y <niranjan.hy@ti.com>
To: <alsa-devel@alsa-project.org>
Cc: <linux-sound@vger.kernel.org>, <broonie@kernel.org>,
<ckeepax@opensource.cirrus.com>, <lgirdwood@gmail.com>,
<yung-chuan.liao@linux.intel.com>,
<ranjani.sridharan@linux.intel.com>, <perex@perex.cz>,
<tiwai@suse.com>, <cezary.rojewski@intel.com>,
<peter.ujfalusi@linux.intel.com>, <kai.vehmanen@linux.intel.com>,
<pierre-louis.bossart@linux.dev>, <shenghao-ding@ti.com>,
<v-hampiholi@ti.com>, <baojun.xu@ti.com>,
<dan.carpenter@linaro.org>, <sandeepk@ti.com>,
Niranjan H Y <niranjan.hy@ti.com>
Subject: [PATCH v2 5/8] ASoc: tas2783A: fw name based on system details
Date: Mon, 15 Dec 2025 21:02:16 +0530 [thread overview]
Message-ID: <20251215153219.810-5-niranjan.hy@ti.com> (raw)
In-Reply-To: <20251215153219.810-1-niranjan.hy@ti.com>
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>
---
v2:
- no change
---
sound/soc/codecs/tas2783-sdw.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 397442cd6..adfbccedb 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,
--
2.43.0
next prev parent reply other threads:[~2025-12-17 9:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 15:32 [PATCH v2 1/8] ASoC: tas2783A: sdw_utils: support ch 3 & 4 Niranjan H Y
2025-12-15 15:32 ` [PATCH v2 2/8] ASoC: tas2783A: use custom firmware Niranjan H Y
2025-12-15 15:32 ` [PATCH v2 3/8] ASoC: tas2783A: update default init writes Niranjan H Y
2025-12-15 15:32 ` [PATCH v2 4/8] ASoC: tas2783A: fix error log for calibration data Niranjan H Y
2025-12-15 15:32 ` Niranjan H Y [this message]
2025-12-15 15:32 ` [PATCH v2 6/8] ASoc: tas2783A: acpi match for 4 channel for mtl Niranjan H Y
2025-12-15 15:32 ` [PATCH v2 7/8] ASoC: tas2783A: use acpi initialisation table Niranjan H Y
2025-12-15 15:47 ` Charles Keepax
2025-12-15 15:32 ` [PATCH v2 8/8] ASoC: tas2783A: read slave properties from acpi table Niranjan H Y
2025-12-18 15:32 ` [PATCH v2 1/8] ASoC: tas2783A: sdw_utils: support ch 3 & 4 Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251215153219.810-5-niranjan.hy@ti.com \
--to=niranjan.hy@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=dan.carpenter@linaro.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sandeepk@ti.com \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.com \
--cc=v-hampiholi@ti.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.