Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
@ 2026-06-02 17:53 Bartosz Juraszewski
  2026-06-02 18:25 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Juraszewski @ 2026-06-02 17:53 UTC (permalink / raw)
  To: shenghao-ding, kevin-lu, baojun.xu, broonie
  Cc: lgirdwood, perex, tiwai, linux-sound, linux-kernel,
	Bartosz Juraszewski

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. This results in functioning audio on
my device - ASUS ProArt PX13 HN7306EAC, which uses 1714-1-0x8.bin and
1714-1-0xB.bin firmware files.

Tested on top of 7.1.0-rc6, but no changes exist in newest linux-next.

Signed-off-by: Bartosz Juraszewski <bjuraszewski@gmail.com>
---
 sound/soc/codecs/tas2783-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 90008d2d06e2..58074d18f78a 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -1120,7 +1120,7 @@ static void tas_generate_fw_name(struct sdw_slave *slave, char *name, size_t siz
 	for (; dev; dev = dev->parent) {
 		if (dev->bus == &pci_bus_type) {
 			pci = to_pci_dev(dev);
-			scnprintf(name, size, "%04X-%1X-%1X.bin",
+			scnprintf(name, size, "%04X-%1X-0x%1X.bin",
 				  pci->subsystem_device, bus->link_id, unique_id);
 			pci_found = true;
 			break;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-06-02 18:25 UTC (permalink / raw)
  To: Bartosz Juraszewski
  Cc: shenghao-ding, kevin-lu, baojun.xu, lgirdwood, perex, tiwai,
	linux-sound, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

On Tue, Jun 02, 2026 at 07:53:59PM +0200, Bartosz Juraszewski wrote:

> This same commit removes all 22 symlinks from WHENCE, that used naming
> without the '0x' prefix to only 6 prevoiusly existing .bin files.

So there will be existing userspace using the old names.

> This patch adds `0x` prefix explicitly to the generated firmware name
> allowing file to successfully load. This results in functioning audio on
> my device - ASUS ProArt PX13 HN7306EAC, which uses 1714-1-0x8.bin and
> 1714-1-0xB.bin firmware files.

>  	for (; dev; dev = dev->parent) {
>  		if (dev->bus == &pci_bus_type) {
>  			pci = to_pci_dev(dev);
> -			scnprintf(name, size, "%04X-%1X-%1X.bin",
> +			scnprintf(name, size, "%04X-%1X-0x%1X.bin",
>  				  pci->subsystem_device, bus->link_id, unique_id);

This will only use the new name, meaning that an existing working
install will be broken when upgrading the kernel unless linux-firmware
is also updated.  We should try both names, assuming the change in name
stays, so that existing installs continue to work.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
  2026-06-02 18:25 ` Mark Brown
@ 2026-06-07  9:30   ` Bartosz Juraszewski
  2026-06-16 16:20     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Juraszewski @ 2026-06-07  9:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Bartosz Juraszewski, Shenghao Ding, Kevin Lu, Baojun Xu,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-kernel

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.0-rc6, but no changes exist in newest linux-next.

Signed-off-by: Bartosz Juraszewski <bjuraszewski@gmail.com>
---
Hi Mark,

> This will only use the new name, meaning that an existing working
> install will be broken when upgrading the kernel unless linux-firmware
> is also updated.  We should try both names, assuming the change in name
> stays, so that existing installs continue to work.

You're right, I've added a fallback to try old name if new one fails.

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 | 36 ++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 90008d2d06e2..8c64af82b094 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_using_fallback;
 };
 
 static const struct reg_default tas2783_reg_default[] = {
@@ -725,6 +727,8 @@ static s32 tas_fw_get_next_file(const u8 *data, struct tas_fw_file *file)
 	return file->length + sizeof(u32) * 5;
 }
 
+static s32 tas_io_init(struct device *dev, struct sdw_slave *slave);
+
 static void tas2783_fw_ready(const struct firmware *fmw, void *context)
 {
 	struct tas2783_prv *tas_dev =
@@ -732,6 +736,7 @@ static void tas2783_fw_ready(const struct firmware *fmw, void *context)
 	const u8 *buf = NULL;
 	s32  img_sz, ret = 0, cur_file = 0;
 	s32 offset = 0;
+	bool try_load_fallback = false;
 
 	struct tas_fw_hdr *hdr __free(kfree) = kzalloc_obj(*hdr);
 	struct tas_fw_file *file __free(kfree) = kzalloc_obj(*file);
@@ -740,11 +745,21 @@ 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_using_fallback) {
+			tas_dev->fw_using_fallback = true;
+			try_load_fallback = true;
+
+			dev_info(tas_dev->dev,
+				"Failed to read preferred fw binary: %s\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;
 	}
@@ -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);
+	}
 }
 
 static inline s32 tas_clear_latch(struct tas2783_prv *priv)
@@ -1115,13 +1135,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_using_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;
 		}
@@ -1326,6 +1349,7 @@ static s32 tas_sdw_probe(struct sdw_slave *peripheral,
 	mutex_init(&tas_dev->calib_lock);
 	mutex_init(&tas_dev->pde_lock);
 
+	tas_dev->fw_using_fallback = false;
 	init_waitqueue_head(&tas_dev->fw_wait);
 	dev_set_drvdata(dev, tas_dev);
 	regmap = devm_regmap_init_sdw_mbq_cfg(&peripheral->dev,
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ASoC: tas2783: Update loaded firmware names to linux-firmware 20260519
  2026-06-07  9:30   ` [PATCH v2] " Bartosz Juraszewski
@ 2026-06-16 16:20     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-06-16 16:20 UTC (permalink / raw)
  To: Bartosz Juraszewski
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

On Sun, Jun 07, 2026 at 11:30:23AM +0200, Bartosz Juraszewski wrote:

> 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.

> @@ -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.

>  static inline s32 tas_clear_latch(struct tas2783_prv *priv)
> @@ -1115,13 +1135,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_using_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;
>  		}
> @@ -1326,6 +1349,7 @@ static s32 tas_sdw_probe(struct sdw_slave *peripheral,
>  	mutex_init(&tas_dev->calib_lock);
>  	mutex_init(&tas_dev->pde_lock);
>  
> +	tas_dev->fw_using_fallback = false;
>  	init_waitqueue_head(&tas_dev->fw_wait);
>  	dev_set_drvdata(dev, tas_dev);
>  	regmap = devm_regmap_init_sdw_mbq_cfg(&peripheral->dev,
> -- 
> 2.54.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-16 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox