Commit Graph

5449 Commits

Author SHA1 Message Date
Karol Trzcinski 2263a8bc62 cmake: Include GIT_TAG in generated version.h file
GIT_TAG is user readable form of used source code version with
commit identifier, what is important for bugs reproducibility,
so it will be convenient to have this information in output logs.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Karol Trzcinski 901f991eee logger: Validate by src_hash instead of abi version from fw_ready
ABI version saved in fw_ready doesn't match with DBG_ABI version
saved in ldc file even for proper pair of fw and ldc file.
Moreover ldc file content changes at any log modyfication, what
is not related with DBG_ABI change, so this way of solving this
problem is incorrect.
Introduced src_hash value change solves both problems.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Karol Trzcinski 9f293b018d sof: Add `src_hash` to `sof_ipc_fw_version` structure
This field will be used to compare ldc file with loaded fw version,
to assert validity of trace logs. Value used in sof-logger.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Karol Trzcinski 60b737a7a1 sof: Calculate source code hash
It may be used to check FW compatibility with ldc file.
It's much better than comparing DBG_ABI because logs content
may be updated without any DBG_ABI change in opposite to source
code hash value.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Keyon Jie b4a6cea5aa cavs: implement PM runtime dynamic clock switching
Let's select WAKEUP_HOOK for all cAVS platforms, and just do nothing
inside if that's the true.

1. When CONFIG_CAVS_LPRO_ONLY=y, use LPRO only, no clock switching.

2. When CONFIG_CAVS_LPRO_ONLY=n, dynamic clock switching will be
enabled, and the clock switching will be performed during
platform_wait_for_interrupt() only.

In platform_clock_on_waiti(), perform dynamic clock switching if
needed (active_freq_idx will be updated to denote the active non-wfi
clock frequecy index), and then put CORE_HP_CLK to perform possible
HPRO->LPRO switching if CONFIG_CAVS_USE_LPRO_IN_WAITI is selected.

In platform_clock_on_wakeup(), when CONFIG_CAVS_USE_LPRO_IN_WAITI is
selected, get CORE_HP_CLK to perform switching back to HPRO if HPRO
is the saved non-wfi active clock, and no more switching needed.
Otherwise, need to restore the active cpu freq_idx manually.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-18 10:17:46 +01:00
Keyon Jie 6cdefe7b3a cAVS: clk: configure default CPU clocks
Define CPU_LPRO_FREQ_IDX, CPU_HPRO_FREQ_IDX and CPU_DEFAULT_IDX for all
cAVS platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-18 10:17:46 +01:00
Keyon Jie d8739fb355 platform: kconfig: only enable CAVS_USE_LPRO_IN_WAITI selection when
LPRO_ONLY is not set

When LPRO_ONLY is set, the item CAVS_USE_LPRO_IN_WAITI is not
configurable, and no clock switching is possible. Change to enable
CAVS_USE_LPRO_IN_WAITI selection only when LPRO_ONLY is not set.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-18 10:17:46 +01:00
Keyon Jie 837422ccf2 config: override: chrome: not enable CONFIG_CAVS_LPRO as it is for debug
only

The config item CONFIG_CAVS_LPRO (CONFIG_CAVS_LPRO_ONLY now) should be
used for debugging only at the moment, remove it from Chrome configs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-18 10:17:46 +01:00
Keyon Jie 418fa649a2 platform: rename CONFIG_CAVS_LPRO to CONFIG_CAVS_LPRO_ONLY
Today how we are using CONFIG_CAVS_LPRO is actually using LPRO only,
rename to make the naming accurate.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-18 10:17:46 +01:00
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
Liam Girdwood 4b2edf8eed zephyr: wrapper: complete zephyr support for working audio
This patch finalises the wrapper to allow LL scheduling of
timer domain audio, EDF sccheduling of IPC, trace re-direction
and kconfig build support.

There are still many items that are WIP and have been marked with
TODO: comments.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-14 15:07:34 +01:00
Liam Girdwood 37aab617da init: move slave core init to src/init.c
It's generic code and not xtensa specific.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-14 14:57:21 +01:00
Adrian Bonislawski 3049956219 ext_manifest: add platform-specific config elem
At initial version it will add CAVS_LPRO for CAVS platforms,
OUTBOX_SIZE and INBOX_SIZE

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-08-14 13:23:47 +01:00
Adrian Bonislawski 79fe66df6b ext_manifest: add simple config data element with IPC_MSG_SIZE
To avoid lots of single value structures this will introduce config data element
which will contain several simple token/value pairs

