Commit graph

5 commits

Author SHA1 Message Date
Jaroslav Kysela
feb9c4cdec reshuffle included files to include config.h as first
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).

Related: https://github.com/alsa-project/alsa-utils/pull/223
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 18:48:23 +02:00
Jaroslav Kysela
153d185822 topology: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:33:19 +02:00
Jaska Uimonen
e13a7d3cf6 topology: plugins: nhlt: add dmic dai index
Dmic might have multiple configurations for the same hw, so add them to
nhlt blob. The configurations are separated by dai_index.

Fixes: https://github.com/alsa-project/alsa-utils/pull/164
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:04:29 +01:00
Yong Zhi
038ed518e9 topology: plugins: fix off by 1 mem allocation error
Fix valgrind memcheck error:

==1337389== Invalid write of size 1
==1337389==    at 0x4A4AFAB: __vsnprintf_internal (vsnprintf.c:117)
==1337389==    by 0x4AECF40: __snprintf_chk (snprintf_chk.c:38)
==1337389==    by 0x484B870: snprintf (stdio2.h:67)
==1337389==    by 0x484B870: print_as_hex_bytes (nhlt-processor.c:112)
==1337389==    by 0x484B870: merge_manifest_data (nhlt-processor.c:154)
==1337389==    by 0x484B870: do_nhlt (nhlt-processor.c:420)
==1337389==    by 0x484B870: _snd_topology_nhlt_process (nhlt-processor.c:484)

The consecutive snprintf overwrites always the previous terminator until
it hits the very last call of:

snprintf(dst, ALSA_BYTE_CHARS + 1, "0x%02x,", *nhlt_buffer);

when the size n given to snprintf is 1 more than allocated.

Fixes: https://github.com/alsa-project/alsa-utils/pull/162
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:03:35 +01:00
Jaska Uimonen
f9e6010d5e topology: plugins - add Intel nhlt encoder plugin
Add Intel nhlt acpi table encoder plugin into topology2.0 processing.
Nhlt internal structure is defined in:
https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf
Nhlt acpi table contain vendor specific binary data blobs that are used
in some Intel dsp platforms for configuring the dmic and ssp hardware.

The function of this code is mainly to generate the vendor specific
binary blobs, but as there is existing nhlt parser code and header in
kernel there's no point of re-inventing the container: just use the
existing nhlt acpi table format. Basically this code is creating similar
nhlt acpi table that you would get from: cat
/sys/firmware/acpi/tables/NHLT

This code will have implementation for dmic and ssp endpoints. Thus the
code will translate the topology dai tokens into vendor specific binary
blobs and pack them into nhlt acpi table. Ssp and dmic code is lifted
from Sound Open Firmware (sof) code base, thus it will have BSD-3
license.

This plugin can be enabled from command line with:

alsatplg -DPREPROCESS_PLUGINS="nhlt" -c foo.conf -p -o bar.tplg

You can also dump the nhlt binary into a file with additional define:

-DNHLT_BIN="nhlt.bin"

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:24:03 +02:00