Commit Graph

733 Commits

Author SHA1 Message Date
Mohana Datta Yelugoti 4758413fda testbench: check array size in component parsing
There may be a situation where size of all elements of the
snd_tplg_vendor_array is greater than the private data size.

If we take a look at array structure
struct snd_soc_tplg_vendor_array {
	__le32 size;	/* size in bytes of the array, including all elements */
	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
	__le32 num_elems;	/* number of elements in array */
	union {
		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
		struct snd_soc_tplg_vendor_value_elem value[0];
		struct snd_soc_tplg_vendor_string_elem string[0];
	};
} __attribute__((packed));

and assume of private data size is size.

If num_elems * sizeof(..._elem) > size occurs, this is bad
because, we first try to allocate _size_ bytes via malloc to array
pointer. Since the num_elems * sizeof(..._elem) is greater than
size, we get a segmentation fault when we try to memcpy the
remaining size in the subsequent functions (read tplg_read_array()).

We fix this problem by checking for whether array size falls
within the bounds of private data size.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-14 15:13:12 +01:00
Keyon Jie 624faa9dd5 topology: tone: add uuid token support
Add the uuid token to tone widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie ad415fa2e3 topology: src: add uuid token support
Add the uuid token to src widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 33c3663114 topology: pga: add uuid token support
Add the uuid token to volume widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie c2098a1225 topology: pcm: add uuid token support
Add the uuid token to host widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 8a438296ed topology: mixer: add uuid token support
Add the uuid token to mixer widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 179a6d1842 topology: eq_iir: add uuid token support
Add the uuid token to eq_iir widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie a2e69b873b topology: eq_fir: add uuid token support
Add the uuid token to eq_fir widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie a730f70cc0 topology: dcblock: add uuid token support
Add the uuid token to dcblock widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 236a055041 topology: dai: add uuid token support
Add the uuid token to dai widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 3e64d47620 topology: asrc: add uuid token support
Add the uuid token to asrc widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 6f0b68f3fd topology: kpbm: add uuid token support
Add the uuid token to kpb widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 55a93348b5 topology: ch_sel: add uuid token support
Add the uuid token to ch_sel widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 2da0638db4 topology: detect: add uuid token support
Add the uuid token to detect widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 9f5173ce6e topology: muxdemux: add uuid token support
Add the uuid token to muxdemux widgets for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie ec6b210d8c topology: smart_amp: add uuid token to the widget
Add the uuid token to smart_amp widget for the future use.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 4572a5a59d test: topology: includes utils.m4 first
Move the including of utils.m4 to first as it is needed by other
component m4 files.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 98f5de8d56 topology: utils: add DECLARE_SOF_RT_UUID() helper
Add a helper DECLARE_SOF_RT_UUID() to generate the 16 Bytes UUID string.

The input string in this format (copied from the FW source directly):
DECLARE_SOF_RT_UUID(name, uuid_macro, a, b, c,
		 d0, d1, d2, d3, d4, d5, d6, d7);

The output string should be in this format:
a6a7:a4a5:a2a3:a0a1:b2b3:b0b1:c2c3:c0c1:d00d01:d10d11:d20d21:d30d31:
d40d41:d50d51:d60d61:d70d71

e.g. for demux component, the macro usage is:
DECLARE_SOF_RT_UUID("demux", demux_uuid, 0xc4b26868, 0x1430, 0x470e,
		 0xa0, 0x89, 0x15, 0xd1, 0xc7, 0x7f, 0x85, 0x1a);

while the output will be:
68:68:b2:c4:30:14:0e:47:a0:89:15:d1:c7:7f:85:1a

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Keyon Jie 7811c963f5 topology: tokens: add token for component UUID
Add the definition SOF_TKN_COMP_UUID for the component UUID token, this
could be used for process components as subtype/flavor soon.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-13 20:58:38 +08:00
Seppo Ingalsuo ae12907dd7 Topology: Create 1ch and 3ch microphones sof-hda-generic topologies
This patch adds to CMakeLists.txt build of duplicate one and three
channels dmic capture topologies. They are needed to match the driver
that loads a topology that matches the number of microphones based on
configured microphones count in device BIOS.

This is an intermediate solution to enable microphones on such
devices. The mono audio will appear as double mono for user space. A
true mono topology and firmware will be created later.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-12 14:58:26 +01:00
Guennadi Liakhovetski 5d99a4fb0a topology: apl-pcm512x: fix scheduler domain
The conditional definition in sof-apl-pcm512x.m4 is supposed to
select the DMA scheduler if the codec is the bclk source and the
timer scheduler otherwise, but the conditional definition is
broken which leads to the DMA scheduler being selected always.
Fix the definition.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-12 14:36:25 +01:00
Mohana Datta Yelugoti 108912bba8 tools: testbench:add null pointer variable check before accessing it
When the realloc() function fails, a NULL pointer is returned. But,
if the size argument is zero, then also NULL is returned. So, to
differentiate that, we also check if size is non zero. Only if
pointer is NULL and size is non-zero, we come to the conclusion that
realloc() failed and the allocated memory till now is freed and
appropriate error is returned.

If realloc is called on a pointer and fails, the memory pointed by
the pointer isn't freed. When realloc() fails, even this memory
is freed.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-10 11:10:20 +01:00
Diana Cretu 3b3d0ae2eb fuzzer: Add initial support for i.MX8 platform
Implement the fuzzer API for the i.MX8 platform. The difference
between other platforms and i.MX8 is the Messaging Unit(MU). We have
emulated the hardware functionality of MU by using SHMs to represent
Side A and Side B of the MU and the registers they each have. Both
qemu(VM) and fuzzer's write functions write to both sides of the MU to
successfully emulate it's functionality.

Signed-off-by: Diana Cretu <diana.cretu@nxp.com>
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-08-10 10:44:30 +01:00
Pin-chih Lin b63c3a3723 tools: testbench: Support channels specification
Support channel specification by argument "-c" on testbench

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-08-06 12:25:14 +01:00
Pin-chih Lin d38d5892f6 tools: testbench: Support multiple output files
In order to run multi-output component playback by testbench, this patch
supports multiple output file mode on running testbench. Argument "-o" is
modified to accept specifying up to 4 filenames delimited by comma,
e.g. "-o output1,output2,..."

Moreover, debug messages in tplg_parser/tplg_parser.c is refined for
demonstrating multiple pipelines better.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-08-06 12:25:14 +01:00
Pin-chih Lin 3b5447b379 tools: topology: Support multi-output playback topology
Support up to 4 output pipelines for test/topology/test-playback.m4, where
argument TEST_PIPE_AMOUNT is added for identifying the number of pipelines
while generating test topologies.

Multi-output component should be added in ALG_MULTI_MODE_TESTS and
ALG_MULTI_SIMPLE_TESTS to generate test topologies with multiple output
pipelines in the future.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-08-06 12:25:14 +01:00
Keyon Jie 639154e35b testbench: topology: initial the sof_ipc_comp_file with 0s
Initial the struct sof_ipc_comp_file to make sure all no updated flags
are 0s.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-05 14:53:31 +01:00
Mohana Datta Yelugoti bc1d785b4d tools: tplg_parser: check if parameter is valid before using it
Before accessing the contents of the parameter pointer of the
function, check if the pointer is NULL. Else, it may lead to
segmentation fault.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 21:41:05 +01:00
Pierre-Louis Bossart 4a6eea6c9a topology: bytcht: reduce deep-buffer to 5ms
Somehow a 10ms buffer for the deep-buffer pipe generates write errors
on the kernel side with S24 and S32_LE.

Reducing the memory footprint seems to fix the problem.

This may hide a more fundamental problem with either scheduling or
memory allocation, but for now let's solve CI and daily tests.

BugLink: https://github.com/thesofproject/sof/issues/3171
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-08-04 11:39:55 +01:00
Karol Trzcinski d07035d981 logger: Align g flag description in help message
Help message, near -g flags looks like:

sof-logger:      -f precision           Set timestamp precision
sof-logger:      -g             Hide timestamp
sof-logger:      -d *.ldc_file          Dump ldc_file information