At initial version it will contain IPC_MSG_SIZE elem
which will inform kernel about maximum IPC msg size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-08-14 13:23:47 +01:00
Guennadi Liakhovetski 12359cac07 dw-dma: make sure current pointer values are always consistent
Incrementing the current DMA position pointer isn't atomic, use a
channel spin-lock to synchronise its reads and writes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-14 12:55:50 +01:00
Liam Girdwood 04ba7ba4ba zephyr: ll scheduler: use zephyr work Q for LL scheduller
Use a per core zephyr work Q for scheduling on the LL timer domain.
This also means we dont need to manage the timer directly hence the
conditional timer code.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-13 15:52:21 +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
Liam Girdwood 978957f0c0 zephyr: ipc: handler: dont use SOF APIs for D3 entry
Dont use the SOF API's, use Zephyr APIs when ready.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-13 09:26:45 +01: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
Liam Girdwood b25922023e zephyr: lib: memcpy should use zephyr version.
Also applies to host library.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-12 13:53:58 +01:00
Guennadi Liakhovetski d2076ce45c zephyr: dw-dma: fix a copy-paste error
Usually this error has no run-time effect, so this fix is mostly
theoretical.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-12 13:53:34 +01:00
Slawomir Blauciak caab1952f6 config: disable sa panic by default
System agent as a debug feature has very strict timing verification,
if the timing is not met it will result in a panic.
Such drastic measures are not suitable for release builds,
as a single scheduling delay has the potential to render the DSP FW
completely dead until reboot, due to lack of a FW recovery mechanism.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2020-08-12 13:53:10 +01:00
Karol Trzcinski 5b4b553283 ext_manifest: Add sof_ipc_user_abi_version content
This information known at build time does not need to be
provided in a mailbox.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-10 14:01:23 +01:00
Seppo Ingalsuo 56c29b45e4 Audio: ASRC: Reformat header file comments with longer lines
The 80 characters split lines were hard to read. This change
improves readability error codes enums.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-10 13:58:28 +01:00
Seppo Ingalsuo ecbb8c41e4 Audio: Fix pointer arithmetic mistake in ASRC initialize
This patch fixes the issue where impulse response update can
randomly corrupt stack in testbench environment. The error seen
in freeing cd->asrc_obj was free(): invalid next size (normal).
The violation was also confirmed with valgrind with error
Invalid write of size 4.

The order of impulse response storage and channel buffers are swapped
to simplify the pointer initialize calculations. The default
sizes for them are added as macro definitions into asrc_farrow.h.
Checks for used sizes are added to buffer and filter initialize
functions. The clear of buffer is done with memset instead of for loop.

Fixes: 4c995d0375
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-10 13:58:28 +01:00
Iulian Olaru 4c4dc2c532 platform: imx: Implement panic routine
This patch adds logic for the platform_panic() function, called in case
of a DSP oops.

This is important because it add a panic code in the debug box so the
application processor can understand why the oops happened. Also in
notifies the application processor about the oops generating an interrupt.

Signed-off-by: Iulian Olaru <iulianolaru249@yahoo.com>
2020-08-10 13:54:35 +01:00
Liam Girdwood b521bb1256 docker: alsa: allow alsa development in container
Build ALSA locally under /home/sof/work and don't delete it. This will
allow ALSA development within the container.
Change the folder owner to sof to avoid permission issue.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-08-10 13:51:40 +01:00
Liam Girdwood f52350ef3a docker: update toolchains to GCC 9.3 and GDB 8.3
Use the later toolchains for docker.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-10 13:51:40 +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
Liam Girdwood 9f2a1abdda zephyr: panic: use zephyr panic APIs when Zephyr is enabled.
Use the zephyr issue/panic reporting APIs when Zephyr RTOS is used.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-07 14:26:52 +01:00
Bartosz Kokoszko 0a62f2bf56 mn: get mn struct pointer using platform_shared_get() function
In order to get SHARED_DATA we should not use cache_to_uncache
macro directly, but platform_shared_get() function. Otherwise,
it can lead to situation, in which in one section there will
be cached and uncached variables not aligned to cache line
(as a result cache invalidation and writebacks could lead to
unexpected memory overwrite).

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-08-07 14:17:24 +01:00