From: Bartosz Juraszewski <bjuraszewski@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>, Sen Wang <sen@ti.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Juraszewski <bjuraszewski@gmail.com>
Subject: [PATCH v3] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
Date: Sun, 21 Jun 2026 16:00:01 +0200 [thread overview]
Message-ID: <20260621140001.63829-1-bjuraszewski@gmail.com> (raw)
In-Reply-To: <d2558567-67b9-4fca-b170-c6ece9f8cf23@sirena.org.uk>
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@gmail.com>
---
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
next prev parent reply other threads:[~2026-06-21 14:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 17:53 [PATCH] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519 Bartosz Juraszewski
2026-06-02 18:25 ` Mark Brown
2026-06-07 9:30 ` [PATCH v2] " Bartosz Juraszewski
2026-06-16 16:20 ` Mark Brown
2026-06-21 14:00 ` Bartosz Juraszewski [this message]
2026-06-22 11:58 ` [PATCH v3] " Mark Brown
2026-06-22 18:27 ` [PATCH v4] " Bartosz Juraszewski
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=20260621140001.63829-1-bjuraszewski@gmail.com \
--to=bjuraszewski@gmail.com \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=kevin-lu@ti.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sen@ti.com \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox