ASoC: Intel: Skylake: Generate topology name for NHLT table header
authorVinod Koul <vinod.koul@intel.com>
Fri, 19 Feb 2016 06:12:34 +0000 (11:42 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 19 Feb 2016 15:34:47 +0000 (00:34 +0900)
NHLT table [1] header has fields like oem_id, oem_table_id and
oem_revision. Use that to load a unique topology binary specific
to that platform

NHLT Table is documented at:
[1]: https://01.org/blogs/2016/intel-smart-sound-technology-audio-dsp

Signed-off-by: Yang A Fang <yang.a.fang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-nhlt.c
sound/soc/intel/skylake/skl-topology.c
sound/soc/intel/skylake/skl.c
sound/soc/intel/skylake/skl.h

index 6e4b21cdb1bd9bff4b6606103bd41629c0ab2b7f..14d1916ea9f843af75622cd50c93dcf5d426fd68 100644 (file)
@@ -145,3 +145,37 @@ struct nhlt_specific_cfg
 
        return NULL;
 }
+
+static void skl_nhlt_trim_space(struct skl *skl)
+{
+       char *s = skl->tplg_name;
+       int cnt;
+       int i;
+
+       cnt = 0;
+       for (i = 0; s[i]; i++) {
+               if (!isspace(s[i]))
+                       s[cnt++] = s[i];
+       }
+
+       s[cnt] = '\0';
+}
+
+int skl_nhlt_update_topology_bin(struct skl *skl)
+{
+       struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
+       struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
+       struct device *dev = bus->dev;
+
+       dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n",
+               nhlt->header.oem_id, nhlt->header.oem_table_id,
+               nhlt->header.oem_revision);
+
+       snprintf(skl->tplg_name, sizeof(skl->tplg_name), "%x-%.6s-%.8s-%d%s",
+               skl->pci_id, nhlt->header.oem_id, nhlt->header.oem_table_id,
+               nhlt->header.oem_revision, "-tplg.bin");
+
+       skl_nhlt_trim_space(skl);
+
+       return 0;
+}
index 216d7a8e56803a97ce89acb62b823fc839fe96e1..ba0d02d1613e04407e514469c05d7d39d7f58d30 100644 (file)
@@ -1716,11 +1716,16 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
        struct hdac_bus *bus = ebus_to_hbus(ebus);
        struct skl *skl = ebus_to_skl(ebus);
 
-       ret = request_firmware(&fw, "dfw_sst.bin", bus->dev);
+       ret = request_firmware(&fw, skl->tplg_name, bus->dev);
        if (ret < 0) {
                dev_err(bus->dev, "tplg fw %s load failed with %d\n",
-                               "dfw_sst.bin", ret);
-               return ret;
+                               skl->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",
+                                       "dfw_sst.bin", ret);
+                       return ret;
+               }
        }
 
        /*
index 06f4b2c134233524b9d871756e9120fb9d2afab5..f89abb179efe0059f2ae5f36438642bee7efbe02 100644 (file)
@@ -573,11 +573,15 @@ static int skl_probe(struct pci_dev *pci,
        if (err < 0)
                goto out_free;
 
+       skl->pci_id = pci->device;
+
        skl->nhlt = skl_nhlt_init(bus->dev);
 
        if (skl->nhlt == NULL)
                goto out_free;
 
+       skl_nhlt_update_topology_bin(skl);
+
        pci_set_drvdata(skl->pci, ebus);
 
        /* check if dsp is there */
index 4d18293b5537e78b286921bddcedb5b18407b5ee..1ca1911f158747b88de229e54abcc2de5beaf93f 100644 (file)
@@ -73,6 +73,8 @@ struct skl {
        struct list_head ppl_list;
 
        const char *fw_name;
+       char tplg_name[64];
+       unsigned short pci_id;
        const struct firmware *tplg;
 
        int supend_active;
@@ -96,6 +98,7 @@ void skl_nhlt_free(void *addr);
 struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
                        u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
 
+int skl_nhlt_update_topology_bin(struct skl *skl);
 int skl_init_dsp(struct skl *skl);
 void skl_free_dsp(struct skl *skl);
 int skl_suspend_dsp(struct skl *skl);
This page took 0.030093 seconds and 5 git commands to generate.