diff options
author | Vinod Koul <vinod.koul@intel.com> | 2016-02-19 01:12:34 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-02-19 10:34:47 -0500 |
commit | 4b235c43deb8283802281a299cb730001a6ad1da (patch) | |
tree | 28a9fffcacb98b980988ff49f829ccd3450102d8 /sound/soc/intel/skylake/skl-nhlt.c | |
parent | 2d1419a329e7de825c03738ad2ac532153239388 (diff) |
ASoC: Intel: Skylake: Generate topology name for NHLT table header
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>
Diffstat (limited to 'sound/soc/intel/skylake/skl-nhlt.c')
-rw-r--r-- | sound/soc/intel/skylake/skl-nhlt.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index 6e4b21cdb1bd..14d1916ea9f8 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c | |||
@@ -145,3 +145,37 @@ struct nhlt_specific_cfg | |||
145 | 145 | ||
146 | return NULL; | 146 | return NULL; |
147 | } | 147 | } |
148 | |||
149 | static void skl_nhlt_trim_space(struct skl *skl) | ||
150 | { | ||
151 | char *s = skl->tplg_name; | ||
152 | int cnt; | ||
153 | int i; | ||
154 | |||
155 | cnt = 0; | ||
156 | for (i = 0; s[i]; i++) { | ||
157 | if (!isspace(s[i])) | ||
158 | s[cnt++] = s[i]; | ||
159 | } | ||
160 | |||
161 | s[cnt] = '\0'; | ||
162 | } | ||
163 | |||
164 | int skl_nhlt_update_topology_bin(struct skl *skl) | ||
165 | { | ||
166 | struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt; | ||
167 | struct hdac_bus *bus = ebus_to_hbus(&skl->ebus); | ||
168 | struct device *dev = bus->dev; | ||
169 | |||
170 | dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n", | ||
171 | nhlt->header.oem_id, nhlt->header.oem_table_id, | ||
172 | nhlt->header.oem_revision); | ||
173 | |||
174 | snprintf(skl->tplg_name, sizeof(skl->tplg_name), "%x-%.6s-%.8s-%d%s", | ||
175 | skl->pci_id, nhlt->header.oem_id, nhlt->header.oem_table_id, | ||
176 | nhlt->header.oem_revision, "-tplg.bin"); | ||
177 | |||
178 | skl_nhlt_trim_space(skl); | ||
179 | |||
180 | return 0; | ||
181 | } | ||