before changes, and after apply this patch, descriptions are aligned.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-04 11:26:19 +01:00
Seppo Ingalsuo fa4a7bda4e Testbench: Check num_elems in tokens parsing
This patch adds check for sane num_elems value. If the calculated
array size exceeds the value size an error is returned and topology
parsing is aborted.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-04 11:25:35 +01:00
Mohana Datta Yelugoti d9fea08a24 tools: testbench: check if pointer is null before accessing it
Check if a pointer is NULL before accessing it, else, it leads
to segmentation fault.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Mohana Datta Yelugoti 8737e0b726 tools: tplg_parser: free allocated memory to avoid memory leaks
When an error is occurred when loading the widget, the memory
allocated is not freed properly. This results in memory leaks.
Avoid these memory leaks by freeing the allocated memory before
exiting the function by returning error value.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Mohana Datta Yelugoti b1dec44124 tools: testbench: initialize pointer before freeing it
When we try to free a pointer which is not initialized, we are
using a value in the program which is undefined. So, initialize
the pointer variable, so that in future, when we free the pointer
it won't cause a problem.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Marcin Rajwa ae7b911956 topology: fix playback & capture pipelines to be timer driven
This patch fixes several pipelines which are DMA driven by default
but should be driven in timer domain.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-03 21:57:27 +01:00
Artur Kloniecki 238cd1457d treewide: Remove references to .free and .avail members of audio_stream.
All audio_stream clients should use provided audio_stream_get_avail*/free*
API, instead of directly accessing .avail and .free member fields.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-08-03 21:53:14 +01:00
Bard Liao 7b8eec9f4f topology: add tgl-rt711-rt1316-rt714 support
tgl-rt711-rt1316-rt714 is almost the same as tgl-rt711-rt1308-rt715 and
can use the same topology file.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2020-08-03 21:11:51 +01:00
Sathyanarayana Nujella 091daf65c6 topology: Update sof-tgl-max98373-rt5682 to take amp SSP ID
Update sof-tgl-max98373-rt5682 to take speaker amp's SSP ID as input.
This is to accommodate DUT's which has amp connected on SSP2.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
2020-08-03 21:11:04 +01:00
Mohana Datta Yelugoti 9f1106d8a5 testbench: add null pointer check for function argument
tb_pipeline_params() function takes an argument called ipc_pipe,
which is a pointer and is derefernced in the function to access
a member of structure that pointer is pointing to.

If this pointer is NULL, this leads to Segmentation fault. A
null pointer check is added before the argument is dereferenced.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-07-23 14:28:26 +01:00
Bartosz Kokoszko 97377c3757 smart_amp: fix smart amplifier tplg
This commit changes SSP bclk rate from 9600000 to
12288000 ind ssp container to 32 bits order to fix
glitch issue.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-07-21 15:44:28 +01:00
Kai-Chuan Hsieh 8675d4cb9f tools: add TGL key signature to sof_ri_info
Provide output info if evaluated FW image was signed with
TGL production key.

Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
2020-07-16 13:39:45 +01:00
Pierre-Louis Bossart 1a8ed6dfd0 topology: mirror CML topologies for TGL
Some TGL devices use the same devices and hardware layout and on CML,
reuse.  Also remove cml-mono.m4 definition and directly add the define
in the CMakeLists.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-15 15:22:50 +01:00
Pierre-Louis Bossart 4a32011bfd topology: remove sof-icl-rt711-rt1308-rt715.m4
This file is no longer maintained and does not work with the SoundWire
drivers, remove.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-14 11:44:35 -05:00
Uday M Bhat d2a75ad038 topology: jsl-rt1015: PLL input at 50fs is no longer supported
The new recommended settings at 48Khz rate are:

PLL input       SSP bclk
------------------------
64fs            3.073Mhz
100fs           4.8Mhz

Modifying topology to 64fs
2020-07-08 14:40:54 +01:00
Karol Trzcinski adc8cc22cc sof: Unify hex dixplay style
Consistency should be kept so usage the same HEX case throughout the FW
is advised.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-07 15:48:43 +01:00
Pierre-Louis Bossart aef421ac4a topology: cht-max98090: align with byt-nocodec
Only the SSP settings need to be different.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart b51cb9113a topology: remove cht-src-50kHz-pcm512x
No one uses this topology so let's remove it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart 1a8c123511 topology: cht-rt5682: align with byt-codec topology
Same parameters, so let's use the same template

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart 1a56804ff7 topology: align cht-nocodec and byt-codec topologies
Additional work needed to make the BE name and index configuration, as
well as LBM quirk.
We should be using a single topology here.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart ec47eefa13 topology: sof-byt-codec: connect pipe-host-volume-playback to mixer-dai
remove the low-latency pipeline and pcm-media.

Instead, we use 2 two pipe-host-volume-playback with different periods
connected to the same mixer-dai.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00