alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Gorski <mateusz.gorski@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Mateusz Gorski <mateusz.gorski@linux.intel.com>,
	cezary.rojewski@intel.com, broonie@kernel.org, tiwai@suse.com,
	pierre-louis.bossart@linux.intel.com
Subject: [PATCH v6 1/3] ASoC: Intel: Skylake: Add alternative topology binary name
Date: Mon, 27 Apr 2020 15:27:25 +0200	[thread overview]
Message-ID: <20200427132727.24942-2-mateusz.gorski@linux.intel.com> (raw)
In-Reply-To: <20200427132727.24942-1-mateusz.gorski@linux.intel.com>

Add alternative topology binary file name based on used machine driver
and fallback to use this name after failed attempt to load topology file
with name based on NHLT.
This change addresses multiple issues with current mechanism, for
example - there are devices without NHLT table, and that currently
results in tplg_name being empty.

Signed-off-by: Mateusz Gorski <mateusz.gorski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
---

Changes in v2:
- added <sound/soc-acpi.h> include
- machine driver name is now read from different field

Changes in v3:
- deleted additional newline after component_load:

Changes in v4:
--none--

Changes in v5:
- addressed "checkpatch.pl --strict" warnings

Changes in v6:
--none--

 sound/soc/intel/skylake/skl-topology.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 69cd7a81bf2a..4b114ece58c6 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -14,6 +14,7 @@
 #include <linux/uuid.h>
 #include <sound/intel-nhlt.h>
 #include <sound/soc.h>
+#include <sound/soc-acpi.h>
 #include <sound/soc-topology.h>
 #include <uapi/sound/snd_sst_tokens.h>
 #include <uapi/sound/skl-tplg-interface.h>
@@ -3565,8 +3566,20 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
 
 	ret = request_firmware(&fw, skl->tplg_name, bus->dev);
 	if (ret < 0) {
-		dev_info(bus->dev, "tplg fw %s load failed with %d, falling back to dfw_sst.bin",
-				skl->tplg_name, ret);
+		char alt_tplg_name[64];
+
+		snprintf(alt_tplg_name, sizeof(alt_tplg_name), "%s-tplg.bin",
+			 skl->mach->drv_name);
+		dev_info(bus->dev, "tplg fw %s load failed with %d, trying alternative tplg name %s",
+			 skl->tplg_name, ret, alt_tplg_name);
+
+		ret = request_firmware(&fw, alt_tplg_name, bus->dev);
+		if (!ret)
+			goto component_load;
+
+		dev_info(bus->dev, "tplg %s failed with %d, falling back to dfw_sst.bin",
+			 alt_tplg_name, ret);
+
 		ret = request_firmware(&fw, "dfw_sst.bin", bus->dev);
 		if (ret < 0) {
 			dev_err(bus->dev, "Fallback tplg fw %s load failed with %d\n",
@@ -3575,6 +3588,8 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
 		}
 	}
 
+component_load:
+
 	/*
 	 * The complete tplg for SKL is loaded as index 0, we don't use
 	 * any other index
-- 
2.17.1


  reply	other threads:[~2020-04-27 13:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 13:27 [PATCH v6 0/3] Add support for different DMIC configurations Mateusz Gorski
2020-04-27 13:27 ` Mateusz Gorski [this message]
2020-04-27 13:27 ` [PATCH v6 2/3] ASoC: Intel: Multiple I/O PCM format support for pipe Mateusz Gorski
2020-04-27 13:27 ` [PATCH v6 3/3] ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT Mateusz Gorski
2020-04-27 13:30 ` [PATCH v6 0/3] Add support for different DMIC configurations Pierre-Louis Bossart
2020-04-27 15:02 ` 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=20200427132727.24942-2-mateusz.gorski@linux.intel.com \
    --to=mateusz.gorski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    --subject='Re: [PATCH v6 1/3] ASoC: Intel: Skylake: Add alternative topology binary name' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).