[PATCH v3] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
From: Bartosz Juraszewski
Date: Sun Jun 21 2026 - 10:01:31 EST
In linux-firmware commit from 2026-05-19 `2f90f4fe5c67f51a8410907a...`
`ASoC: tas2783: Add Firmware files for tas2783A projects` by Baojun Xu
138 new firmware files for tas2783 were added, none of which are loaded
by the kernel. Kernel expects files to be named with the following
convention: "%04X-%1X-%1X.bin". However the added firmware files follow
"-0x%1X.bin" naming instead with `0x` hex prefix, which fails to load
resulting in following dmesg log:
slave-tas2783 sdw:0:1:0102:0000:01:8: Direct firmware load for 1714-1-8.bin failed with error -2
slave-tas2783 sdw:0:1:0102:0000:01:8: Failed to read fw binary 1714-1-8.bin
slave-tas2783 sdw:0:1:0102:0000:01:b: Direct firmware load for 1714-1-B.bin failed with error -2
slave-tas2783 sdw:0:1:0102:0000:01:b: Failed to read fw binary 1714-1-B.bin
slave-tas2783 sdw:0:1:0102:0000:01:8: error playback without fw download
slave-tas2783 sdw:0:1:0102:0000:01:8: ASoC error (-22): at snd_soc_dai_hw_params() on tas2783-codec
This same commit removes all 22 symlinks from WHENCE, that used naming
without the '0x' prefix to only 6 prevoiusly existing .bin files.
This patch adds `0x` prefix explicitly to the generated firmware name
allowing file to successfully load. In case prefixed firmware is missing
due to out of date linux-firmware, we set the fallback flag and attempt
to load firmware again based on the old file names.
This prefix change results in functioning firmware loading on ASUS
ProArt PX13 HN7306EAC, which uses 1714-1-0x8.bin and 1714-1-0xB.bin
firmware files.
Tested on top of 7.1 and next-20260619 with SND_SOC_AMD_ACP7X set to no.
Signed-off-by: Bartosz Juraszewski <bjuraszewski@xxxxxxxxx>
---
Hi Mark,
> > @@ -800,6 +815,11 @@ static void tas2783_fw_ready(const struct firmware *fmw, void *context)
> > wake_up(&tas_dev->fw_wait);
> > if (fmw)
> > release_firmware(fmw);
> > +
> > + if (try_load_fallback) {
> > + dev_info(tas_dev->dev, "Attempting fallback fw load\n");
> > + tas_io_init(tas_dev->dev, tas_dev->sdw_peripheral);
> > + }
> > }
> >
>
> This will unconditionally wake fw_wait even if we've gone for the
> fallback, meaning that the rest of the driver will think the firmware
> is ready when it isn't.
Changed the way we load fallback fw to prevent the race condition of
driver init proceeding before all loads are finished.
v3:
- tas2783_fw_ready callback no longer calls tas_io_init, only sets flag
- tas_io_init orchestrates both loads using fw_wait and flag check
- tas_io_init proceeds with init only after all loads finish
- new tas_fw_load helper for repeating fw loading and waiting logic
- renamed fw_using_fallback to fw_use_fallback
- fw_use_fallback resets on every init now to try both bins again
v2:
- new fw_using_fallback device flag; set when new format fw not present
- if !fw_using_fallback and load fails, set flag and try reloading
- when fw_using_fallback - generate fw name with old format string
sound/soc/codecs/tas2783-sdw.c | 75 +++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 24 deletions(-)
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 7d70e7e3f24f..bbaeac5837c7 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -100,6 +100,8 @@ struct tas2783_prv {
wait_queue_head_t fw_wait;
bool fw_dl_task_done;
bool fw_dl_success;
+ /* use fallback fw name */
+ bool fw_use_fallback;
};
static const struct reg_default tas2783_reg_default[] = {
@@ -740,11 +742,19 @@ static void tas2783_fw_ready(const struct firmware *fmw, void *context)
goto out;
}
+ /* firmware binary not found*/
if (!fmw || !fmw->data) {
- /* firmware binary not found*/
- dev_err(tas_dev->dev,
- "Failed to read fw binary %s\n",
- tas_dev->rca_binaryname);
+ if (!tas_dev->fw_use_fallback) {
+ tas_dev->fw_use_fallback = true;
+ dev_info(tas_dev->dev,
+ "Failed to read preferred fw binary: %s, attempting fallback binary load\n",
+ tas_dev->rca_binaryname);
+ } else {
+ dev_err(tas_dev->dev,
+ "Failed to read fallback fw binary %s\n",
+ tas_dev->rca_binaryname);
+ }
+
ret = -EINVAL;
goto out;
}
@@ -1103,13 +1113,16 @@ static void tas_generate_fw_name(struct sdw_slave *slave, char *name, size_t siz
bool pci_found = false;
#if IS_ENABLED(CONFIG_PCI)
struct device *dev = &slave->dev;
+ struct tas2783_prv *tas_dev = dev_get_drvdata(&slave->dev);
struct pci_dev *pci = NULL;
+ const char *fw_uid_prefix = tas_dev->fw_use_fallback ? "" : "0x";
for (; dev; dev = dev->parent) {
if (dev->bus == &pci_bus_type) {
pci = to_pci_dev(dev);
- scnprintf(name, size, "%04X-%1X-%1X.bin",
- pci->subsystem_device, bus->link_id, unique_id);
+ scnprintf(name, size, "%04X-%1X-%s%1X.bin",
+ pci->subsystem_device, bus->link_id,
+ fw_uid_prefix, unique_id);
pci_found = true;
break;
}
@@ -1121,17 +1134,45 @@ static void tas_generate_fw_name(struct sdw_slave *slave, char *name, size_t siz
bus->link_id, unique_id);
}
+static s32 tas_fw_load(struct tas2783_prv *tas_dev, struct sdw_slave *slave)
+{
+ s32 ret;
+ u8 unique_id = tas_dev->sdw_peripheral->id.unique_id;
+
+ tas_generate_fw_name(slave, tas_dev->rca_binaryname,
+ sizeof(tas_dev->rca_binaryname));
+
+ ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
+ tas_dev->rca_binaryname, tas_dev->dev,
+ GFP_KERNEL, tas_dev, tas2783_fw_ready);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "firmware request failed for uid=%d, ret=%d\n",
+ unique_id, ret);
+ return ret;
+ }
+
+ ret = wait_event_timeout(tas_dev->fw_wait, tas_dev->fw_dl_task_done,
+ msecs_to_jiffies(TIMEOUT_FW_DL_MS));
+ if (!ret) {
+ dev_err(tas_dev->dev, "fw request, wait_event timeout\n");
+ return -EAGAIN;
+ }
+
+ return 0;
+}
+
static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
{
struct tas2783_prv *tas_dev = dev_get_drvdata(dev);
s32 ret;
- u8 unique_id = tas_dev->sdw_peripheral->id.unique_id;
if (tas_dev->hw_init)
return 0;
tas_dev->fw_dl_task_done = false;
tas_dev->fw_dl_success = false;
+ tas_dev->fw_use_fallback = false;
ret = regmap_write(tas_dev->regmap, TAS2783_SW_RESET, 0x1);
if (ret) {
@@ -1140,25 +1181,11 @@ static s32 tas_io_init(struct device *dev, struct sdw_slave *slave)
}
usleep_range(2000, 2200);
- tas_generate_fw_name(slave, tas_dev->rca_binaryname,
- sizeof(tas_dev->rca_binaryname));
+ ret = tas_fw_load(tas_dev, slave);
+ if (!ret && tas_dev->fw_use_fallback)
+ ret = tas_fw_load(tas_dev, slave);
- ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
- tas_dev->rca_binaryname, tas_dev->dev,
- GFP_KERNEL, tas_dev, tas2783_fw_ready);
- if (ret) {
- dev_err(tas_dev->dev,
- "firmware request failed for uid=%d, ret=%d\n",
- unique_id, ret);
- return ret;
- }
-
- ret = wait_event_timeout(tas_dev->fw_wait, tas_dev->fw_dl_task_done,
- msecs_to_jiffies(TIMEOUT_FW_DL_MS));
if (!ret) {
- dev_err(tas_dev->dev, "fw request, wait_event timeout\n");
- ret = -EAGAIN;
- } else {
if (tas_dev->sa_func_data)
ret = sdca_regmap_write_init(dev, tas_dev->regmap,
tas_dev->sa_func_data);
--
2.54.0